MDL-68714 cron: Check value of CLI_SCRIPT not existence
authorAndrew Nicols <andrew@nicols.co.uk>
Fri, 3 Jul 2020 01:04:05 +0000 (09:04 +0800)
committerAndrew Nicols <andrew@nicols.co.uk>
Fri, 3 Jul 2020 01:04:05 +0000 (09:04 +0800)
lib/clilib.php
lib/cronlib.php

index 1495aed..1295e54 100644 (file)
@@ -154,7 +154,7 @@ function cli_get_params(array $longoptions, array $shortmapping=null) {
  * @param string $suffix process suffix
  */
 function cli_set_process_title_suffix(string $suffix) {
-    if (defined('CLI_SCRIPT') && isset($_SERVER['argv'])) {
+    if (CLI_SCRIPT && isset($_SERVER['argv'])) {
         $command = join(' ', $_SERVER['argv']);
         @cli_set_process_title("php $command ($suffix)");
     }
index 919043d..74a83d5 100644 (file)
@@ -383,7 +383,7 @@ function cron_run_inner_adhoc_task(\core\task\adhoc_task $task) {
  */
 function cron_set_process_title(string $title) {
     global $CFG;
-    if (defined('CLI_SCRIPT')) {
+    if (CLI_SCRIPT) {
         require_once($CFG->libdir . '/clilib.php');
         $datetime = userdate(time(), '%b %d, %H:%M:%S');
         cli_set_process_title_suffix("$datetime $title");