Development

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

You must first sign up to be able to contribute.

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

Revision 8148, 2.7 kB (checked in by fabien, 7 years ago)

made sfFinder::ignore_version_control the default (you can disable it by calling ignore_version_control(false)) (refs #2795)

  • 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  * Abstract class for upgrade classes.
13  *
14  * @package    symfony
15  * @subpackage task
16  * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
17  * @version    SVN: $Id$
18  */
19 abstract class sfUpgrade extends sfBaseTask
20 {
21   protected
22     $task = null;
23
24   /**
25    * Upgrades the current project from 1.0 to 1.1.
26    */
27   abstract public function upgrade();
28
29   public function execute($arguments = array(), $options = array())
30   {
31     throw new sfException('You can\'t execute this task.');
32   }
33
34   /**
35    * Returns a finder that exclude upgrade scripts from being upgraded!
36    *
37    * @param  string   String directory or file or any (for both file and directory)
38    *
39    * @return sfFinder A sfFinder instance
40    */
41   protected function getFinder($type)
42   {
43     return sfFinder::type($type)->prune('symfony')->discard('symfony');
44   }
45
46   /**
47    * Returns all project directories where you can put PHP classes.
48    */
49   protected function getProjectClassDirectories()
50   {
51     return array_merge(
52       $this->getProjectLibDirectories(),
53       $this->getProjectActionDirectories()
54     );
55   }
56
57   /**
58    * Returns all project directories where you can put templates.
59    */
60   protected function getProjectTemplateDirectories()
61   {
62     return array_merge(
63       glob(sfConfig::get('sf_apps_dir').'/*/modules/*/templates'),
64       glob(sfConfig::get('sf_apps_dir').'/*/templates')
65     );
66   }
67
68   /**
69    * Returns all project directories where you can put actions and components.
70    */
71   protected function getProjectActionDirectories()
72   {
73     return glob(sfConfig::get('sf_apps_dir').'/*/modules/*/actions');
74   }
75
76   /**
77    * Returns all project lib directories.
78    */
79   protected function getProjectLibDirectories()
80   {
81     return array_merge(
82       glob(sfConfig::get('sf_apps_dir').'/*/modules/*/lib'),
83       glob(sfConfig::get('sf_apps_dir').'/*/lib'),
84       array(
85         sfConfig::get('sf_apps_dir').'/lib',
86         sfConfig::get('sf_lib_dir'),
87       )
88     );
89   }
90
91   /**
92    * Returns all project config directories.
93    */
94   protected function getProjectConfigDirectories()
95   {
96     return array_merge(
97       glob(sfConfig::get('sf_apps_dir').'/*/modules/*/config'),
98       glob(sfConfig::get('sf_apps_dir').'/*/config'),
99       glob(sfConfig::get('sf_config_dir'))
100     );
101   }
102
103   /**
104    * Returns all application names.
105    *
106    * @return array An array of application names
107    */
108   protected function getApplications()
109   {
110     return sfFinder::type('dir')->maxdepth(0)->relative()->in(sfConfig::get('sf_apps_dir'));
111   }
112 }
113
Note: See TracBrowser for help on using the browser.