protected function set_trunk_indexes() { $arr = Cnf::get('trunk_indexes'); if (!empty($arr)) { $this->trunk_indexes = $arr; } else { Log::instance()->error("Trunk indexes is empty."); } }
define('LIBROOT', realpath(DOCROOT . '..') . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR); require_once LIBROOT . 'Autoloader.php'; LogLevel::ALERT; if (realpath($_SERVER['SCRIPT_NAME']) === realpath(__FILE__)) { echo 'include ' . realpath($_SERVER['SCRIPT_NAME']) . ' from another file' . PHP_EOL; echo "example: <?php require '{$_SERVER['SCRIPT_NAME']}';" . PHP_EOL; return; } elseif (!file_exists(CONFPATH)) { echo 'create file ' . CONFPATH . ' and set it up' . PHP_EOL; return; } // Set Config object Cnf::init(CONFPATH); // Set Log object // Katzgrau\KLogger (PSR-3) Log::init(DOCROOT . Cnf::get('log_dir'), Cnf::get('log_level')); // Set Timezone $tz = Cnf::get('timezone'); if (!empty($tz)) { date_default_timezone_set(Cnf::get('timezone')); } else { echo 'set the timezone at the config file: ' . CONFPATH . PHP_EOL; return; } $o = getopt('y:m:d:c:t::h::'); $time_today = mktime(0, 0, 0); // execute from cmd if (isset($o['h'])) { // help echo implode(PHP_EOL, ['use:', '<-y YYYY> - Year;', '<-m MM> - Month;', '[-d DD] - Day;', '[-c CC] - Count days;', '[-t] - Today (if isset, other values not used);', '[-h] - This help.']) . PHP_EOL; return;