Development

/branches/1.3/lib/task/project/upgrade1.3/sfUpgrade.class.php

You must first sign up to be able to contribute.

root/branches/1.3/lib/task/project/upgrade1.3/sfUpgrade.class.php

Revision 23810, 2.9 kB (checked in by Kris.Wallsmith, 4 years ago)

[1.3] set svn:eol-style property to native and svn:keywords property to Id on all .php files

  • 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 $type 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    * @param string $subdirectory A subdirectory within lib (i.e. "/form")
80    */
81   protected function getProjectLibDirectories($subdirectory = null)
82   {
83     return array_merge(
84       glob(sfConfig::get('sf_apps_dir').'/*/modules/*/lib'.$subdirectory),
85       glob(sfConfig::get('sf_apps_dir').'/*/lib'.$subdirectory),
86       array(
87         sfConfig::get('sf_apps_dir').'/lib'.$subdirectory,
88         sfConfig::get('sf_lib_dir').$subdirectory,
89       )
90     );
91   }
92
93   /**
94    * Returns all project config directories.
95    */
96   protected function getProjectConfigDirectories()
97   {
98     return array_merge(
99       glob(sfConfig::get('sf_apps_dir').'/*/modules/*/config'),
100       glob(sfConfig::get('sf_apps_dir').'/*/config'),
101       glob(sfConfig::get('sf_config_dir'))
102     );
103   }
104
105   /**
106    * Returns all application names.
107    *
108    * @return array An array of application names
109    */
110   protected function getApplications()
111   {
112     return sfFinder::type('dir')->maxdepth(0)->relative()->in(sfConfig::get('sf_apps_dir'));
113   }
114 }
115
Note: See TracBrowser for help on using the browser.