I read over the guide here: http://book.cakephp.org/2.0/en/appendices/2-0-migration-guide.html which describes the changes to Cake for version 2.0, but it doesn't explicitly say how to make the upgrade.
I also saw this: http://book.cakephp.org/2.0/en/console-and-shells/upgrade-shell.html#upgrade-shell which I figured would give a little more instruction.
So far this is what I've done to the existing version (1.3) on my server.
Went and grabbed the zipped copy of 2.0 from the repo here: https://github.com/cakephp/cakephp/tree/2.0
Added the new index.php file into my webroot
Noticed that the new cake core folder exists one level within the parent directory lib so it's (webroot)/lib/Cake instead of (webroot)/cake. So now in my webroot I have my old '/cakecore, and now a folder called/libwhich contains the new core (2.0) and my old '/app folder as well as the old '/vendors` folder.
I ran from inside /lib/Cake/Console this command: ./Console/cake upgrade all which scrolled a bunch of stuff like:
Done updating
/home/bob_cobb/public_html/mydomain.com/lib/Cake/TestSuite/CakeTestSuite.php
This didn't change anything in my original /app folder as all controllers are still underscored and lowercase.
What am I missing here? I renamed my old /cake core folder and the site stopped working, so it's obviously still relying on that. Should I just scrap everything and start over (delete 1.3 completely while saving all my old files and just re-create them with a fresh version of 2.0)?
Any advice on how to get this migration process going would help greatly. I expect a few things to not work anymore, but I just need a push in the right direction. Thanks.
If you use the core one you might need to do more than just run the upgrade shell to make that happen.
I use an enhanced version which should convert everything with a single click.
See "Upgrade using the upgrade shell" #
http://www.dereuromark.de/2011/10/31/freshly-baked-cake2-0-tips/
But most importantly you should always run your scripts from the app dir
app2.0dir>..\lib\Cake\Console\cake Upgrade ...
This way it will find the correct paths
Related
I am totally new to PHP / Laravel / Linux / composer / docker etc.
However I do have the task: go retrieve some code files from an internal server and make a docker container out of it. The project is written in PHP 7.1.3 and uses the Laravel framework.
I've copied the whole https folder from the server which I think contains everything I need.
I also was able to create the example app from the Laravel documentation and also I made a brand new Laravel project. However, is there any chance to "generate" a new project using all the code files I have right now?
I even have a composer.json and composer.lock file, which in my opinion should "list" every component I would need in my docker installation, right?
What also bugs me is that I can't even get the project working on my dev machine...
I think you should do this step by step. But let me first answer some of your questions.
If "https" folder contains similar folder structure like fresh Laravel installation, it is likely to be all of it. But we can not be sure about it.
As far as i know there is no way to generate new project out of your files. First of all you need to know which Laravel version project uses. It must be stated at composer.json.
In you composer.json file lists required packages for you project. When you install them this packages are installed folder called vendor
Here is my suggestions;
As you stated it seems you are very new about these topics if someone give these task to you its not a smart way to teach this kind of topics.
I think you have to start with running project in your local machine. If you get errors than ask them in a new question. Most likely you need database and you need to know running migrations seeds etc.
When you manage to run the project you can start dockerizing your project. If your project is build with newer versions of laravel you can easly use sail otherwise you can build own dockerfile or upgrade laravel to newer versions.
Your problem is too broad, i think you cannot find answers to such question.
Trying to fathom out how to update smarty php framework from 3.11 to current 3.21
Can anyone suggest where to find a detailed guide for a dummy or list step by step here?
Ive searched just about everywhere.
Yes i understand 3.22 arrives shortly (2 weeks) and will come as standard set for HHVM this being why i want to resolve any issues now in the current update before tackling any when 3.22 arrives.
Thanks
Updating Smarty from version 3.xx to 3.yy is usually not very difficult, its nothing like the big upgrade from 2.xx (but they've written a guide for that....). Just replace your Smarty installation directory with the one from of the newer installation.
Just for safety reasons, I usually do it like this in my development enviroments.
Directory structure:
./Smarty/ <- Symlink to ./Smarty-3.1.12/
./Smarty-3.1.12/
./Smarty-3.1.13/
Your php-scripts include Smarty like this:
require('./Smarty/libs/Smarty.class.php');
For an update just copy the newer version into a new folder and change the symlink to show to the new folder.
rm Smarty
ln -s Smarty-3.1.13 Smarty
If you run into issues, just switch the symlink back to the old installation until solving the issues.
You might have to empty your /templates_c/-directory, too, in some cases.
SOS! SOS!
After a good day of work and testing out everything, I committed my work. Except, this time, instead of
git commit -u
I used
git commit -A
because I was fed up of the untracked files alert I was getting about some of the zend files like doctrine, composer etc. And boom! the project has stopped loading.
I tried going back in my log, hoping that a previous commit should work, but nothing is working.
My question is:
1. How to remove the zend files from the commit
2. How to clean this mess?
Please help!
The world is beautiful again.
Sharing the stack of mistakes I did, so that it may help someone someday:
Committed zend framework files with the project files. Specially the vendor ones. NEVER do that. .gitignore them
After committing, when I moved to a previous branch, the project started throwing 500, because it was not able to find all the zend files. (git was trying to reset the files to the previous stage and I presume there was a mismatch in the zend framework files)
I added another blunder to this sequence by doing a php composer.phar install in the zend folder, expecting that the missing files will be regenerated.
Solution:
1. Did a soft reset: git reset --soft HEAD~3 to go back to a stable commit
2. Removed all zend files
3. Recommitted the desired files
4. This is when I started getting badmethodcall from zend/navigation/navigation. This was because composer install, loaded zendframework folder in the vendor folder in addition to ZF2 folder. There should be only one shared library folder in the vendor folder. Now, why was zendframework taking precedence over ZF2 with regard to rendering the menu - I have no clue. But I deleted the zendframework, and butterflies started singing.
Thanks to anyone who tried to help me.
Let me just start by saying that I've posted this to multiple forums and even tried to get help on the ZF IRC channel. I've been Googling for a straight week and still no results. I've read a lot of Q's and A's on this site in the past, so I figured I'd make an account and try asking you.
(Yes, I've searched previously asked questions, but none of the answers helped me.)
I'm trying to learn how to use Zend Framework for a new project that I've joined. For compatibility reasons they are using Zend 1 (and not the newer Zend 2). I have found and followed a number of online and physical book tutorials but I've the same results over and over again.
So here goes (this are the instructions that all the tutorials give). I went to framework.zend.com and downloaded the full version of ZF 1.12.
I unzipped the contents
I moved the library folder to a safe directory where it won't be modified
I moved the contents of the bin folder to same directory as my PHP executable
I changed the include_path in my php.ini file to include the library directory
I updated my Windows PATH variable to make sure it included the path to the PHP executable
I ran
zf --help
This command worked as intended. I also successfully ran zf show version (Zend Framework Version 1.12.7).
I ran the command
zf create project myproject
Upon doing this, I receiving the following error message:
Fatal error: Class 'PHPUnit_Framework_TestCase' not found in D:\Zend\library\Zend\Test\PHPUnit\ControllerTestCase.php on line 48
That particular line in question is a class declaration that extends PHPUnit_Framework_TestCase. I don't know where PHPUnit_Framework_TestCase is defined. It is not in any of the files or directories that came in the single ZIP file that I downloaded from Zend. I even ran grep on all files and folders searching for the string "class PHPUnit_Framework_TestCase" but it printed no results.
Some have suggested that I don't have PHPUnit installed (which is obvious to me now). The part that bugs me is that absolutely none of the tutorials that I read mention anything about installing PHPUnit before hand or how to install it or what dependencies Zend has on it. Many of these were beginner tutorials that assumed you only had a basic knowledge of PHP, and it's pretty shocking to me that none even mentioned PHPUnit. If PHPUnit was that important I would think that the file I downloaded from Zend would have included it. I guess not.
So I went online again and got the PHAR file for PHPUnit, but now what? I tried putting it in multiple different directories but I still get the same error. Am I not supposed to use a PHAR file? Should I be using the actual files instead?
What do I have to do to get ZF to recognize PHPUnit, resolve this error and create my first ZF project?
Additional Info:
Windows 7, XAMPP Server (running on localhost), PHP 5.5.6
Assuming you have PHPUnit installed and it is on your include path (Bearing in mind that ZF1 only officially supports PHPUnit 3.4.x and definitely doesn't support anything above PHPUnit 3.5.x, so if you're using XAMPP you may have to downgrade PHPUnit as described here). The problem is most probably due to this commit, where the require calls for PHPUnit were stripped out in favour of using an autoloader. The ZF tool over CLI doesn't set up an autoloader though, so PHPUnit is not found because it is simply not required! To fix you can return these lines to the start of Zend/Test/PHPUnit/ControllerTestCase.php
/** #see PHPUnit_Runner_Version */
require_once 'PHPUnit/Runner/Version.php';
/**
* Depending on version, include the proper PHPUnit support
* #see PHPUnit_Autoload
*/
require_once (version_compare(PHPUnit_Runner_Version::id(), '3.5.0', '>=')) ? 'PHPUnit/Autoload.php' : 'PHPUnit/Framework.php';
It's worth noting that even with the error you mention, ZF tool should still work correctly when setting up a project, it just won't produce unit test actions (you'll have to make them yourself). If you don't want to downgrade your XAMPP PHPUnit version you should be able to add the correct version locally to your project using composer as described here.
Update Jan 2015:
Downgrading PHPUnit for XAMPP is no longer necessary as ZF1 has supported at least version 4.1 of PHPUnit since 1.12.7 (I've not tested above 4.1). This is helpful as PHPUnit has completely removed their deprecated Pear repository as of December 2014, which means you can't download versions older than 3.7 anymore anyway! (Currently XAMPP ships with PHPUnit 3.6). These days though it's probably worth chucking XAMPP for Vagrant and globally installing PHPUnit 4.1 via Composer during Vagrant provisioning.
I recommend using Composer to load both ZF and PHPUnit. Then make sure to include the Composer autoload.php file as your/in your phpunit boostrap file.
I had the same problem when I set up my laptop as a second development machine and downloaded the newest version of Zend Framework 1 (1.12.9). Whenever I tried to create a new action in a controller, I got the same error. Yet on my main computer, it worked fine.
I realized it was because the version of ZF1 I had in my php includes path was actually 1.11.11. So I went and got 1.11.14 from the ZF archives page, put it in the includes directory, and it worked fine.
Not entirely sure if this is the best way to make it work, since it is an older version, but at least it does work. And until someone actually comes on here and offers a better solution, that's what I intend to stick with.
You can create or edit a .zf.ini file in your home directory (~/.zf.ini or C:\Users\YOUR_ACCOUNT\.zf.ini on Windows)
php.include_path = "PATH_TO_THE_LIBRARY_FOLDERS_CONTAINING_ZEND_AND_PHPUnit"
basicloader.classes.0 = "PHPUnit_Framework_SelfDescribing"
basicloader.classes.1 = "PHPUnit_Framework_Test"
basicloader.classes.2 = "PHPUnit_Framework_Assert"
basicloader.classes.3 = "PHPUnit_Framework_TestCase"
If you are using Netbeans on Windows it could looks like this (you can put several library folder, just separate them with a semicolon ;) :
php.include_path = "C:\Users\romain\dev\ZendFramework-1.12.17\library;C:\Program Files\NetBeans 8.1\php\zend;C:\xampp\php\pear"
basicloader.classes.0 = "NetBeansCommandsProvider"
basicloader.classes.1 = "PHPUnit_Framework_SelfDescribing"
basicloader.classes.2 = "PHPUnit_Framework_Test"
basicloader.classes.3 = "PHPUnit_Framework_Assert"
basicloader.classes.4 = "PHPUnit_Framework_TestCase"
I want to customize a module that I installed using composer, and it is now in /vendor. When I copy it in /module directory, it won't be recognized anymore. Here is the file /vendor/composer/autoload_classmap.php, that I added this into it:
return array(
'myModule\\Module' => $vendorDir . '/../module/myModule/Module.php',
);
and after that it was working. But the problem is that whenever I run php comnposer.phar install that file is overwritten and again I have to update that file.
It seems that I am doing it wrong. So, What's the correct way to copy a module from vendor directory to module directory without loosing the functionality?
Regards
Edit: I want to fork the package and edit that fork.
Technically you can change where composer installs things to by specifying a vendor-dir in your app's composer.json, see: https://getcomposer.org/doc/04-schema.md#config But this would affect all composer-installed packages, including (presumably) your installation of Zend Framework itself.
I would recommend you just leave the vendor folder as-is and let Composer do its thing.
Edit: Okay, if you want to fork a project, it's best to make changes outside of your app. Checkout a copy of your fork, make any changes you need and commit them. Then run composer update in your app to bring in the updated version.
If you need to test your changes in the app before committing them, that can be a bit fiddly. Personally I would either symlink to the checkout elsewhere on the file system (temporarily, just to get it working). Or edit the files in vendor just to figure out what changes you need to make, then apply those changes again to your separate forked project. There may be a better way though.
I think you have to ask this question before trying to solve this problem:
Why i need to move this directory to another place?
Editing / modifying / moving any file or directory which located under the vendor folder or incorporating them to your awesome application's module/library/whatever folder by copy & paste is not a good practice. Composer won't like that.
To customize a library code, create your own module (or library) folder and properly extend composer-installed 3rd party library classes which needs to provide more or different functionality.