Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 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: sfDeprecatedConfigurationFilesValidation.class.php 24610 2009-11-30 22:07:34Z FabianLange $
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
}