Development

/branches/1.1/lib/task/project/upgrade1.1/sfEnvironmentUpgrade.class.php

You must first sign up to be able to contribute.

root/branches/1.1/lib/task/project/upgrade1.1/sfEnvironmentUpgrade.class.php

Revision 7397, 1.3 kB (checked in by fabien, 7 years ago)

added sfTask::log() and sfTask::logSection() shortcuts

  • Property svn:mime-type set to text/x-php
  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
Line 
1 <?php
2
3 /*
4  * This file is part of the symfony package.
5  * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
6  *
7  * For the full copyright and license information, please view the LICENSE
8  * file that was distributed with this source code.
9  */
10
11 /**
12  * Upgrades symfony environement.
13  *
14  * @package    symfony
15  * @subpackage task
16  * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
17  * @version    SVN: $Id$
18  */
19 class sfEnvironmentUpgrade extends sfUpgrade
20 {
21   public function upgrade()
22   {
23     // we can only upgrade once
24     if (file_exists(sfConfig::get('sf_data_dir').'/environment.migrated'))
25     {
26       return;
27     }
28
29     $phpFinder = $this->getFinder('file')->name('*.php');
30     foreach ($phpFinder->in(array_merge($this->getProjectClassDirectories(), $this->getProjectConfigDirectories())) as $file)
31     {
32       $content = file_get_contents($file);
33       $content = str_replace(
34         array('sf_cache_dir', 'sf_root_cache_dir', 'sf_base_cache_dir'),
35         array('sf_app_cache_dir', 'sf_cache_dir', 'sf_app_base_cache_dir'),
36         $content, $count
37       );
38
39       if ($count)
40       {
41         $this->logSection('environment', sprintf('Migrating %s', $file));
42         file_put_contents($file, $content);
43       }
44     }
45
46     touch(sfConfig::get('sf_data_dir').'/environment.migrated');
47   }
48 }
49
Note: See TracBrowser for help on using the browser.