A good many people have hit the CakePHP group asking what needs to be done to upgrade from 1.1. to 1.2. I imagine the most painful changes are the loss of $html helper calls in the views, and $this->generateList calls in controllers. $form helper will handle all the deprecated html calls, and $this->Model->find(‘list’); will handle select boxes. Of course most people notice immediately that templates and layouts no longer use .thtml extensions. If your running Linux, changing all the template extensions from thtml to ctp is a breeze. Just use the bash file below in your views directory. It is worth noting this script will rename any extension to any new extension on all matching files in a directory. It is not limited to CakePHP, that is merely the need that begat its creation. If no files match in a particular directory a message is printed; otherwise files are listed and renamed. renameExt
#!/bin/bash #script by edward a webb
#renames files recursively based on old and new extensions passed into the script. #lists files that match or prints no match message for each sub-directory
if [ $# -ne 3 ]
echo “Usage: $0 dir_name old_ext new_ext "
pushd $TOPD >/dev/null
for DIR in $DIRS
if [ -d $DIR ]
pushd $DIR >/dev/null 2&>1
echo NOW IN: $DIR;echo " "
ls *.$OEXT 2>/dev/null
echo $FILES | cut -d" " -f1
if [ $dummy ]
echo " Files to rename”;echo " "
echo " No files with extension .$OEXT”
for FILE in $FILES
if [ -f $FILE -a -w $FILE ]
echo " $NAME”
mv $FILE $NAME.$NEXT
echo " "
popd >/dev/null 2>&1
The script can be saved anywhere, and requires 3 parameters, the directory, the old extension, and the new one. Example
Leave out the hash(#) that represents your ‘nix command prompt..duh. And as Peter points out, don't use periods ‘.’ in the extensions, just the letters.