The given mensch answer is not quite what I need - I never touched the index.php file - so I will tell you in detail what I'm trying here.
I use this site as a guide, but also my own comment! http://www.paulmarshall.us/blog/migrating-from-cakephp-13-to-cakephp-20
(I also found this: https://github.com/dereuromark/upgrade , in which I could take a picture if the above tutorial fails. but I love super-exhaustive documents rather than
Put `CakePlugin::loadAll();` in your app bootstrap to make sure this plugin is loaded
which is pointless to me ... can you specify the file folder? Any specific place in the file to add a line? etc., I will try and talk in detail about what I did!)
First of all, I noticed that the index.php that my cake used was not the index.php that came with the cake2.1 code. It is not clear why this is so, but I copied the "new" index 2.1 index.php (yes, this is the file app / webroot / index.php), and now I have a new error:
Note: Undefined index: Error / cake _install / lib / Cake / Core / Configure.php on line 94 Note: Undefined index: Exception in / cake _install / lib / Cake / Core / Configure.php on line 95 Fatal error: class name must be a valid object or line in /cake_install/lib/Cake/Error/ErrorHandler.php on line 126
(where cake_install is the folder where my cake application is located)
Work on it now ...
And now I see that the updater did not update the core.php file - in the / Config application (for 2.1, app / config for 1.3) ... what did the update tool really do? I cut and pasted version 2.1 (that is, from the zip code file 2.1, I took this file /app/Config/core.php and moved it to the / app / Config directory) and made sure that the salt and security were replaced. What is it.
Still out of luck. So, now I updated the database.php file (also in the / Config application or app / config). I changed
'driver' => 'mysqli',
to
'datasource' => 'Database/Mysqli',
Configuring files arbitrarily is fun!
Oh well, that's why upgrading to the kernel and database changed the error message ... is that good? Still not sure what their exalted “update” script did ... did it just change the file names? Really?
Warning (2): file_put_contents (/cake_install/app/tmp/logs/error.log): stream could not be opened: permission denied [CORE / Cake / Log / Engine / FileLog.php, line 69]
Note (1024): change the "Security.cipherSeed" value in the /Config/core.php application to the numeric (only digits) initial value specific to your application [CORE / Cake / Utility / Debugger.php, line 810]
Fatal error: Class 'AppHelper' not found in / cake _install / lib / Cake / View / Helper / HtmlHelper.php on line 31
Ok, so I am 777 / cake_install / app / tmp / logs / folder (chmod 777 -R folderHere) and
... I think I never updated the encryption seed. Ok, made up a new number! (What does the cipher seed do, you ask? Well, well, bing didn’t help much - I read the code. It seems to be used to encrypt / decrypt from cookies? Well, I can live with it)
Bootstrap.php
I moved the boot file to a zip file in my version (thanks a little, update the script!). Until any changes are made, I think I will need to download the plugins, though ... I'm sure this is well documented (hah!)
So this leaves me with this error:
Fatal error: Class 'AppHelper' not found in / cake _install / lib / Cake / View / Helper / HtmlHelper.php on line 31
And, of course, a qualified cake maker was not able to make another upgrade. Check out this page: http://book.cakephp.org/2.0/en/appendices/2-1-migration-guide.html
So now I have to make the files - just as they are on this page. The only trick is that yes, this is in the application folder, and no, my app / View folder created by cakePhp didn’t have a Helper subfolder ... so for AppHelper.php I had to make a helper subfolder under / app / View /.
...
HEY! Now I get the background and logo ... and these:
Note (8): Undefined variable: loggedIn [APP / pages / top_menu.html, line 3]
Note (8): Undefined variable: html [APP / pages / top_menu.html, line 25]
Fatal error: call the member function function () for the non-object in / cake _install / app / pages / top_menu.html on line 25
Great. Some cool new cake 2, which means I can't use $ html? It seems ... strangely appropriate, really.
chance. Now I need to change the way this $> data works? WHAT FOR?? WHAT FOR?? Why can't this crowd decide that apis tends to fix contracts rather than floating ideas ... argh. This is normal, the most used cake line that I have is now ... wrong. I am developing in scala or django from now on, younger languages ​​suck.
Here is what I ran: find. -type f -exec sed -i 's / $ this-> data / $ this-> request-> data / g' {} \;
I went to the / app directory to do this. This is 2.1 ... it's better to be seriously awesome ... the amount of work that everyone has to do to lift it. I suppose this is a normal day working with minor languages?
Ah, science fiction, the problem of $ html is caused by the fact that someone did not like the lowercase case? One may only wonder: Undefined var when using the Html Helper in CakePHP 2.0 And this solution: (thanks to another post in SO)
to find. -type f -exec sed -i 's / $ html / $ this-> Html / g' {} \;
And naturally the same problem with $ session -
to find. -type f -exec sed -i 's / $ session / $ this-> Session / g' {} \;
...
Things are coming! Now I have an incomprehensible error:
PagesController controller class not found.
Oh, for love ... so I need to move the PagesController found here:
Library / Cake / Console / Templates / Skel / Controller / PagesController.php
and put it here
app / Controller /
again, the Cake / updrader installer seems to be sleeping on a job.
And now I have
JavascriptHelper helper class not found.
This is not so bad - you will not find references to "JavascriptHelper", but you will find links to "Javascript" in the array "$ helpers". The inside adds the word Helper for additional obfuscation. Anyway, I searched for php files for any $ helpers arrays and found them in the AppController (2.1) class.
I don’t like and do not understand helpers - anyway, that's why I never used them. I must have been following the textbook blindly at some point and added it ... but I don't need it, so everything goes!
And now I need to clear all the ctp files that I had, where I used "require" to make sure the correct html was used. Once again I will use the find command on top to do this (point them to the View folder, not the View) Sigh. Well, no, it's not that simple, is it? Where I used to be:
required (app / View / Pages / man_front.html)
i now need:
required (/cake_folder/app/View/Pages/man_front.html)
(where the cake folder is where all my cake things are. It’s not clear why this is, but a simple find is fixed:
find . -type f -exec sed -i 's/app\/View\/Pages/\/cake_folder\/app\/View\/Pages/g' {} \;
(the \ will "depower" a /)
So, having done all this and getting your site at some acceptable level, what's next? Now you can find some problems with db:
Warning (2): mysqli :: mysqli () expects parameter 1 to be the string given by the array [CORE / Cake / Model / ConnectionManager.php, line 101]
Fatal error: calling the Undefined method mysqli :: getSchemaName () in / cake _install / lib / Cake / Model / Model.php on line 3383
Of course, mysqli is no longer supported. Edited database.php to use mysql instead (i.e. I just deleted the end of "i")
(what is wrong with peeps in cakephp ??? API means "don’t change everything if it breaks existing code, ever." don’t "change! OBAMAAAAA!" ~ next update, I will click all my code for django or spring or scala. Ruddy bullshit.)
The next problem is the “Components” that I use - I get a cake error saying:
Missing plugin
Error: application is trying to download a file from the Uploader plugin
Error: make sure your plugin loader is in the application / plugin directory and loaded
<?php CakePlugin::load('Uploader');
Download all plugins: if you want to download all plugins at once, use the following line in the app / Config / bootstrap.php file
CakePlugin::loadAll();
So ... not only all my code is ruined, but all the old plugins too? Nice.
The solution is to create the application / plugin folder (yes, the magic upgrade does not do this either), and then look at the plugins that you had. Now! This is different from your components! I don’t know yet how to do this - check my question for a possible answer: Is there a difference between the component and the plugin in cakephp 2.1? - but right now we are just looking at the PLUGIN folder and plugins in general. It seems that there were 1.3 plugins in the cake are listed as follows:
var $ components = array ('Uploader.Uploader', ...);
those. with dotted designation. I can live with it. In my case, I needed to get the latest version of the Uploader plugin (which, fortunately, was updated to be compatible with 2.x!) And put it in the app / Plugin folder
so i got:
app Plugin Uploader Config Locale <the other files here too!>
It seems to work right now, cheers!
The following error:
Warning (2): Invalid argument provided by foreach () [CORE / Cake / Utility / Set.php, line 1048]
Warning (2): array_multisort () [ http://php.net/function.array-multisort] : Argument # 1 is expected as an array or sort flag [CORE / Cake / Utility / Set.php, line 1087]
Warning (2): array_unique () expects parameter 1 to be an array, null set to [CORE / Cake / Utility / Set.php, line 1089]
Warning (2): Invalid argument provided by foreach () [CORE / Cake / Utility / Set.php, line 1091]
Warning (2): Unable to change header information - headers already sent (output started in / cake _install / lib / Cake / Utility / Debugger.php: 761) [CORE / Cake / Network / CakeResponse.php, line 395]
Ah, then good. This is clear. I'm glad I know what an error is in my code. Good error messages!
Now I see, it's silly, to think that the Set :: Sort utility will continue to work if the first array is empty! Truly, people with fabric stand, not on the shoulders of giants, but on their very foreheads.
It would seem that the new version 2.1 update eliminates this shabby practice, so now I need to check before any Set: Sort call, to avoid if the array in question is empty or null. Good. Easy enough, but ... booze.
and that fixed it.
Now I get FormHelper errors - it looks like $ form in the view now becomes $ this-> Form, so to replace this parameter I will need another quick script:
to find. -type f -exec sed -i 's / $ form / $ this-> Form / g' {} \;
And now the following error I get:
Fatal error: unsupported operand types in / cake _install / lib / Cake / View / Helper / FormHelper.php on line 1804
And now they've already mixed up the "select" method in FormHelper - like this before when I had this:
echo $ this-> Form-> select ('treatment_id', $ treatment, null, array ('empty' => '- select treatment to rate -'));
i now this:
echo $ this-> Form-> select ('treatment_id', $ treatment, array ('empty' => '- select treatment to rate -'));
And now one of my components - in fact, the You_tube_loader_component component - has been broken. I need to change it so that the title reads:
class YouTubeLoaderComponent extends Component { function __construct(ComponentCollection $collection, $settings = array()) { parent::__construct($collection, $settings); ... } }
I used to just default valeus uname and password - now I attach them to the "..." section instead of messing around with a mysterious array of "settings"!
Further:
Warning (2): Type of invalid offset [CORE / Cake / Model / Model.php, line 2689]
Warning (2): Type of invalid offset [CORE / Cake / Model / Model.php, line 2665]
Soooo is a problem that is not selected in cake 1.3, but is in version 2.1
The problem is that in the action of the referenced controller, there is a call to "find" without a type parameter. That is, I had
$ results = $ this-> User-> find (array (...), array (...), null, false);
where I should have been:
$results = $this->User->find('first',array( 'conditions' => array("User.id" => ($this->Auth->user("id"))), 'fields' => array("User.confirmed") ) );
Another problem I had was that for some reason the check:
$ this-> set ('loggedIn', $ this-> Auth-> user ('id'));
does not work. Apparently (although I'm not sure how / why), cakePHP auth in 2.x will no longer store all user details in the session. I don’t know what details he stores at the session, or how to modify them - looking at that! - but my code did not save the "id" value, so the check above always sets the loggedIn value to false.
To fix the error, I changed the call as follows:
$ this-> set ('loggedIn', $ this-> Auth-> loggedIn ());
which worked great for me.
The next problem is that the user thios-> auth-> ('id') will return me a sweet nothing after the user logs in. Fortunately, I came across this post, which made everything clearer:
http://ask.cakephp.org/questions/view/unable_to_access_logged-in_users_data_in_2_0
Surprisingly, the geniuses in the cake laboratories believed that changing the way that entering the work would help eliminate some confusion. Honestly, the only thing I am confused with is the one who was so embarrassed that all user data was available in the auth component after logging in. But do not be afraid, they cleared up the confusion and ... removed the function completely.
So what do you do? The link above offers to get all user data, and then send it to the auth authorization section. I don’t particularly like it (because it is a stupid problem, and I can’t believe that it is not so demanding), but that’s what I have to do. Suggestions are welcome!
So, instead of oh-so-confusing:
if ($this->Auth->login($this->request->data)) { ...
i now have:
$user = $this->User->find('first', array( 'conditions' => array('User.email' => $this->request->data['User']['email']) ) );
Isn't it so neat and less confusing? Good job cakephp mavericks!
The following error:
Authorization adapter "controller" not found.
Which is a bit vague ...
Oh! Already answered stack overflow: Authorization adapter not found in cakePHP
And it's all! There may be other problems - the speed of the gods on them - but I have not encountered them, so I can no longer help you.