diff options
author | Florian Pritz <bluewind@xinu.at> | 2016-09-05 18:13:49 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2016-09-19 21:41:31 +0200 |
commit | 8ef115e8c38f0cef52a72749a918ebb4def389d0 (patch) | |
tree | 9baa2c37cc566c82d934f1f6d5d7c35d8bbaff3f /check_deps.php | |
parent | 2c28398827ed9be86e3a803a27bd54e366569ac9 (diff) |
Rename install.php to check_deps.php
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'check_deps.php')
-rw-r--r-- | check_deps.php | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/check_deps.php b/check_deps.php new file mode 100644 index 000000000..f8d2da2db --- /dev/null +++ b/check_deps.php @@ -0,0 +1,85 @@ +<?php + +if (version_compare(PHP_VERSION, '5.5.0') < 0) { + echo "Filebin will most certainly not work with php older than 5.5. Use at your own risk!\n\n"; +} + +$errors = ""; + +define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME)); +define('FCPATH', str_replace(SELF, "", __FILE__)); +if (getenv("HOME") == "") { + putenv('HOME='.FCPATH); +} + +$old_path = getenv("PATH"); +putenv("PATH=$old_path:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin"); + +// 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 pygmentize +ob_start(); +passthru("pygmentize -V 2>&1", $buf); +ob_end_clean(); +if ($buf != "0") { + $errors .= " - Error when testing pygmentize: Return code was \"$buf\".\n"; +} + +// test ansi2html +ob_start(); +passthru("ansi2html -h 2>&1", $buf); +ob_end_clean(); +if ($buf != "0") { + $errors .= " - Error when testing ansi2html: Return code was \"$buf\".\n"; +} + +// test imagemagick +ob_start(); +passthru("convert --version 2>&1", $buf); +ob_end_clean(); +if ($buf != "0") { + $errors .= " - Error when testing imagemagick (convert): Return code was \"$buf\".\n"; +} + +// test composer +ob_start(); +passthru("composer --version 2>&1", $buf); +ob_end_clean(); +if ($buf != "0") { + $errors .= " - Error when testing composer: Return code was \"$buf\".\n"; +} + +// test PHP modules +$mod_groups = array( + "thumbnail generation - GD" => array("gd"), + "thumbnail generation - EXIF" => array("exif"), + "database support" => array("mysql", "mysqli", "pgsql", "pdo_mysql", "pdo_pgsql"), + "multipaste tarball support" => array("phar"), +); +foreach ($mod_groups as $function => $mods) { + $found = 0; + foreach ($mods as $module) { + if (extension_loaded($module)) { + $found++; + } + } + if ($found == 0) { + $errors .= " - none of the modules needed for $function are loaded. Make sure to load at least one of these: ".implode(", ", $mods)."\n"; + } +} + + +if ($errors != "") { + echo "Errors occured:\n"; + echo $errors; +} else { + echo "Dependency checks completed sucessfully.\n"; +} |