Development

/branches/1.3/lib/task/project/validation/sfDeprecatedConfigurationFilesValidation.class.php

You must first sign up to be able to contribute.

root/branches/1.3/lib/task/project/validation/sfDeprecatedConfigurationFilesValidation.class.php

Revision 24610, 1.8 kB (checked in by FabianLange, 4 years ago)

[1.3, 1.4] added svn properties for project:validate task

  • 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  * Finds deprecated configuration files usage.
13  *
14  * @package    symfony
15  * @subpackage task
16  * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
17  * @version    SVN: $Id$
18  */
19 class sfDeprecatedConfigurationFilesValidation extends sfValidation
20 {
21   public function getHeader()
22   {
23     return 'Checking usage of deprecated configuration files';
24   }
25
26   public function getExplanation()
27   {
28     return array(
29           '',
30           '  The project uses deprecated configuration files',
31           '  that have been removed in symfony 1.4 (mailer.yml, validate/*.yml)',
32           '  or for which the format changed (generator.yml)',
33           '',
34     );
35   }
36
37   public function validate()
38   {
39     // mailer.yml
40     $files = sfFinder::type('file')->name('mailer.yml')->in($this->getProjectConfigDirectories());
41     $found = array();
42     foreach ($files as $file)
43     {
44       $found[$file] = true;
45     }
46
47     // modules/*/validate/*.yml
48     $files = sfFinder::type('file')->name('*.yml')->in(array_merge(
49       glob(sfConfig::get('sf_apps_dir').'/*/modules/*/validate'),
50       glob(sfConfig::get('sf_plugins_dir').'/*/modules/*/validate')
51     ));
52     foreach ($files as $file)
53     {
54       $found[$file] = true;
55     }
56
57     // old generator.yml
58     $files = sfFinder::type('file')->name('generator.yml')->in(array(
59       sfConfig::get('sf_apps_dir'),
60       sfConfig::get('sf_plugins_dir'),
61     ));
62     foreach ($files as $file)
63     {
64       $content = file_get_contents($file);
65
66       if (false !== strpos($content, 'sfPropelAdminGenerator'))
67       {
68         $found[$file] = true;
69       }
70     }
71
72     return $found;
73   }
74 }
75
Note: See TracBrowser for help on using the browser.