Differences Between: [Versions 39 and 311]
1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 16 17 /** 18 * Form for scheduled tasks admin pages. 19 * 20 * @deprecated since Moodle 3.9 MDL-63580. Please use the \core\task\manager. 21 * @todo final deprecation. To be removed in Moodle 4.1 MDL-63594. 22 * 23 * @package tool_task 24 * @copyright 2018 Toni Barbera <toni@moodle.com> 25 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 26 */ 27 28 namespace tool_task; 29 30 defined('MOODLE_INTERNAL') || die(); 31 32 /** 33 * Running tasks from CLI. 34 * 35 * @copyright 2018 Toni Barbera <toni@moodle.com> 36 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 37 */ 38 class run_from_cli { 39 40 /** 41 * Find the path of PHP CLI binary. 42 * 43 * @return string|false The PHP CLI executable PATH 44 */ 45 protected static function find_php_cli_path() { 46 global $CFG; 47 48 if (!empty($CFG->pathtophp) && is_executable(trim($CFG->pathtophp))) { 49 return $CFG->pathtophp; 50 } 51 52 return false; 53 } 54 55 /** 56 * Returns if Moodle have access to PHP CLI binary or not. 57 * 58 * @return bool 59 */ 60 public static function is_runnable():bool { 61 debugging('run_from_cli class is deprecated. Please use \core\task\manager::run_from_cli() instead.', 62 DEBUG_DEVELOPER); 63 return \core\task\manager::is_runnable(); 64 } 65 66 /** 67 * Executes a cron from web invocation using PHP CLI. 68 * 69 * @param \core\task\task_base $task Task that be executed via CLI. 70 * @return bool 71 * @throws \moodle_exception 72 */ 73 public static function execute(\core\task\task_base $task):bool { 74 debugging('run_from_cli class is deprecated. Please use \core\task\manager::run_from_cli() instead.', 75 DEBUG_DEVELOPER); 76 return \core\task\manager::run_from_cli($task); 77 } 78 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body