]> git.mxchange.org Git - friendica.git/commitdiff
Issue 120: poormancron plugin uses php cli if available
authorfabrixxm <fabrix.xm@gmail.com>
Thu, 18 Aug 2011 11:06:17 +0000 (13:06 +0200)
committerfabrixxm <fabrix.xm@gmail.com>
Thu, 18 Aug 2011 11:06:17 +0000 (13:06 +0200)
addon/poormancron/poormancron.php

index e09182f992dbb45f65da0ef44cbb29583ceb1ee7..bbe023cd731aa14ed2ce308fd7677e8464508179 100644 (file)
@@ -7,6 +7,21 @@
  */
 
 function poormancron_install() {
+       // 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") {
+               set_config('poormancron','usecli',1);
+               logger("poormancron will use cli php");
+       } else {
+               set_config('poormancron','usecli',0);
+               logger("poormancron will NOT use cli php");
+       }
+       
        register_hook('page_end', 'addon/poormancron/poormancron.php', 'poormancron_hook');
        register_hook('proc_run', 'addon/poormancron/poormancron.php','poormancron_procrun');
        logger("installed poormancron");
@@ -32,6 +47,7 @@ function poormancron_hook(&$a,&$b) {
 }
 
 function poormancron_procrun(&$a, &$arr) {
+       if (get_config('poormancron','usecli')==1) return;
        $argv = $arr['args'];
        $arr['run_cmd'] = false;
        logger("poormancron procrun ".implode(", ",$argv));