Changeset 3874:ab8368569446 for plugins/maintenance
- Timestamp:
- 09/14/18 12:16:17 (7 years ago)
- Branch:
- default
- Location:
- plugins/maintenance
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/maintenance/_admin.php
r3731 r3874 22 22 23 23 // Admin behaviors 24 $core->addBehavior('dcMaintenanceInit', array('dcMaintenanceAdmin', 'dcMaintenanceInit'));25 $core->addBehavior('adminDashboardFavorites', array('dcMaintenanceAdmin', 'adminDashboardFavorites'));26 $core->addBehavior('adminDashboardContents', array('dcMaintenanceAdmin', 'adminDashboardItems'));27 $core->addBehavior('adminDashboardOptionsForm', array('dcMaintenanceAdmin', 'adminDashboardOptionsForm'));28 $core->addBehavior('adminAfterDashboardOptionsUpdate', array('dcMaintenanceAdmin', 'adminAfterDashboardOptionsUpdate'));29 $core->addBehavior('adminPageHelpBlock', array('dcMaintenanceAdmin', 'adminPageHelpBlock'));30 $core->addBehavior('pluginsToolsHeaders', array('dcMaintenanceAdmin', 'pluginsToolsHeaders'));24 $core->addBehavior('dcMaintenanceInit', ['dcMaintenanceAdmin', 'dcMaintenanceInit']); 25 $core->addBehavior('adminDashboardFavorites', ['dcMaintenanceAdmin', 'adminDashboardFavorites']); 26 $core->addBehavior('adminDashboardContents', ['dcMaintenanceAdmin', 'adminDashboardItems']); 27 $core->addBehavior('adminDashboardOptionsForm', ['dcMaintenanceAdmin', 'adminDashboardOptionsForm']); 28 $core->addBehavior('adminAfterDashboardOptionsUpdate', ['dcMaintenanceAdmin', 'adminAfterDashboardOptionsUpdate']); 29 $core->addBehavior('adminPageHelpBlock', ['dcMaintenanceAdmin', 'adminPageHelpBlock']); 30 $core->addBehavior('pluginsToolsHeaders', ['dcMaintenanceAdmin', 'pluginsToolsHeaders']); 31 31 32 32 /** … … 47 47 { 48 48 $maintenance 49 ->addTab('maintenance', __('Servicing'), array('summary' => __('Tools to maintain the performance of your blogs.')))50 ->addTab('backup', __('Backup'), array('summary' => __('Tools to back up your content.')))51 ->addTab('dev', __('Development'), array('summary' => __('Tools to assist in development of plugins, themes and core.')))49 ->addTab('maintenance', __('Servicing'), ['summary' => __('Tools to maintain the performance of your blogs.')]) 50 ->addTab('backup', __('Backup'), ['summary' => __('Tools to back up your content.')]) 51 ->addTab('dev', __('Development'), ['summary' => __('Tools to assist in development of plugins, themes and core.')]) 52 52 53 53 ->addGroup('optimize', __('Optimize')) … … 58 58 ->addGroup('zipfull', __('All blogs')) 59 59 60 ->addGroup('l10n', __('Translations'), array('summary' => __('Maintain translations')))60 ->addGroup('l10n', __('Translations'), ['summary' => __('Maintain translations')]) 61 61 62 62 ->addTask('dcMaintenanceCache') … … 81 81 public static function adminDashboardFavorites($core, $favs) 82 82 { 83 $favs->register('maintenance', array(83 $favs->register('maintenance', [ 84 84 'title' => __('Maintenance'), 85 85 'url' => $core->adminurl->get('admin.plugin.maintenance'), … … 87 87 'large-icon' => dcPage::getPF('maintenance/icon-big.png'), 88 88 'permissions' => 'admin', 89 'active_cb' => array('dcMaintenanceAdmin', 'adminDashboardFavoritesActive'),90 'dashboard_cb' => array('dcMaintenanceAdmin', 'adminDashboardFavoritesCallback')91 ));89 'active_cb' => ['dcMaintenanceAdmin', 'adminDashboardFavoritesActive'], 90 'dashboard_cb' => ['dcMaintenanceAdmin', 'adminDashboardFavoritesCallback'] 91 ]); 92 92 } 93 93 … … 152 152 $maintenance = new dcMaintenance($core); 153 153 154 $lines = array();154 $lines = []; 155 155 foreach ($maintenance->getTasks() as $t) { 156 156 $ts = $t->expired(); … … 174 174 } 175 175 176 $items[] = new ArrayObject( array(176 $items[] = new ArrayObject([ 177 177 '<div id="maintenance-expired" class="box small">' . 178 178 '<h3><img src="' . dcPage::getPF('maintenance/icon-small.png') . '" alt="" /> ' . __('Maintenance') . '</h3>' . … … 181 181 '<p><a href="' . $core->adminurl->get('admin.plugin.maintenance') . '">' . __('Manage tasks') . '</a></p>' . 182 182 '</div>' 183 ));183 ]); 184 184 } 185 185 -
plugins/maintenance/_define.php
r3731 r3874 17 17 "Olivier Meunier & Association Dotclear", // Author 18 18 '1.3.1', // Version 19 array(19 [ 20 20 'permissions' => 'admin', 21 21 'type' => 'plugin', 22 'settings' => array(22 'settings' => [ 23 23 'self' => '#settings' 24 )25 )24 ] 25 ] 26 26 27 27 ); -
plugins/maintenance/_prepend.php
r3731 r3874 28 28 $__autoload['dcMaintenanceZiptheme'] = dirname(__FILE__) . '/inc/tasks/class.dc.maintenance.ziptheme.php'; 29 29 30 $this->core->rest->addFunction('dcMaintenanceStep', array('dcMaintenanceRest', 'step'));30 $this->core->rest->addFunction('dcMaintenanceStep', ['dcMaintenanceRest', 'step']); -
plugins/maintenance/inc/class.dc.maintenance.descriptor.php
r3731 r3874 31 31 * @param options <b>string<b> Options 32 32 */ 33 public function __construct($id, $name, $options = array())33 public function __construct($id, $name, $options = []) 34 34 { 35 35 $this->id = (string) $id; -
plugins/maintenance/inc/class.dc.maintenance.php
r3731 r3874 20 20 public $p_url; 21 21 22 private $tasks = array();23 private $tabs = array();24 private $groups = array();22 private $tasks = []; 23 private $tabs = []; 24 private $groups = []; 25 25 private $logs = null; 26 26 … … 61 61 * @return <b>dcMaintenance</b> Self 62 62 */ 63 public function addTab($id, $name, $options = array())63 public function addTab($id, $name, $options = []) 64 64 { 65 65 $this->tabs[$id] = new dcMaintenanceDescriptor($id, $name, $options); … … 100 100 * @return <b>dcMaintenance</b> Self 101 101 */ 102 public function addGroup($id, $name, $options = array())102 public function addGroup($id, $name, $options = []) 103 103 { 104 104 $this->groups[$id] = new dcMaintenanceDescriptor($id, $name, $options); … … 205 205 ); 206 206 207 $logs = array();207 $logs = []; 208 208 while ($rs->fetch()) { 209 209 $logs[] = $rs->log_id; … … 231 231 { 232 232 // Retrieve logs from this task 233 $rs = $this->core->log->getLogs( array(233 $rs = $this->core->log->getLogs([ 234 234 'log_table' => 'maintenance', 235 235 'blog_id' => 'all' 236 ));237 238 $logs = array();236 ]); 237 238 $logs = []; 239 239 while ($rs->fetch()) { 240 240 $logs[] = $rs->log_id; … … 250 250 * Get logs 251 251 * 252 * Return array(253 * task id => array(252 * Return [ 253 * task id => [ 254 254 * timestamp of last execution, 255 255 * logged on current blog or not 256 * )257 * )256 * ] 257 * ] 258 258 * 259 259 * @return <b>array</b> List of logged tasks … … 262 262 { 263 263 if ($this->logs === null) { 264 $rs = $this->core->log->getLogs( array(264 $rs = $this->core->log->getLogs([ 265 265 'log_table' => 'maintenance', 266 266 'blog_id' => 'all' 267 ));268 269 $this->logs = array();267 ]); 268 269 $this->logs = []; 270 270 while ($rs->fetch()) { 271 $this->logs[$rs->log_msg] = array(271 $this->logs[$rs->log_msg] = [ 272 272 'ts' => strtotime($rs->log_dt), 273 273 'blog' => $rs->blog_id == $this->core->blog->id 274 );274 ]; 275 275 } 276 276 } -
plugins/maintenance/inc/class.dc.maintenance.task.php
r3731 r3874 155 155 } else { 156 156 $this->expired = null; 157 $logs = array();157 $logs = []; 158 158 foreach ($this->maintenance->getLogs() as $id => $log) { 159 159 if ($id != $this->id() || $this->blog && !$log['blog']) { -
plugins/maintenance/index.php
r3731 r3874 22 22 $p_url = $core->adminurl->get('admin.plugin.maintenance'); 23 23 $task = null; 24 $expired = array();24 $expired = []; 25 25 26 26 $code = empty($_POST['code']) ? null : (integer) $_POST['code']; … … 101 101 // Combos 102 102 103 $combo_ts = array(103 $combo_ts = [ 104 104 __('Never') => 0, 105 105 __('Every week') => 604800, … … 107 107 __('Every month') => 2592000, 108 108 __('Every two months') => 5184000 109 );109 ]; 110 110 111 111 // Display page … … 132 132 if (empty($tasks)) { 133 133 echo dcPage::breadcrumb( 134 array(134 [ 135 135 __('Plugins') => '', 136 136 __('Maintenance') => '' 137 )137 ] 138 138 ) . 139 139 '<p class="warn">' . __('You have not sufficient permissions to view this page.') . '</p>' . … … 148 148 149 149 echo dcPage::breadcrumb( 150 array(150 [ 151 151 __('Plugins') => '', 152 152 '<a href="' . $p_url . '">' . __('Maintenance') . '</a>' => '', 153 153 html::escapeHTML($task->name()) => '' 154 )154 ] 155 155 ) . dcPage::notices(); 156 156 … … 172 172 '<p class="step-submit">' . 173 173 '<input type="submit" value="' . $task->task() . '" /> ' . 174 form::hidden( array('task'), $task->id()) .175 form::hidden( array('code'), (integer) $code) .174 form::hidden(['task'], $task->id()) . 175 form::hidden(['code'], (integer) $code) . 176 176 $core->formNonce() . 177 177 '</p>' . … … 183 183 184 184 echo dcPage::breadcrumb( 185 array(185 [ 186 186 __('Plugins') => '', 187 187 __('Maintenance') => '' 188 )188 ] 189 189 ) . dcPage::notices(); 190 190 … … 203 203 204 204 $res_task .= 205 '<p>' . form::radio( array('task', $t->id()), $t->id()) . ' ' .205 '<p>' . form::radio(['task', $t->id()], $t->id()) . ' ' . 206 206 '<label class="classic" for="' . $t->id() . '">' . 207 207 html::escapeHTML($t->task()) . '</label>'; … … 246 246 $res_group . 247 247 '<p><input type="submit" value="' . __('Execute task') . '" /> ' . 248 form::hidden( array('tab'), $tab_obj->id()) .248 form::hidden(['tab'], $tab_obj->id()) . 249 249 $core->formNonce() . '</p>' . 250 250 '<p class="form-note info">' . __('This may take a very long time.') . '</p>' . … … 267 267 $t->content() . 268 268 '<p><input type="submit" value="' . __('Execute task') . '" /> ' . 269 form::hidden( array('task'), $t->id()) .270 form::hidden( array('tab'), $t->id()) .269 form::hidden(['task'], $t->id()) . 270 form::hidden(['tab'], $t->id()) . 271 271 $core->formNonce() . '</p>' . 272 272 '</form>' . … … 293 293 '<h4 class="pretty-title vertical-separator">' . __('Frequency') . '</h4>' . 294 294 295 '<p class="vertical-separator">' . form::radio( array('settings_recall_type', 'settings_recall_all'), 'all') . ' ' .295 '<p class="vertical-separator">' . form::radio(['settings_recall_type', 'settings_recall_all'], 'all') . ' ' . 296 296 '<label class="classic" for="settings_recall_all">' . 297 297 '<strong>' . __('Use one recall time for all tasks') . '</strong></label></p>' . … … 301 301 '</p>' . 302 302 303 '<p class="vertical-separator">' . form::radio( array('settings_recall_type', 'settings_recall_separate'), 'separate', 1) . ' ' .303 '<p class="vertical-separator">' . form::radio(['settings_recall_type', 'settings_recall_separate'], 'separate', 1) . ' ' . 304 304 '<label class="classic" for="settings_recall_separate">' . 305 305 '<strong>' . __('Use one recall time per task') . '</strong></label></p>'; … … 321 321 echo 322 322 '<p class="field wide"><input type="submit" value="' . __('Save') . '" /> ' . 323 form::hidden( array('tab'), 'settings') .324 form::hidden( array('save_settings'), 1) .323 form::hidden(['tab'], 'settings') . 324 form::hidden(['save_settings'], 1) . 325 325 $core->formNonce() . '</p>' . 326 326 '</form>' .
Note: See TracChangeset
for help on using the changeset viewer.