Files
IYUUAutoReseed/init.php

52 lines
1.4 KiB
PHP
Raw Normal View History

2020-01-14 19:17:09 +08:00
<?php
//----------------------------------
// 公共入口文件
//----------------------------------
// 定义目录
2020-01-17 10:16:41 +08:00
defined('ROOT_PATH') or define("ROOT_PATH", __DIR__);
2020-01-14 19:17:09 +08:00
define('DS', DIRECTORY_SEPARATOR);
2020-01-20 14:08:44 +08:00
defined('APP_PATH') or define('APP_PATH', ROOT_PATH.DS.'app'.DS);
2020-01-17 10:59:48 +08:00
define('TORRENT_PATH', ROOT_PATH.DS.'torrent'.DS);
2020-01-14 19:17:09 +08:00
// 严格开发模式
2020-01-17 10:16:41 +08:00
error_reporting(E_ALL);
2020-01-14 19:17:09 +08:00
#ini_set('display_errors', 1);
// 永不超时
ini_set('max_execution_time', 0);
set_time_limit(0);
2020-01-17 10:59:48 +08:00
2020-01-14 19:17:09 +08:00
// 内存限制,如果外面设置的内存比 /etc/php/php-cli.ini 大,就不要设置了
2020-01-17 10:16:41 +08:00
if (intval(ini_get("memory_limit")) < 1024) {
2020-01-14 19:17:09 +08:00
ini_set('memory_limit', '1024M');
}
2020-01-17 10:16:41 +08:00
if (PHP_SAPI != 'cli') {
2020-01-14 19:17:09 +08:00
exit("You must run the CLI environment\n");
}
// 设置时区
date_default_timezone_set('Asia/Shanghai');
// 系统配置
2020-01-17 10:16:41 +08:00
if (file_exists(ROOT_PATH."/config/config.php")) {
2020-01-14 19:17:09 +08:00
// 配置(全局变量)
2020-01-17 10:16:41 +08:00
$configALL = require_once ROOT_PATH . "/config/config.php";
} else {
2020-01-14 19:17:09 +08:00
// 示例配置
2020-01-17 10:16:41 +08:00
$configALL = require_once ROOT_PATH . '/config/config.sample.php';
2020-01-14 19:17:09 +08:00
}
// 读取支持列表
if (is_file(ROOT_PATH . "/config/sites.json")) {
$sitesJson = file_get_contents(ROOT_PATH . "/config/sites.json");
$configALL['sitesALL'] = json_decode($sitesJson, true);
}
2020-01-14 19:17:09 +08:00
require_once ROOT_PATH . '/vendor/autoload.php';
2020-01-17 10:59:48 +08:00
2020-01-18 20:13:06 +08:00
global $argv;
$start_file = str_replace("\\","/",trim($argv[0]));
if( substr($start_file,-8)==="init.php" ){
require_once __DIR__ . '/iyuu.php';
2020-01-17 10:59:48 +08:00
}