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 plugins usage.
13
 *
14
 * @package    symfony
15
 * @subpackage task
16
 * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
17
 * @version    SVN: $Id: sfDeprecatedPluginsValidation.class.php 25410 2009-12-15 15:19:07Z fabien $
18
 */
19
class sfDeprecatedPluginsValidation extends sfValidation
20
{
21
  public function getHeader()
22
  {
23
    return 'Checking usage of deprecated plugins';
24
  }
25
 
26
  public function getExplanation()
27
  {
28
    return array(
29
          '',
30
          '  The files above use deprecated plugins',
31
          '  that have been removed in symfony 1.4.',
32
          '',
33
          'You can probably remove those references safely.',
34
          '',
35
    );
36
  }
37
 
38
  public function validate()
39
  {
40
    $found = array();
41
    $files = sfFinder::type('file')->name('*Configuration.class.php')->in($this->getProjectConfigDirectories());
42
    foreach ($files as $file)
43
    {
44
      $content = sfToolkit::stripComments(file_get_contents($file));
45
 
46
      $matches = array();
47
      if (false !== strpos($content, 'sfCompat10Plugin'))
48
      {
49
        $matches[] = 'sfCompat10Plugin';
50
      }
51
      if (false !== strpos($content, 'sfProtoculousPlugin'))
52
      {
53
        $matches[] = 'sfProtoculousPlugin';
54
      }
55
 
56
      if ($matches)
57
      {
58
        $found[$file] = implode(', ', $matches);
59
      }
60
    }
61
 
62
    return $found;
63
  }
64
}