cake.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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 (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
  10. *
  11. * Licensed under The MIT License
  12. * For full copyright and license information, please see the LICENSE.txt
  13. * Redistributions of files must retain the above copyright notice.
  14. *
  15. * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
  16. * @link http://cakephp.org CakePHP(tm) Project
  17. * @package Cake.Console
  18. * @since CakePHP(tm) v 1.2.0.5012
  19. * @license http://www.opensource.org/licenses/mit-license.php MIT License
  20. */
  21. $ds = DIRECTORY_SEPARATOR;
  22. $dispatcher = 'Cake' . $ds . 'Console' . $ds . 'ShellDispatcher.php';
  23. $found = false;
  24. $paths = explode(PATH_SEPARATOR, ini_get('include_path'));
  25. foreach ($paths as $path) {
  26. if (file_exists($path . $ds . $dispatcher)) {
  27. $found = $path;
  28. break;
  29. }
  30. }
  31. if (!$found) {
  32. $rootInstall = dirname(dirname(dirname(__FILE__))) . $ds . $dispatcher;
  33. $composerInstall = dirname(dirname(__FILE__)) . $ds . $dispatcher;
  34. if (file_exists($composerInstall)) {
  35. include $composerInstall;
  36. } elseif (file_exists($rootInstall)) {
  37. include $rootInstall;
  38. } else {
  39. trigger_error('Could not locate CakePHP core files.', E_USER_ERROR);
  40. }
  41. } else {
  42. include $found . $ds . $dispatcher;
  43. }
  44. unset($paths, $path, $found, $dispatcher, $root, $ds);
  45. return ShellDispatcher::run($argv);