2017-07-15 20:44:06 +00:00
|
|
|
<?php
|
2017-11-17 01:23:18 +00:00
|
|
|
/** @license MIT
|
|
|
|
* Copyright 2017 J. King, Dustin Wilson et al.
|
|
|
|
* See LICENSE and AUTHORS files for details */
|
|
|
|
|
2020-03-01 20:16:50 +00:00
|
|
|
declare(strict_types=1);
|
2021-04-14 15:17:01 +00:00
|
|
|
|
2017-07-15 20:44:06 +00:00
|
|
|
namespace JKingWeb\Arsse;
|
2017-08-29 14:50:31 +00:00
|
|
|
|
2017-10-01 13:33:49 +00:00
|
|
|
const BASE = __DIR__.DIRECTORY_SEPARATOR;
|
|
|
|
const NS_BASE = __NAMESPACE__."\\";
|
|
|
|
|
|
|
|
require_once BASE."vendor".DIRECTORY_SEPARATOR."autoload.php";
|
|
|
|
ignore_user_abort(true);
|
2018-01-25 04:42:00 +00:00
|
|
|
ini_set("memory_limit", "-1");
|
|
|
|
ini_set("max_execution_time", "0");
|
2023-01-27 20:33:34 +00:00
|
|
|
// NOTE: While running in the wild we don't want to spew deprecation warnings if users are ahead of us in PHP versions
|
2021-03-02 16:54:28 +00:00
|
|
|
error_reporting(\E_ALL & ~\E_DEPRECATED);
|
2017-10-01 13:33:49 +00:00
|
|
|
|
2019-01-11 15:38:06 +00:00
|
|
|
if (\PHP_SAPI === "cli") {
|
2021-02-11 03:30:16 +00:00
|
|
|
// initialize the CLI; this automatically handles --help and --version else
|
2021-02-11 03:12:00 +00:00
|
|
|
Arsse::$obj = new Factory;
|
2017-07-21 21:15:43 +00:00
|
|
|
$cli = new CLI;
|
2017-08-20 03:56:32 +00:00
|
|
|
// handle other CLI requests; some do not require configuration
|
2018-11-05 14:08:50 +00:00
|
|
|
$exitStatus = $cli->dispatch();
|
|
|
|
exit($exitStatus);
|
2017-07-15 20:44:06 +00:00
|
|
|
} else {
|
2017-07-21 21:15:43 +00:00
|
|
|
// load configuration
|
2021-07-05 02:04:05 +00:00
|
|
|
Arsse::bootstrap();
|
2017-07-21 21:15:43 +00:00
|
|
|
// handle Web requests
|
2020-01-20 15:40:05 +00:00
|
|
|
$emitter = new \Laminas\HttpHandlerRunner\Emitter\SapiEmitter;
|
2018-01-06 17:02:45 +00:00
|
|
|
$response = (new REST)->dispatch();
|
|
|
|
$emitter->emit($response);
|
2017-08-29 14:50:31 +00:00
|
|
|
}
|