Friday, May 17, 2013

Trouble using upgrade shell

I think it is great that the CakePHP team created the Upgrade Shell.

However, I'm having trouble using it. I have a working 1.3 app that I want to upgrade to the latest version of CakePHP (2.3.5 at this time). I am doing this on a Windows 7 PC running Apache 2.2.

I went to the Cookbook and found the instructions for using the upgrade shell. I followed all of the steps (backing up, copying over the 2.3.5  lib and all it's sub directories to the root, copied the app/Console directory from 2.3.5 to my app directory). Following the examples in the Cookbook I ran:
.\Console\cake upgrade all
There were some errors at the very beginning and warnings during the locations part of the script as follows:

C:\apache22\htdocs\wtcms2x\app>.\Console\cake upgrade all


Notice: Undefined index:  Error in C:\apache22\htdocs\wtcms2x\lib\Cake\Core\Configure.php on line 99

Call Stack:
    0.0004      57936   1. {main}() C:\apache22\htdocs\wtcms2x\app\Console\cake.php:0
    0.0020     179200   2. ShellDispatcher::run() C:\apache22\htdocs\wtcms2x\app\Console\cake.php:37
    0.0020     179840   3. ShellDispatcher->__construct() C:\apache22\htdocs\wtcms2x\lib\Cake\Console\ShellDispatcher.php:67
    0.0023     181456   4. ShellDispatcher->_initEnvironment() C:\apache22\htdocs\wtcms2x\lib\Cake\Console\ShellDispatcher.php:56
    0.0023     182416   5. ShellDispatcher->_bootstrap() C:\apache22\htdocs\wtcms2x\lib\Cake\Console\ShellDispatcher.php:100
    0.0042     293104   6. require('C:\apache22\htdocs\wtcms2x\lib\Cake\bootstrap.php') C:\apache22\htdocs\wtcms2x\lib\Cake\Console\ShellDispatcher.php:130
    0.0129    1040664   7. Configure::bootstrap() C:\apache22\htdocs\wtcms2x\lib\Cake\bootstrap.php:170


Notice: Undefined index:  Exception in C:\apache22\htdocs\wtcms2x\lib\Cake\Core\Configure.php on line 100

Call Stack:
    0.0004      57936   1. {main}() C:\apache22\htdocs\wtcms2x\app\Console\cake.php:0
    0.0020     179200   2. ShellDispatcher::run() C:\apache22\htdocs\wtcms2x\app\Console\cake.php:37
    0.0020     179840   3. ShellDispatcher->__construct() C:\apache22\htdocs\wtcms2x\lib\Cake\Console\ShellDispatcher.php:67
    0.0023     181456   4. ShellDispatcher->_initEnvironment() C:\apache22\htdocs\wtcms2x\lib\Cake\Console\ShellDispatcher.php:56
    0.0023     182416   5. ShellDispatcher->_bootstrap() C:\apache22\htdocs\wtcms2x\lib\Cake\Console\ShellDispatcher.php:100
    0.0042     293104   6. require('C:\apache22\htdocs\wtcms2x\lib\Cake\bootstrap.php') C:\apache22\htdocs\wtcms2x\lib\Cake\Console\ShellDispatcher.php:130
    0.0129    1040664   7. Configure::bootstrap() C:\apache22\htdocs\wtcms2x\lib\Cake\bootstrap.php:170


Welcome to CakePHP v2.3.5 Console
---------------------------------------------------------------
App : app
Path: C:\apache22\htdocs\wtcms2x\app\
---------------------------------------------------------------
Moving config to Config
Moving views to View
Moving models to Model
Moving Model\behaviors to Model\Behavior
Moving Model\datasources to Model\Datasource
Moving View\configs to View\Configs
Moving View\contacts to View\Contacts
Moving View\content_blocks to View\ContentBlocks
Moving View\elements to View\Elements
Moving View\errors to View\Errors
Moving View\helpers to View\Helpers
Moving View\images to View\Images
Moving View\layouts to View\Layouts
Moving View\pages to View\Pages
Moving View\sitemaps to View\Sitemaps
Moving View\test_installation to View\TestInstallation
Moving View\users to View\Users
Moving C:\apache22\htdocs\wtcms2x\app\app_controller.php to C:\apache22\htdocs\wtcms2x\app\Controller\AppController.php

Warning: rename(C:\apache22\htdocs\wtcms2x\app\app_controller.php,C:\apache22\htdocs\wtcms2x\app\Controller\AppController.php): No such file or directory in C:\
apache22\htdocs\wtcms2x\lib\Cake\Console\Command\UpgradeShell.php on line 626

When the script was done there was a dir called Controller (2.x naming) and another one called controllers (1.3 naming). I checked the contents of the dir Controller and all of my controllers were there. 

In my routes.php I have the following:
Router::connect('/', array('controller' => 'pages', 'action' => 'index'));

When I attempted to run the app (http://localhost/wtcms) I get an error from CakePHP saying that index() does not exist in PagesController and that I should create app/controllers/pages_controller.php.

This looked like I had a mixture of the 2 environments. I checked to see if app/webroot/index.php had been updated to 2.3.5 and it had not. I went through and replaced all the old index.php and .htaccess files at each levels root, /app. and app/webroot with 2.3.5 versions.

Now when I run the app I get the following errors:

( ! ) Notice: Undefined index: Error in
C:\apache22\htdocs\wtcms2x\lib\Cake\Core\Configure.php on line /99/
Call Stack
# Time Memory Function Location
1 0.0014 84744 {main}( ) ..\index.php*:*0
2 0.0040 195232 include(
'C:\apache22\htdocs\wtcms2x\lib\Cake\bootstrap.php' ) ..\index.php*:*91
3 0.0141 942952 Configure::bootstrap( ) ..\bootstrap.php*:*170


( ! ) Notice: Undefined index: Exception in
C:\apache22\htdocs\wtcms2x\lib\Cake\Core\Configure.php on line /100/
Call Stack
# Time Memory Function Location
1 0.0014 84744 {main}( ) ..\index.php*:*0
2 0.0040 195232 include(
'C:\apache22\htdocs\wtcms2x\lib\Cake\bootstrap.php' ) ..\index.php*:*91
3 0.0141 942952 Configure::bootstrap( ) ..\bootstrap.php*:*170


( ! ) Notice: Undefined index: datasource in
C:\apache22\htdocs\wtcms2x\lib\Cake\Model\ConnectionManager.php on line
/264/
Call Stack
# Time Memory Function Location
1 0.0014 84744 {main}( ) ..\index.php*:*0
2 0.0464 2471864 Dispatcher->dispatch( ) ..\index.php*:*109
3 0.0736 3800288 Dispatcher->_invoke( ) ..\Dispatcher.php*:*162
4 0.0815 4091928 Controller->startupProcess( ) ..\Dispatcher.php*:*184
5 0.0817 4099880 CakeEventManager->dispatch( ) ..\Controller.php*:*670
6 0.0819 4101272 call_user_func <http://www.php.net/call_user_func> ( )
..\CakeEventManager.php*:*248
7 0.0819 4101464 PagesController->beforeFilter( )
..\CakeEventManager.php*:*0
8 0.1378 5699672 Page->getMenu( ) ..\PagesController.php*:*47
9 0.1378 5701080 AppModel->get( ) ..\Page.php*:*71
10 0.1378 5702016 Model->find( ) ..\AppModel.php*:*39
11 0.1385 5716008 Model->getDataSource( ) ..\Model.php*:*2696
12 0.1385 5716320 Model->setSource( ) ..\Model.php*:*3243
13 0.1385 5717344 Model->setDataSource( ) ..\Model.php*:*1108
14 0.1407 5779784 ConnectionManager::getDataSource( ) ..\Model.php*:*3221
15 0.1413 5785928 ConnectionManager::_getConnectionObject( )
..\ConnectionManager.php*:*93
16 0.1413 5786504 ConnectionManager::_connectionData( )
..\ConnectionManager.php*:*249


( ! ) Fatal error: Class 'AppHelper' not found in
C:\apache22\htdocs\wtcms2x\lib\Cake\View\Helper\HtmlHelper.php on line /32/
Call Stack
# Time Memory Function Location
1 0.1668 6239336 ErrorHandler::handleException( ) ..\ErrorHandler.php*:*0
2 0.1713 6372592 ExceptionRenderer->render( ) ..\ErrorHandler.php*:*123
3 0.1713 6373224 call_user_func_array
<http://www.php.net/call_user_func_array> ( ) ..\ExceptionRenderer.php*:*176
4 0.1713 6373416 ExceptionRenderer->_cakeError( )
..\ExceptionRenderer.php*:*0
5 0.1714 6375680 ExceptionRenderer->_outputMessage( )
..\ExceptionRenderer.php*:*198
6 0.1714 6376368 Controller->render( ) ..\ExceptionRenderer.php*:*274
7 0.1784 6750944 View->render( ) ..\Controller.php*:*948
8 0.1993 6789648 View->renderLayout( ) ..\View.php*:*479
9 0.1997 6792808 View->_render( ) ..\View.php*:*535
10 0.1998 6795520 View->_evaluate( ) ..\View.php*:*909
11 0.2004 6907496 include(
'C:\apache22\htdocs\wtcms2x\app\View\layouts\default.ctp' )
..\View.php*:*947
12 0.2004 6911360 View->__get( ) ..\View.php*:*0
13 0.2004 6912104 HelperCollection->__isset( ) ..\HelperCollection.php*:*0
14 0.2004 6912544 HelperCollection->load( ) ..\HelperCollection.php*:*63
15 0.2005 6914584 class_exists <http://www.php.net/class_exists> ( )
..\HelperCollection.php*:*130
16 0.2005 6914864 App::load( ) ..\App.php*:*0
17 0.2061 7204936 include(
'C:\apache22\htdocs\wtcms2x\lib\Cake\View\Helper\HtmlHelper.php' )
..\App.php*:*562

Notice, the first two Notices are the same as the first errors I got when I ran the upgrade script.

Can anyone help. I'm really stuck here. I figure I must be doing something wrong but I can't figure out what it is. Are there other files that the upgrade shell doesn't replace that I need to replace manually? I have gone through the 2.0 Migration Guide and I didn't see anything there. It doesn't even say that the index.php file in webroot needs to be replaced. Does it?

Thanks,
Ken

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments: