summaryrefslogtreecommitdiffstats
path: root/install.php
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2011-11-18 12:43:11 +0100
committerFlorian Pritz <bluewind@xinu.at>2011-11-18 12:43:11 +0100
commitd74ce6f0a8a9cb5a209bfa2f8be3e3196d1dd29c (patch)
tree3c23ddd8be3cae1a7cbcbf1c986515d1fbf6bc03 /install.php
parentb02ffd6c11ee212ccdd5f2e17a5f69a620f2a5af (diff)
add install.php
For now this only checks if some dependencies are install. Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'install.php')
-rw-r--r--install.php59
1 files changed, 59 insertions, 0 deletions
diff --git a/install.php b/install.php
new file mode 100644
index 000000000..2ebf2dc27
--- /dev/null
+++ b/install.php
@@ -0,0 +1,59 @@
+<?php
+
+if (version_compare(PHP_VERSION, '5.3.0') < 0) {
+ echo "Just a heads up: Filebin has not been tested with php older than 5.3. You might run into problems.";
+}
+
+$errors = "";
+
+define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
+define('FCPATH', str_replace(SELF, "", __FILE__));
+
+// test exec()
+exec("echo -n works") == "works" || $errors .= "exec() failed\n";
+
+// test passthru()
+ob_start();
+passthru("echo -n works");
+$buf = ob_get_contents();
+ob_end_clean();
+$buf == "works" || $errors .= "passthru() failed\n";
+
+// test perl HTML::FromANSI
+ob_start();
+passthru("/usr/bin/perl ".FCPATH."/scripts/install_helper.pl");
+$buf = ob_get_contents();
+ob_end_clean();
+if ($buf != "works") {
+ $errors .= " - Error when running perl tests.\n";
+ $errors .= nl2br($buf);
+}
+
+// test memcache
+if (!class_exists("Memcache")) {
+ $errors .= " - Missing \"Memcache\" php class. Please install your distribution's package of http://pecl.php.net/package/memcache\n";
+}
+
+// test qrencode
+$expected = base64_decode("iVBORw0KGgoAAAANSUhEUgAAAB0AAAAdAQAAAAB+6FqiAAAAbklEQVQImWP4DwQMaMQHWYd6hu/34+sZvoReBBLxgUAiCkh8v3G/nuGDKFD2/1eguo+ssv8ZftWsq2f4e6+jnuGrkhqQe60LKPvxNkhdEVDH5Xv/Gb4EBwENiFkHZAX1AsWuKAHtEOqpR7cXRAAANwpWESFdK+4AAAAASUVORK5CYII=");
+ob_start();
+passthru("/usr/bin/qrencode -s 1 -o - \"test\"");
+$buf = ob_get_contents();
+ob_end_clean();
+if ($buf != $expected) {
+ $errors .= " - Error when testing qrencode: Didn't get expected output when encoding string \"test\".\n";
+}
+
+
+if ($errors != "") {
+ echo nl2br("\n\n");
+ echo nl2br("Errors occured:\n");
+ echo nl2br($errors);
+} else {
+// TODO: Make this an actual installer
+ echo nl2br("Tests completed.\n"
+ ."The following steps remain:\n"
+ ." - copy the files from ./application/config/example/ to ./application/config/ and edit them to suit your setup\n"
+ ." - import ./db.sql into your database\n"
+ );
+}