$cli->run();
}
+ private function requestedFileExists()
+ {
+ $parts = explode('?', $_SERVER['REQUEST_URI'], 2);
+ $path = $_SERVER['DOCUMENT_ROOT'] . urldecode($parts[0]);
+ return is_file($path);
+ }
+
public function run() {
+ $sapiName = php_sapi_name();
+
+ if ($sapiName === 'cli-server' && $this->requestedFileExists())
+ return false;
+
if (IPF::get('debug')) {
$this->sqlProfiler = new IPF_ORM_Connection_Profiler();
IPF_ORM_Manager::getInstance()->dbListeners[] = $this->sqlProfiler;
IPF_ORM_Manager::getInstance()->openConnection(IPF::get('database', IPF::get('dsn')));
- if (php_sapi_name() == 'cli'){
+ if ($sapiName === 'cli') {
$this->cli();
- return true;
- }
- if (php_sapi_name() == 'cli-server') {
- $parts = explode('?', $_SERVER['REQUEST_URI'], 2);
- $path = $_SERVER['DOCUMENT_ROOT'] . $parts[0];
- if (is_file($path))
- return false;
+ } else {
+ $this->loadModels();
+ $this->router = new IPF_Router();
+ $this->router->dispatch(IPF_HTTP_URL::getAction());
}
- $this->loadModels();
- $this->router = new IPF_Router();
- $this->router->dispatch(IPF_HTTP_URL::getAction());
+
return true;
}
}