-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
separated autoload from cli initialization. refs #28
- Loading branch information
Showing
5 changed files
with
55 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,7 @@ | |
/** | ||
* @package pake | ||
* @author Alexey Zakhlestin <[email protected]> | ||
* @copyright 2009–2012 Alexey Zakhlestin <[email protected]> | ||
* @copyright 2004-2005 Fabien Potencier <[email protected]> | ||
* @copyright 2012 Alexey Zakhlestin <[email protected]> | ||
* @license see the LICENSE file included in the distribution | ||
*/ | ||
|
||
|
@@ -50,44 +49,5 @@ function pake_autoloader($classname) | |
} | ||
spl_autoload_register('pake_autoloader'); | ||
|
||
// register our default exception handler | ||
function pake_exception_default_handler($exception) | ||
{ | ||
pakeException::render($exception); | ||
exit(1); | ||
} | ||
set_exception_handler('pake_exception_default_handler'); | ||
|
||
mb_internal_encoding('utf-8'); | ||
|
||
// fix php behavior if using cgi php | ||
// from http://www.sitepoint.com/article/php-command-line-1/3 | ||
if (false !== strpos(PHP_SAPI, 'cgi')) | ||
{ | ||
// handle output buffering | ||
@ob_end_flush(); | ||
ob_implicit_flush(true); | ||
|
||
// PHP ini settings | ||
set_time_limit(0); | ||
ini_set('track_errors', true); | ||
ini_set('html_errors', false); | ||
ini_set('magic_quotes_runtime', false); | ||
|
||
// define stream constants | ||
define('STDIN', fopen('php://stdin', 'r')); | ||
define('STDOUT', fopen('php://stdout', 'w')); | ||
define('STDERR', fopen('php://stderr', 'w')); | ||
|
||
// change directory | ||
if (isset($_SERVER['PWD'])) | ||
{ | ||
chdir($_SERVER['PWD']); | ||
} | ||
|
||
// close the streams on script termination | ||
register_shutdown_function(create_function('', 'fclose(STDIN); fclose(STDOUT); fclose(STDERR); return true;')); | ||
} | ||
|
||
// enabling pake's helper-functions | ||
require PAKE_DIR.'/pakeFunction.php'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
/** | ||
* @package pake | ||
* @author Alexey Zakhlestin <[email protected]> | ||
* @copyright 2009–2012 Alexey Zakhlestin <[email protected]> | ||
* @copyright 2004-2005 Fabien Potencier <[email protected]> | ||
* @license see the LICENSE file included in the distribution | ||
*/ | ||
|
||
// register our default exception handler | ||
function pake_exception_default_handler($exception) | ||
{ | ||
pakeException::render($exception); | ||
exit(1); | ||
} | ||
set_exception_handler('pake_exception_default_handler'); | ||
|
||
mb_internal_encoding('utf-8'); | ||
|
||
// fix php behavior if using cgi php | ||
// from http://www.sitepoint.com/article/php-command-line-1/3 | ||
if (false !== strpos(PHP_SAPI, 'cgi')) | ||
{ | ||
// handle output buffering | ||
@ob_end_flush(); | ||
ob_implicit_flush(true); | ||
|
||
// PHP ini settings | ||
set_time_limit(0); | ||
ini_set('track_errors', true); | ||
ini_set('html_errors', false); | ||
ini_set('magic_quotes_runtime', false); | ||
|
||
// define stream constants | ||
define('STDIN', fopen('php://stdin', 'r')); | ||
define('STDOUT', fopen('php://stdout', 'w')); | ||
define('STDERR', fopen('php://stderr', 'w')); | ||
|
||
// change directory | ||
if (isset($_SERVER['PWD'])) | ||
{ | ||
chdir($_SERVER['PWD']); | ||
} | ||
|
||
// close the streams on script termination | ||
register_shutdown_function(create_function('', 'fclose(STDIN); fclose(STDOUT); fclose(STDERR); return true;')); | ||
} |