cake.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/usr/bin/php -q
  2. <?php
  3. /**
  4. * Command-line code generation utility to automate programmer chores.
  5. *
  6. * PHP 5
  7. *
  8. * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
  9. * Copyright 2005-2011, Cake Software Foundation, Inc.
  10. *
  11. * Licensed under The MIT License
  12. * Redistributions of files must retain the above copyright notice.
  13. *
  14. * @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
  15. * @link http://cakephp.org CakePHP(tm) Project
  16. * @package app.Console
  17. * @since CakePHP(tm) v 2.0
  18. * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
  19. */
  20. $ds = DIRECTORY_SEPARATOR;
  21. $dispatcher = 'Cake' . $ds . 'Console' . $ds . 'ShellDispatcher.php';
  22. $found = false;
  23. $paths = explode(PATH_SEPARATOR, ini_get('include_path'));
  24. foreach ($paths as $path) {
  25. if (file_exists($path . $ds . $dispatcher)) {
  26. $found = $path;
  27. }
  28. }
  29. if (!$found && function_exists('ini_set')) {
  30. $root = dirname(dirname(dirname(__FILE__)));
  31. ini_set('include_path', $root . $ds. 'lib' . PATH_SEPARATOR . ini_get('include_path'));
  32. }
  33. if (!include($dispatcher)) {
  34. trigger_error('Could not locate CakePHP core files.', E_USER_ERROR);
  35. }
  36. unset($paths, $path, $found, $dispatcher, $root, $ds);
  37. return ShellDispatcher::run($argv);