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 f70796a4a045ab48d19e9cc739c621eea811315d..07babecfb89cde1b3125df65f816f40bba1ff72d 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 c076e6c6a62a7e53415be833b349113b0dc364a4..94a6979ad8a0516544bb1df5e1cc6b4f0cf848f4 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 1d59b1c4feb7447628bd0e3f278946b62b090225..d76374212b3c5fb879e32dece99430a1919be4ef 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();
         }