Browse Source

Merge branch 'master' of github.com:picocms/Pico

Daniel Rudolf 9 năm trước cách đây
mục cha
commit
81138ce06a
3 tập tin đã thay đổi với 17 bổ sung1 xóa
  1. 1 0
      CHANGELOG.md
  2. 11 1
      index.php
  3. 5 0
      lib/Pico.php

+ 1 - 0
CHANGELOG.md

@@ -19,6 +19,7 @@ Released: -
           (RFC 3986) in `Page::evaluateRequestUrl()`
           (RFC 3986) in `Page::evaluateRequestUrl()`
 * [Fixed] #272: Encode URLs using `rawurlencode()` in `Pico::getPageUrl()`
 * [Fixed] #272: Encode URLs using `rawurlencode()` in `Pico::getPageUrl()`
 * [Fixed] #274: Prevent double slashes in `base_url`
 * [Fixed] #274: Prevent double slashes in `base_url`
+* [Fixed] #285: Make `index.php` work when installed as a composer dependency
 ```
 ```
 
 
 ### Version 1.0.0-beta.1
 ### Version 1.0.0-beta.1

+ 11 - 1
index.php

@@ -1,6 +1,16 @@
 <?php
 <?php
+
 // load dependencies
 // load dependencies
-require_once(__DIR__ . '/vendor/autoload.php');
+if(is_file($f = __DIR__ . '/vendor/autoload.php')) {
+    // local composer install
+    require_once($f);
+} elseif(is_file($f = __DIR__ . '/../../../vendor/autoload.php')) {
+    // root composer install
+    require_once($f);
+} else {
+    // composer needs install...
+    die('Cannot find composer `/vendor/autoload.php` -- try `composer install`');
+}
 
 
 // instance Pico
 // instance Pico
 $pico = new Pico(
 $pico = new Pico(

+ 5 - 0
lib/Pico.php

@@ -271,6 +271,11 @@ class Pico
      */
      */
     public function run()
     public function run()
     {
     {
+        // check PHP version
+        if (version_compare(PHP_VERSION, '5.3.6', '<')) {
+            die('Sorry, Pico requires PHP 5.3.6 or above to run!');
+        }
+
         // lock Pico
         // lock Pico
         $this->locked = true;
         $this->locked = true;