-
Notifications
You must be signed in to change notification settings - Fork 8
/
index.php
50 lines (40 loc) · 1.39 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
define("DEVELOPER_MODE", false);
if (DEVELOPER_MODE) {
tideways_xhprof_enable();
}
$timeRequestStart = microtime(true);
//$_SERVER['REQUEST_URI'] = "/User/100369-api.html
ini_set("display_errors", "Off");
ini_set("log_errors", "Off");
$_ENV['WPF_URL_PATH_SUFFIX'] = '/wpf';
// mock
require_once (__DIR__ . "/lib/mock.php");
// adapt to duckchat-gagaphp.
if (!empty($_GET['action'])) {
$action = isset($_GET['action']) ? $_GET['action'] : "";
$action = ucwords($action, '.');
$controllerName = str_replace(".", "_", $action);
$_ENV['WPF_URL_CONTROLLER_NAME'] = $controllerName;
$_ENV['WPF_URL_CONTROLLER_METHOD_PARAM_NAME'] = "doIndex";
}
if(!isset($_ENV['WPF_URL_CONTROLLER_NAME'])) {
$_ENV['WPF_URL_CONTROLLER_NAME'] = "Page_Index";
$_ENV['WPF_URL_CONTROLLER_METHOD_PARAM_NAME'] = isset($_GET['method'] ) ? $_GET['method'] : "doIndex" ;
}
require_once(__DIR__ . "/lib/wpf/init.php");
if (DEVELOPER_MODE) {
$config = require_once (__DIR__ . "/config.developer.php");
$logDir = $config["xhprofDir"];
$timeRequestEnd = microtime(true);
$timeCost = intval(($timeRequestEnd - $timeRequestStart) * 1000);
if ($timeCost > 100) {
$data = tideways_xhprof_disable();
file_put_contents(
"{$logDir}/{$timeCost}ms" . uniqid() . ".file.xhprof",
serialize($data)
);
} else {
tideways_xhprof_disable();
}
}