[ Index ] |
PHP Cross Reference of phpBB-3.2.11-deutsch |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * 4 * This file is part of the phpBB Forum Software package. 5 * 6 * @copyright (c) phpBB Limited <https://www.phpbb.com> 7 * @license GNU General Public License, version 2 (GPL-2.0) 8 * 9 * For full copyright and license information, please see 10 * the docs/CREDITS.txt file. 11 * 12 */ 13 14 namespace phpbb\cron\task\core; 15 16 /** 17 * Tidy warnings cron task. 18 * 19 * Will only run when warnings are configured to expire. 20 */ 21 class tidy_warnings extends \phpbb\cron\task\base 22 { 23 protected $phpbb_root_path; 24 protected $php_ext; 25 protected $config; 26 27 /** 28 * Constructor. 29 * 30 * @param string $phpbb_root_path The root path 31 * @param string $php_ext PHP file extension 32 * @param \phpbb\config\config $config The config 33 */ 34 public function __construct($phpbb_root_path, $php_ext, \phpbb\config\config $config) 35 { 36 $this->phpbb_root_path = $phpbb_root_path; 37 $this->php_ext = $php_ext; 38 $this->config = $config; 39 } 40 41 /** 42 * Runs this cron task. 43 * 44 * @return null 45 */ 46 public function run() 47 { 48 if (!function_exists('tidy_warnings')) 49 { 50 include($this->phpbb_root_path . 'includes/functions_admin.' . $this->php_ext); 51 } 52 tidy_warnings(); 53 } 54 55 /** 56 * Returns whether this cron task can run, given current board configuration. 57 * 58 * If warnings are set to never expire, this cron task will not run. 59 * 60 * @return bool 61 */ 62 public function is_runnable() 63 { 64 return (bool) $this->config['warnings_expire_days']; 65 } 66 67 /** 68 * Returns whether this cron task should run now, because enough time 69 * has passed since it was last run. 70 * 71 * The interval between warnings tidying is specified in board 72 * configuration. 73 * 74 * @return bool 75 */ 76 public function should_run() 77 { 78 return $this->config['warnings_last_gc'] < time() - $this->config['warnings_gc']; 79 } 80 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Nov 11 20:33:01 2020 | Cross-referenced by PHPXref 0.7.1 |