1. sfDeprecatedSettingsValidation.class.php
  2. /** * Finds deprecated settings usage. * * @package symfony * @subpackage task * @author Fabien Potencier * @version SVN: $Id: sfDeprecatedSettingsValidation.class.php 25410 2009-12-15 15:19:07Z fabien $ */
  3. class sfDeprecatedSettingsValidation extends sfValidation
  4. {
  5. public function getHeader()
  6. {
  7. return 'Checking usage of deprecated settings';
  8. }
  9. public function getExplanation()
  10. {
  11. return array(
  12. '',
  13. ' The files above use deprecated settings',
  14. ' that have been removed in symfony 1.4.',
  15. '',
  16. ' You can find a list of all deprecated settings under the',
  17. ' "Settings" section of the DEPRECATED tutorial:',
  18. '',
  19. ' http://www.symfony-project.org/tutorial/1_4/en/deprecated',
  20. '',
  21. );
  22. }
  23. public function validate()
  24. {
  25. $settings = array(
  26. 'sf_check_symfony_version', 'sf_max_forwards', 'sf_lazy_cache_key', 'sf_strip_comments',
  27. 'sf_lazy_routes_deserialize', 'sf_calendar_web_dir', 'sf_rich_text_js_dir', 'sf_validation_error_prefix',
  28. 'sf_validation_error_suffix', 'sf_validation_error_class', 'sf_validation_error_id_prefix',
  29. '_is_internal', 'sf_doc_dir',
  30. );
  31. $found = array();
  32. $files = sfFinder::type('file')->name('*.php')->prune('vendor')->in(array(
  33. sfConfig::get('sf_apps_dir'),
  34. sfConfig::get('sf_lib_dir'),
  35. sfConfig::get('sf_test_dir'),
  36. sfConfig::get('sf_plugins_dir'),
  37. ));
  38. foreach ($files as $file)
  39. {
  40. $content = sfToolkit::stripComments(file_get_contents($file));
  41. $matches = array();
  42. foreach ($settings as $setting)
  43. {
  44. if (false !== stripos($content, $setting))
  45. {
  46. $matches[] = $setting;
  47. }
  48. }
  49. if ($matches)
  50. {
  51. $found[$file] = implode(', ', $matches);
  52. }
  53. }
  54. return $found;
  55. }
  56. }

Debug toolbar