PageRenderTime 46ms CodeModel.GetById 23ms RepoModel.GetById 1ms app.codeStats 0ms

/Group-I/jobeet/lib/vendor/symfony/lib/task/project/validation/sfDeprecatedConfigurationFilesValidation.class.php

https://bitbucket.org/hosseinzolfi/db-lab-spring-2011/
PHP | 74 lines | 48 code | 8 blank | 18 comment | 1 complexity | a98910bdb1148676da13dcc35bc9d454 MD5 | raw file
Possible License(s): ISC, AGPL-3.0, LGPL-2.1, BSD-3-Clause, LGPL-3.0
  1. <?php
  2. /*
  3. * This file is part of the symfony package.
  4. * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
  5. *
  6. * For the full copyright and license information, please view the LICENSE
  7. * file that was distributed with this source code.
  8. */
  9. /**
  10. * Finds deprecated configuration files usage.
  11. *
  12. * @package symfony
  13. * @subpackage task
  14. * @author Fabien Potencier <fabien.potencier@symfony-project.com>
  15. * @version SVN: $Id: sfDeprecatedConfigurationFilesValidation.class.php 24610 2009-11-30 22:07:34Z FabianLange $
  16. */
  17. class sfDeprecatedConfigurationFilesValidation extends sfValidation
  18. {
  19. public function getHeader()
  20. {
  21. return 'Checking usage of deprecated configuration files';
  22. }
  23. public function getExplanation()
  24. {
  25. return array(
  26. '',
  27. ' The project uses deprecated configuration files',
  28. ' that have been removed in symfony 1.4 (mailer.yml, validate/*.yml)',
  29. ' or for which the format changed (generator.yml)',
  30. '',
  31. );
  32. }
  33. public function validate()
  34. {
  35. // mailer.yml
  36. $files = sfFinder::type('file')->name('mailer.yml')->in($this->getProjectConfigDirectories());
  37. $found = array();
  38. foreach ($files as $file)
  39. {
  40. $found[$file] = true;
  41. }
  42. // modules/*/validate/*.yml
  43. $files = sfFinder::type('file')->name('*.yml')->in(array_merge(
  44. glob(sfConfig::get('sf_apps_dir').'/*/modules/*/validate'),
  45. glob(sfConfig::get('sf_plugins_dir').'/*/modules/*/validate')
  46. ));
  47. foreach ($files as $file)
  48. {
  49. $found[$file] = true;
  50. }
  51. // old generator.yml
  52. $files = sfFinder::type('file')->name('generator.yml')->in(array(
  53. sfConfig::get('sf_apps_dir'),
  54. sfConfig::get('sf_plugins_dir'),
  55. ));
  56. foreach ($files as $file)
  57. {
  58. $content = file_get_contents($file);
  59. if (false !== strpos($content, 'sfPropelAdminGenerator'))
  60. {
  61. $found[$file] = true;
  62. }
  63. }
  64. return $found;
  65. }
  66. }