Legend:
- Unmodified
- Added
- Removed
-
plugins/maintenance/inc/class.dc.maintenance.task.php
r1969 r1984 21 21 class dcMaintenanceTask 22 22 { 23 protected $maintenance; 23 24 protected $core; 24 25 protected $p_url; 25 26 protected $code; 26 protected $ts = 604800; // one week 27 protected $ts = 0; 28 protected $expired = 0; 27 29 protected $ajax = false; 30 protected $blog = false; 28 31 29 32 protected $id; … … 43 46 * use method init() to do it. 44 47 * 45 * @param core <b>dcCore</b> dcCore instance48 * @param maintenance <b>dcMaintenance</b> dcMaintenance instance 46 49 * @param p_url <b>string</b> Maintenance plugin url 47 50 */ 48 public function __construct($core, $p_url) 49 { 50 $this->core =& $core; 51 public function __construct($maintenance, $p_url) 52 { 53 $this->maintenance = $maintenance; 54 $this->core = $maintenance->core; 51 55 $this->init(); 52 56 … … 64 68 } 65 69 66 $ core->auth->user_prefs->addWorkspace('maintenance');67 $ts = $ core->auth->user_prefs->maintenance->get('ts_'.$this->id);68 70 $this->core->blog->settings->addNamespace('maintenance'); 71 $ts = $this->core->blog->settings->maintenance->get('ts_'.$this->id); 72 69 73 $this->ts = abs((integer) $ts); 70 74 } … … 99 103 { 100 104 return $this->ts === false ? false : abs((integer) $this->ts); 105 } 106 107 /** 108 * Get task expired. 109 * 110 * This return: 111 * - Timstamp of last update if it expired 112 * - False if it not expired or has no recall time 113 * - Null if it has never been executed 114 * 115 * @return <b>mixed</b> Last update 116 */ 117 public function expired() 118 { 119 if ($this->expired === 0) { 120 if (!$this->ts()) { 121 $this->expired = false; 122 } 123 else { 124 $this->expired = null; 125 $logs = array(); 126 foreach($this->maintenance->getLogs() as $id => $log) 127 { 128 if ($id != $this->id() || $this->blog && !$log['blog']) { 129 continue; 130 } 131 132 $this->expired = $log['ts'] + $this->ts() < time() ? $log['ts'] : false; 133 } 134 } 135 } 136 return $this->expired; 101 137 } 102 138 … … 251 287 protected function log() 252 288 { 253 $maintenance = new dcMaintenance($this->core); 254 $maintenance->setLog($this->id); 289 $this->maintenance->setLog($this->id); 255 290 } 256 291 }
Note: See TracChangeset
for help on using the changeset viewer.