Example #1
0
 * The `Request` is then used by the `Dispatcher` (in conjunction with the
 * `Router`) to determine the correct command to dispatch to. The response
 * information is then encapsulated in a `Response` object, which is returned
 * from the command to the `Dispatcher`.
 *
 * The `Response` object will contain information about the status code which
 * is used as the exit code when ending the execution of this script and
 * returned to the callee.
 *
 * @see lithium\console\Request
 * @see lithium\console\Response
 * @see lithium\console\Dispatcher
 * @see lithium\console\Router
 */
$run = function () {
    return lithium\console\Dispatcher::run(new lithium\console\Request())->status;
};
/**
 * Look to see if there's a bootstrap file. If there is, this is either a Lithium application or
 * plugin.
 */
if (file_exists("{$working}/config/bootstrap.php")) {
    $app = $working;
} elseif (file_exists("{$working}/app/config/bootstrap.php")) {
    $app = "{$working}/app";
}
/**
 * Attempt to bootstrap the application and execute the request. On failure, use the default
 * bootstrap.
 */
if ($app) {
Example #2
0
    throw new ErrorException($message);
}
lithium\core\Libraries::add('lithium');
if ($app) {
    lithium\core\Libraries::add(basename(LITHIUM_APP_PATH), array('path' => LITHIUM_APP_PATH, 'default' => true, 'bootstrap' => !file_exists("{$app}/webroot/index.php")));
}
/**
 * The following will dispatch the request and exit with the status code as
 * provided by the `Response` object returned from `run()`.
 *
 * The following will instantiate a new `Request` object and pass it off to the
 * `Dispatcher` class.  By default, the `Request` will automatically aggregate
 * all the server / environment settings, and request content (i.e. options and
 * arguments passed to the command) information.
 *
 * The `Request` is then used by the `Dispatcher` (in conjunction with the
 * `Router`) to determine the correct command to dispatch to. The response
 * information is then encapsulated in a `Response` object, which is returned
 * from the command to the `Dispatcher`.
 *
 * The `Response` object will contain information about the status code which
 * is used as the exit code when ending the execution of this script and
 * returned to the callee.
 *
 * @see lithium\console\Request
 * @see lithium\console\Response
 * @see lithium\console\Dispatcher
 * @see lithium\console\Router
 */
exit(lithium\console\Dispatcher::run(new lithium\console\Request())->status);