- Timestamp:
- 09/21/13 23:52:08 (12 years ago)
- Branch:
- default
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/maintenance/inc/class.dc.maintenance.php
r1969 r1984 25 25 class dcMaintenance 26 26 { 27 p rivate$core;27 public $core; 28 28 private $tasks = array(); 29 29 private $tabs = array(); 30 30 private $groups = array(); 31 private $logs = null; 31 32 32 33 /** … … 44 45 $tabs = new ArrayObject(); 45 46 $groups = new ArrayObject(); 47 $logs = $this->getLogs(); 46 48 47 49 # --BEHAVIOR-- dcMaintenanceRegister … … 75 77 } 76 78 77 $this->tasks[$task] = new $task($this ->core, 'plugin.php?p=maintenance');79 $this->tasks[$task] = new $task($this, 'plugin.php?p=maintenance'); 78 80 } 79 81 … … 230 232 231 233 /** 232 * Get expired tasks. 233 * 234 * @return <b>array</b> Array of expired Task ID / date 235 */ 236 public function getExpired() 237 { 238 // Retrieve logs from this task 239 $rs = $this->core->log->getLogs(array( 240 'log_table' => 'maintenance', 241 'blog_id' => 'all' 242 )); 243 244 $logs = array(); 245 while ($rs->fetch()) { 246 // Check if task exists 247 if (($task = $this->getTask($rs->log_msg)) !== null) { 248 // Check if remider is used and tasks expired 249 if ($task->ts() && strtotime($rs->log_dt) + $task->ts() < time()) { 250 $logs[$rs->log_msg] = $rs->log_dt; 251 } 234 * Get logs 235 * 236 * Return array( 237 * task id => array( 238 * timestamp of last execution, 239 * logged on current blog or not 240 * ) 241 * ) 242 * 243 * @return <b>array</b> List of logged tasks 244 */ 245 public function getLogs() 246 { 247 if ($this->logs === null) { 248 $rs = $this->core->log->getLogs(array( 249 'log_table' => 'maintenance', 250 'blog_id' => 'all' 251 )); 252 253 $this->logs = array(); 254 while ($rs->fetch()) { 255 $this->logs[$rs->log_msg] = array( 256 'ts' => strtotime($rs->log_dt), 257 'blog' => $rs->blog_id == $this->core->blog->id 258 ); 252 259 } 253 260 } 254 return $logs; 261 262 return $this->logs; 255 263 } 256 264 }
Note: See TracChangeset
for help on using the changeset viewer.