/oiclient/data/symfony/task/project/upgrade1.1/sfUpgrade.class.php
PHP | 112 lines | 56 code | 11 blank | 45 comment | 0 complexity | 9788ab2a6a74eff11375cae5e9bb711e MD5 | raw file
Possible License(s): LGPL-2.1, AGPL-3.0
- <?php
- /*
- * This file is part of the symfony package.
- * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
- /**
- * Abstract class for upgrade classes.
- *
- * @package symfony
- * @subpackage task
- * @author Fabien Potencier <fabien.potencier@symfony-project.com>
- * @version SVN: $Id: sfUpgrade.class.php 8148 2008-03-29 07:58:59Z fabien $
- */
- abstract class sfUpgrade extends sfBaseTask
- {
- protected
- $task = null;
- /**
- * Upgrades the current project from 1.0 to 1.1.
- */
- abstract public function upgrade();
- public function execute($arguments = array(), $options = array())
- {
- throw new sfException('You can\'t execute this task.');
- }
- /**
- * Returns a finder that exclude upgrade scripts from being upgraded!
- *
- * @param string String directory or file or any (for both file and directory)
- *
- * @return sfFinder A sfFinder instance
- */
- protected function getFinder($type)
- {
- return sfFinder::type($type)->prune('symfony')->discard('symfony');
- }
- /**
- * Returns all project directories where you can put PHP classes.
- */
- protected function getProjectClassDirectories()
- {
- return array_merge(
- $this->getProjectLibDirectories(),
- $this->getProjectActionDirectories()
- );
- }
- /**
- * Returns all project directories where you can put templates.
- */
- protected function getProjectTemplateDirectories()
- {
- return array_merge(
- glob(sfConfig::get('sf_apps_dir').'/*/modules/*/templates'),
- glob(sfConfig::get('sf_apps_dir').'/*/templates')
- );
- }
- /**
- * Returns all project directories where you can put actions and components.
- */
- protected function getProjectActionDirectories()
- {
- return glob(sfConfig::get('sf_apps_dir').'/*/modules/*/actions');
- }
- /**
- * Returns all project lib directories.
- */
- protected function getProjectLibDirectories()
- {
- return array_merge(
- glob(sfConfig::get('sf_apps_dir').'/*/modules/*/lib'),
- glob(sfConfig::get('sf_apps_dir').'/*/lib'),
- array(
- sfConfig::get('sf_apps_dir').'/lib',
- sfConfig::get('sf_lib_dir'),
- )
- );
- }
- /**
- * Returns all project config directories.
- */
- protected function getProjectConfigDirectories()
- {
- return array_merge(
- glob(sfConfig::get('sf_apps_dir').'/*/modules/*/config'),
- glob(sfConfig::get('sf_apps_dir').'/*/config'),
- glob(sfConfig::get('sf_config_dir'))
- );
- }
- /**
- * Returns all application names.
- *
- * @return array An array of application names
- */
- protected function getApplications()
- {
- return sfFinder::type('dir')->maxdepth(0)->relative()->in(sfConfig::get('sf_apps_dir'));
- }
- }