Merge pull request #7272 from rycks/5.0_cron

FIX 'Error cronjob->run_job: Permission denied'
This commit is contained in:
Laurent Destailleur 2017-08-22 10:43:29 +02:00 committed by GitHub
commit 5b0e6297bb

View File

@ -55,9 +55,9 @@ $key=$argv[1];
if (! isset($argv[2]) || ! $argv[2]) { if (! isset($argv[2]) || ! $argv[2]) {
usage($path,$script_file); usage($path,$script_file);
exit(-1); exit(-1);
} else { }
$userlogin=$argv[2];
} $userlogin=$argv[2];
// Global variables // Global variables
@ -68,9 +68,11 @@ $error=0;
/* /*
* Main * Main
*/ */
// current date
$now=dol_now();
@set_time_limit(0); @set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n"; print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." ***** userlogin=" . $userlogin . " ***** " . $now . " *****\n";
// Check security key // Check security key
if ($key != $conf->global->CRON_KEY) if ($key != $conf->global->CRON_KEY)
@ -114,7 +116,8 @@ else
exit(-1); exit(-1);
} }
} }
$user->getrights();
if (isset($argv[3]) || $argv[3]) if (isset($argv[3]) || $argv[3])
{ {
$id = $argv[3]; $id = $argv[3];
@ -138,9 +141,6 @@ if ($result<0)
// TODO This sequence of code must be shared with code into cron_run_jobs.php php page. // TODO This sequence of code must be shared with code into cron_run_jobs.php php page.
// current date
$now=dol_now();
if(is_array($object->lines) && (count($object->lines)>0)) if(is_array($object->lines) && (count($object->lines)>0))
{ {
// Loop over job // Loop over job