Dotclear


Ignore:
Timestamp:
09/19/13 01:08:39 (12 years ago)
Author:
Denis Jean-Chirstian <contact@…>
Branch:
default
Children:
1956:d272c079e6e5, 1964:bfde9296c3c5
Message:

Revamp plugin maintenance, step 3, add backup tasks, dynamic tabs and plugin importExport, addresses #999

Location:
plugins/maintenance/inc
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • plugins/maintenance/inc/class.dc.maintenance.php

    r1940 r1955  
    2727     private $core; 
    2828     private $tasks = array(); 
     29     private $tabs = array(); 
    2930     private $groups = array(); 
    3031 
     
    4142 
    4243          $tasks = new ArrayObject(); 
     44          $tabs = new ArrayObject(); 
    4345          $groups = new ArrayObject(); 
    4446 
    4547          # --BEHAVIOR-- dcMaintenanceRegister 
    46           $core->callBehavior('dcMaintenanceRegister', $core, $tasks, $groups); 
    47  
    48           $this->init($tasks, $groups); 
     48          $core->callBehavior('dcMaintenanceRegister', $core, $tasks, $groups, $tabs); 
     49 
     50          $this->init($tasks, $groups, $tabs); 
    4951     } 
    5052 
     
    5456      * @param tasks     <b>arrayObject</b>  Array of task to register 
    5557      * @param groups    <b>arrayObject</b>  Array of groups to add 
    56       */ 
    57      public function init($tasks, $groups) 
     58      * @param tabs <b>arrayObject</b>  Array of tabs to add 
     59      */ 
     60     public function init($tasks, $groups, $tabs) 
    5861     { 
    5962          $this->tasks = $this->groups = array(); 
     
    7982               $this->groups[(string) $id] = (string) $name; 
    8083          } 
     84 
     85          foreach($tabs as $id => $name) 
     86          { 
     87               $this->tabs[(string) $id] = (string) $name; 
     88          } 
     89     } 
     90 
     91     /** 
     92      * Get a tab name. 
     93      * 
     94      * @param id   <b>string</b> Tab ID 
     95      * @return     <b>mixed</b> tab name or null if not exists 
     96      */ 
     97     public function getTab($id) 
     98     { 
     99          return array_key_exists($id, $this->tabs) ? $this->tabs[$id] : null; 
     100     } 
     101 
     102     /** 
     103      * Get tabs. 
     104      * 
     105      * @return     <b>array</b> Array of tabs ID and name 
     106      */ 
     107     public function getTabs() 
     108     { 
     109          return $this->tabs; 
    81110     } 
    82111 
  • plugins/maintenance/inc/class.dc.maintenance.task.php

    r1940 r1955  
    2828     protected $id; 
    2929     protected $name; 
     30     protected $tab = 'maintenance'; 
    3031     protected $group = 'other'; 
    3132 
     
    115116 
    116117     /** 
     118      * Get task tab. 
     119      * 
     120      * @return     <b>mixed</b>   Task tab ID or null 
     121      */ 
     122     public function tab() 
     123     { 
     124          return $this->tab; 
     125     } 
     126 
     127     /** 
    117128      * Get task group. 
    118129      * 
     
    211222          return null; 
    212223     } 
     224 
     225     /** 
     226      * Log task execution. 
     227      * 
     228      * Sometimes we need to log task execution  
     229      * direct from task itself. 
     230      * 
     231      */ 
     232     protected function log() 
     233     { 
     234          $maintenance = new dcMaintenance($this->core); 
     235          $maintenance->setLog($this->id); 
     236     } 
    213237} 
Note: See TracChangeset for help on using the changeset viewer.

Sites map