Development

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

You must first sign up to be able to contribute.

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

Revision 7397, 1.1 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) 2004-2006 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  * Upgrade sfComponent.
13  *
14  * @package    symfony
15  * @subpackage task
16  * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
17  * @version    SVN: $Id$
18  */
19 class sfComponentUpgrade extends sfUpgrade
20 {
21   public function upgrade()
22   {
23     $phpFinder = $this->getFinder('file')->name('*.php');
24     $dirs = glob(sfConfig::get('sf_apps_dir').'/*/modules/*/actions');
25     foreach ($phpFinder->in($dirs) as $file)
26     {
27       $content = file_get_contents($file);
28       $content = str_replace(
29         array('$this->sendEmail', '$this->getPresentationFor'),
30         array('$this->getController()->sendEmail', '$this->getController()->getPresentationFor'),
31         $content, $count
32       );
33       if ($count)
34       {
35         $this->logSection('component', sprintf('Migrating %s', $file));
36         file_put_contents($file, $content);
37       }
38     }
39   }
40 }
41
Note: See TracBrowser for help on using the browser.