]> git.wh0rd.org Git - tt-rss.git/commitdiff
Updater: check whether system() is useable.
authorBram Schoenmakers <me@bramschoenmakers.nl>
Wed, 17 Sep 2014 17:05:52 +0000 (19:05 +0200)
committerBram Schoenmakers <me@bramschoenmakers.nl>
Wed, 17 Sep 2014 17:24:30 +0000 (19:24 +0200)
system() was disabled on my system for security reasons, but the
updater would just continue, only to find out that the tarball
hasn't been extracted.

plugins/updater/init.php

index ef48858b274afd0174c75dc9b2aca4d0e420853b..6ee018f74d766ec87285a36b69ee76ed8d9aa029 100644 (file)
@@ -63,6 +63,20 @@ class Updater extends Plugin {
                                putenv("PATH=" . getenv("PATH") . PATH_SEPARATOR . "/bin" .
                                        PATH_SEPARATOR . "/usr/bin");
 
+                                array_push($log, "Checking for system() call...");
+
+                                $disabled = explode(',', ini_get('disable_functions'));
+                                foreach ($disabled as $function) {
+                                        if ( trim($function) == 'system' ) {
+                                                array_push($log, "Can not execute commands with PHP's system() function.");
+                                                $stop = true;
+                                        }
+                                }
+
+                                if ( $stop == true ) {
+                                        break;
+                                }
+
                                array_push($log, "Checking for tar...");
 
                                $system_rc = 0;