zf.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Tool
  17. * @subpackage Framework
  18. * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id$
  21. */
  22. $_zf['original'] = get_include_path();
  23. // if ZF is not in the include_path, but relative to this file, put it in the include_path
  24. if (($_zf['prepend'] = getenv('ZEND_TOOL_INCLUDE_PATH_PREPEND')) || ($_zf['whole'] = getenv('ZEND_TOOL_INCLUDE_PATH'))) {
  25. if (isset($_zf['prepend']) && ($_zf['prepend'] !== false) && (($_zf['prependRealpath'] = realpath($_zf['prepend'])) !== false)) {
  26. set_include_path($_zf['prependRealpath'] . PATH_SEPARATOR . $_zf['original']);
  27. } elseif (isset($_zf['whole']) && ($_zf['whole'] !== false) && (($_zf['wholeRealpath'] = realpath($_zf['whole'])) !== false)) {
  28. set_include_path($_zf['wholeRealpath']);
  29. }
  30. }
  31. // assume the include_path is good, and load the client/console
  32. if ((@include_once 'Zend/Tool/Framework/Client/Console.php') === false) {
  33. // last chance, perhaps we can find zf relative to THIS file, if so, lets run
  34. $_zf['relativePath'] = dirname(__FILE__) . '/../library/';
  35. if (file_exists($_zf['relativePath'] . 'Zend/Tool/Framework/Client/Console.php')) {
  36. set_include_path(realpath($_zf['relativePath']) . PATH_SEPARATOR . get_include_path());
  37. include_once 'Zend/Tool/Framework/Client/Console.php';
  38. }
  39. }
  40. if (!class_exists('Zend_Tool_Framework_Client_Console')) {
  41. echo <<<EOS
  42. ***************************** ZF ERROR ********************************
  43. In order to run the zf command, you need to ensure that Zend Framework
  44. is inside your include_path. If you are running this tool without
  45. ZendFramework in your include_path, you can alternatively set one of
  46. two environment variables to for this tool to work:
  47. a) ZEND_TOOL_INCLUDE_PATH_PREPEND="/path/to/ZendFramework/library"
  48. OR alternatively
  49. b) ZEND_TOOL_INCLUDE_PATH="/path/to/ZendFramework/library"
  50. The former (a) will make the specified Zend Framework first in the
  51. include_path whereas the latter (b) will replace the include_path
  52. with the specified path.
  53. Information:
  54. EOS;
  55. echo ' original include_path: ' . $_zf['original'] . PHP_EOL;
  56. echo ' attempted include_path: ' . get_include_path() . PHP_EOL;
  57. echo ' script location: ' . $_SERVER['SCRIPT_NAME'] . PHP_EOL;
  58. exit(1);
  59. }
  60. // cleanup the global space
  61. unset($_zf);
  62. // run tool
  63. Zend_Tool_Framework_Client_Console::main();
  64. exit(0);