]> git.wh0rd.org - tt-rss.git/blobdiff - plugins/updater/init.php
Updater: check whether system() is useable.
[tt-rss.git] / plugins / updater / init.php
index fa283c8be0260454cbe12903c540b7dd2cb1a4e7..6ee018f74d766ec87285a36b69ee76ed8d9aa029 100644 (file)
@@ -24,6 +24,8 @@ class Updater extends Plugin {
                // __FILE__ is in plugins/updater so we need to go one level up
                $work_dir = dirname(dirname(dirname(__FILE__)));
                $parent_dir = dirname($work_dir);
+               // Set PATH to run "which"
+               putenv('PATH="$PATH:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"');
 
                $log = array();
                if (!is_array($params)) $params = array();
@@ -61,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;
@@ -234,6 +250,7 @@ class Updater extends Plugin {
                                        CACHE_DIR . "/images",
                                        CACHE_DIR . "/js",
                                        CACHE_DIR . "/simplepie",
+                                       CACHE_DIR . "/upload",
                                        ICONS_DIR,
                                        LOCK_DIRECTORY);
 
@@ -339,6 +356,10 @@ class Updater extends Plugin {
 
                        } else {
                                print_notice(__("Your Tiny Tiny RSS installation is up to date."));
+
+                               print "<br/> <button dojoType=\"dijit.form.Button\" onclick=\"return updateSelf()\">".
+                                       __('Force update')."</button></p>";
+
                        }
 
                        print "</div>"; #pane