]> git.mxchange.org Git - friendica-addons.git/commitdiff
add procrunner - 1/2 of poormancron
authorfriendica <info@friendica.com>
Sun, 6 Jan 2013 05:50:11 +0000 (21:50 -0800)
committerfriendica <info@friendica.com>
Sun, 6 Jan 2013 05:50:11 +0000 (21:50 -0800)
extcron.tgz
extcron/extcron.php
fbpost.tgz
procrunner.tgz [new file with mode: 0644]
procrunner/procrunner.php [new file with mode: 0755]

index 0e5b28929a2942f5105b87922f563f5184f6fdeb..dabe1d09db19ebba110adfad1ae1ed77caf438bc 100755 (executable)
Binary files a/extcron.tgz and b/extcron.tgz differ
index e3c21209b3c33e28d8e34caef0181d98efd183f5..3eb34cdcb2dcd2e072d5c75dd5794a8d467c6dbc 100755 (executable)
@@ -5,7 +5,7 @@
  * Name: external cron
  * Description: Use external server or service to run poller regularly
  * Version: 1.0
- * Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
+ * Author: Mike Macgirvin <https://macgirvin.com/profile/mike>
  * 
  * Notes: External service needs to make a web request to http(s)://yoursite/extcron
  */
index ecf933d8e023c0c5ddabf96e975d3e7364682796..cb8f860ab134c0a5130f3da33e0b2ff67363ab22 100644 (file)
Binary files a/fbpost.tgz and b/fbpost.tgz differ
diff --git a/procrunner.tgz b/procrunner.tgz
new file mode 100644 (file)
index 0000000..fec9dfa
Binary files /dev/null and b/procrunner.tgz differ
diff --git a/procrunner/procrunner.php b/procrunner/procrunner.php
new file mode 100755 (executable)
index 0000000..4c6f64b
--- /dev/null
@@ -0,0 +1,53 @@
+<?php
+/**
+ * Name: Proc Runner
+ * Description: Derivative of poormancron when proc_open() and exec() are disabled
+ * Version: 1.0
+ * Author: Fabio Comuni <http://kirgroup.com/profile/fabrix>
+ * Author: Mike Macgirvin
+ */
+
+function procrunner_install() {
+
+       $addons = get_config('system','addon');
+       if(strstr('poormancron',$addons)) {
+               logger('procrunner incompatible with poormancron. Not installing procrunner.');
+               return;
+       }
+
+       // check for command line php
+       $a = get_app();
+       $ex = Array();
+       $ex[0] = ((x($a->config,'php_path')) && (strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
+       $ex[1] = dirname(dirname(dirname(__file__)))."/testargs.php";
+       $ex[2] = "test";
+       $out = exec(implode(" ", $ex));
+       if ($out==="test") {
+               logger('procrunner not required on this system. Not installing.');
+               return;
+       } else {
+               register_hook('proc_run', 'addon/procrunner/procrunner.php','procrunner_procrun');
+               logger("installed procrunner");
+       }
+       
+}
+
+function procrunner_uninstall() {
+       unregister_hook('proc_run', 'addon/procrunner/procrunner.php','procrunner_procrun');
+       logger("removed procrunner");
+}
+
+
+
+function procrunner_procrun(&$a, &$arr) {
+
+       $argv = $arr['args'];
+       $arr['run_cmd'] = false;
+       logger("procrunner procrun ".implode(", ",$argv));
+       array_shift($argv);
+       $argc = count($argv);
+       logger("procrunner procrun require_once ".basename($argv[0]));
+       require_once(basename($argv[0]));
+       $funcname=str_replace(".php", "", basename($argv[0]))."_run";  
+       $funcname($argv, $argc);
+}