示例#1
0
 static function getTestPWECore()
 {
     $pwe = new PWECore();
     PWEAutoloader::setPWE($pwe);
     $temp = PWEUnitTests::utGetCleanTMP();
     $pwe->setDataDirectory($temp);
     $pwe->setTempDirectory($temp);
     $pwe->setXMLDirectory($temp);
     PWELogger::debug("Finished creating test PWE Core");
     return $pwe;
 }
示例#2
0
文件: index.php 项目: undera/pwe
    PWEAutoloader::setPWE($PWECore);
    if (!isset($opts['j'])) {
        throw new InvalidArgumentException("-j option with full job class name required");
    }
    $job = new $opts['j']($PWECore);
    if (!$job instanceof PWECMDJob) {
        throw new InvalidArgumentException("Job class must implement PWECMDJob");
    }
    $job->run();
} else {
    require_once __DIR__ . '/PWE/Lib/Smarty/SmartyAssociative.php';
    require_once __DIR__ . '/PWE/Modules/Outputable.php';
    require_once __DIR__ . '/PWE/Core/PWEURL.php';
    require_once __DIR__ . '/PWE/Auth/PWEUserAuthController.php';
    $PWECore = new PWECore();
    PWEAutoloader::setPWE($PWECore);
    $uri = $_SERVER['REDIRECT_URL'] ? $_SERVER['REDIRECT_URL'] : $_SERVER['REQUEST_URI'];
    $started = microtime(true);
    try {
        require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/cfg.php';
        echo $PWECore->process($uri);
        PWELogger::debug('Response headers: %s', headers_list());
    } catch (\Exception $e) {
        try {
            if ($e->getCode() >= 500 || $e->getCode() <= 100) {
                PWELogger::error('Exception occured at page %s: %s', $uri, $e);
            } elseif ($e->getCode() >= 400) {
                PWELogger::info('Exception occured at page %s: %s', $uri, $e);
            }
            $PWECore->sendHTTPHeader("Content-Type: text/html");
            $PWECore->sendHTTPStatusCode($e->getCode());