.

gyro/install/updates/0002_rename_goto.php File Reference

Go to the source code of this file.

Functions

  core_update_2 ()

Function Documentation

core_update_2 (  ) 

Definition at line 2 of file 0002_rename_goto.php.

00002                          {
00003         $ret = new Status();
00004         // Replace History::goto with History::go_to => PHP 5.3 compatability
00005         $dir_iterator = new RecursiveDirectoryIterator(APP_INCLUDE_ABSPATH);
00006         $iterator = new RecursiveIteratorIterator($dir_iterator, RecursiveIteratorIterator::SELF_FIRST);
00007         foreach ($iterator as $file) {
00008             if ($file->isFile()) {
00009                 $path = $file->getPathName();
00010                 if (substr($path, -4) == '.php') {
00011                     $content = file_get_contents($path);
00012                     $count = 0;
00013                     $content = str_replace('History::goto', 'History::go_to', $content, $count);
00014                     if ($count) {
00015                         if (file_put_contents($path, $content) === false) {
00016                                 $ret->append("Could not update file $path");
00017                                 break;
00018                         }
00019                     }
00020                 }
00021             }
00022     }
00023     
00024     return $ret;
00025 }