add separate setupcheck file
authorChristian Weiske <cweiske@cweiske.de>
Wed, 30 Apr 2014 17:09:47 +0000 (19:09 +0200)
committerChristian Weiske <cweiske@cweiske.de>
Wed, 30 Apr 2014 17:09:47 +0000 (19:09 +0200)
README.rst
www/.htaccess
www/setup.php [new file with mode: 0644]
www/www-header.php

index f70796a..07babec 100644 (file)
@@ -286,6 +286,8 @@ URLs
   Shows form for new paste
 ``/login``
   Login page for protecting site
+``/setup``
+  Check if everything is setup correctly and all dependencies are installed
 ``/user``
   Edit logged-in user information
 
@@ -331,5 +333,6 @@ If you use nginx, place the following lines into your ``server`` block:
     rewrite ^/search/([0-9]+)$ /search.php?page=$1;
 
     rewrite ^/login$ /login.php;
+    rewrite ^/setup$ /setup.php;
     rewrite ^/user$ /user.php;
   }
index c076e6c..94a6979 100644 (file)
@@ -30,4 +30,5 @@ RewriteRule ^search$ search.php
 RewriteRule ^search/([0-9]+)$ search.php?page=$1
 
 RewriteRule ^login$ login.php
+RewriteRule ^setup$ setup.php
 RewriteRule ^user$ user.php
diff --git a/www/setup.php b/www/setup.php
new file mode 100644 (file)
index 0000000..b042339
--- /dev/null
@@ -0,0 +1,18 @@
+<?php
+/**
+ * Check if all is setup correctly
+ */
+namespace phorkie;
+$reqWritePermissions = false;
+require_once 'www-header.php';
+
+if (!$GLOBALS['phorkie']['cfg']['setupcheck']) {
+    header('HTTP/1.0 403 Forbidden');
+    header('Content-type: text/plain');
+    echo "Setup check is disabled\n";
+    exit(1);
+}
+
+header('Content-type: text/plain');
+echo "All fine\n";
+?>
index 1d59b1c..d763742 100644 (file)
@@ -27,6 +27,7 @@ set_exception_handler(
         if (!isset($GLOBALS['twig'])) {
             echo '<h1>Exception</h1>';
             echo '<p>' . $e->getMessage() . '</p>';
+            echo "\n";
             exit();
         }