]> git.andy128k.dev Git - ipf.git/commitdiff
move cli-server routing to index.php
authorAndrey Kutejko <andy128k@gmail.com>
Wed, 7 Jan 2015 18:35:28 +0000 (20:35 +0200)
committerAndrey Kutejko <andy128k@gmail.com>
Wed, 7 Jan 2015 18:35:28 +0000 (20:35 +0200)
index.php
ipf.php
ipf/project.php

index a7cab526420aa6fb394124a983a35d093cda185a..489748a41f81d774fa7a8c26ffbecb44bf4dd92a 100644 (file)
--- a/index.php
+++ b/index.php
@@ -2,9 +2,13 @@
 
 // This is a index stub for a IPF Projects
 
+if (php_sapi_name() === 'cli-server' && is_file($_SERVER['DOCUMENT_ROOT'] . urldecode(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH))))
+    return false;
+
 $here = dirname(__FILE__);
 $project_path = $here . '/../project';
 $vendor_path = $here . '/../vendor';
 require_once $vendor_path.'/autoload.php';
-return IPF::setUp($project_path, $here) && IPF_Project::getInstance()->run();
+IPF::setUp($project_path, $here);
+IPF_Project::getInstance()->run();
 
diff --git a/ipf.php b/ipf.php
index 5c2d31586bcff1849b6b9f10bb2e560a46efa593..4f7153b736655a76f95c0335fe09d3197f6abfc0 100644 (file)
--- a/ipf.php
+++ b/ipf.php
@@ -31,18 +31,8 @@ final class IPF
             die('Specify site url routes');
     }
 
-    private static function requestedFileExists()
-    {
-        $parts = explode('?', $_SERVER['REQUEST_URI'], 2);
-        $path = $_SERVER['DOCUMENT_ROOT'] . urldecode($parts[0]);
-        return is_file($path);
-    }
-
     public static function setUp($project_path, $document_root)
     {
-        if (php_sapi_name() === 'cli-server' && IPF::requestedFileExists())
-            return false;
-
         $project_root = dirname($project_path);
 
         self::$settings = IPF_Settings::create()
@@ -69,8 +59,6 @@ final class IPF
         self::checkSettings(self::$settings);
 
         date_default_timezone_set(self::$settings->get('time_zone'));
-
-        return true;
     }
 
     private function __construct() {}
index ab3a4df73d2dcf506c3dfea6978d8842df36461a..b3ac3a9e303153c73920244b7b97e71b3894c491 100644 (file)
@@ -73,8 +73,6 @@ final class IPF_Project
 
             $this->request = null;
         }
-
-        return true;
     }
 }