Dotclear

Changeset 1955:b0bef03695c0


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

Files:
3 added
1 deleted
8 edited

Legend:

Unmodified
Added
Removed
  • locales/en/plugins.po

    r1940 r1955  
    861861msgstr "" 
    862862 
     863#, php-format 
     864msgid "maximum size %s" 
     865msgstr "" 
     866 
    863867msgid "or pick up a local file in your public directory" 
    864868msgstr "" 
     
    870874msgstr "" 
    871875 
     876msgid "File is empty or not a compressed file." 
     877msgstr "" 
     878 
    872879msgid "WordPress import" 
    873880msgstr "" 
     
    931938msgstr "" 
    932939 
     940msgid "Database export" 
     941msgstr "" 
     942 
     943msgid "Download database of current blog" 
     944msgstr "" 
     945 
     946msgid "Zip file ready to download." 
     947msgstr "" 
     948 
     949msgid "Download database of all blogs" 
     950msgstr "" 
     951 
    933952msgid "Please wait..." 
    934953msgstr "" 
     
    937956msgstr "" 
    938957 
     958msgid "Servicing" 
     959msgstr "" 
     960 
     961msgid "Backup" 
     962msgstr "" 
     963 
    939964msgid "Optimize" 
    940965msgstr "" 
     
    949974msgstr "" 
    950975 
     976msgid "Compressed file for current blog" 
     977msgstr "" 
     978 
     979msgid "Compressed file for all blogs" 
     980msgstr "" 
     981 
    951982msgid "Execute task" 
    952983msgstr "" 
     
    10561087 
    10571088msgid "Empty directory" 
     1089msgstr "" 
     1090 
     1091msgid "Download media folder of current blog" 
     1092msgstr "" 
     1093 
     1094msgid "Download active theme of current blog" 
    10581095msgstr "" 
    10591096 
  • locales/fr/plugins.po

    r1947 r1955  
    994994#, php-format 
    995995msgid "maximum size %s" 
     996msgstr "taille maximum de %s" 
     997 
     998#, php-format 
     999msgid "maximum size %s" 
    9961000msgstr "" 
    9971001 
     
    10021006msgstr "Attention : Cela supprimera au préalable tout le contenu de votre base de données à l'exception des utilisateurs." 
    10031007 
     1008msgid "File is empty or not a compressed file." 
     1009msgstr "Le fichier est vide ou n'est pas un fichier compressé." 
     1010 
    10041011msgid "Another file with same name exists." 
    10051012msgstr "Un autre fichier portant ce nom existe déjà." 
     
    10731080msgstr "L'ID de \"%3$s\" ne correspond pas dans l'enregistrement \"%1$s\" à la ligne %2$s du fichier de sauvegarde." 
    10741081 
     1082msgid "Database export" 
     1083msgstr "Export de base de données" 
     1084 
     1085msgid "Download database of current blog" 
     1086msgstr "Télécharger la base de données du blog courant" 
     1087 
     1088msgid "Zip file ready to be downloaded." 
     1089msgstr "Fichier Zip prêt à être télécharger." 
     1090 
     1091msgid "Download database of all blogs" 
     1092msgstr "Télécharger la base de données de tous les blogs" 
     1093 
    10751094msgid "Please wait..." 
    10761095msgstr "Veuillez patientez…" 
     
    10791098msgstr "Maintenance" 
    10801099 
     1100msgid "Servicing" 
     1101msgstr "Entretien" 
     1102 
     1103msgid "Backup" 
     1104msgstr "Sauvegarde" 
     1105 
    10811106msgid "Optimize" 
    10821107msgstr "Optimiser" 
     
    10901115msgid "Other" 
    10911116msgstr "Autre" 
     1117 
     1118msgid "Compressed file for current blog" 
     1119msgstr "Fichier compressé pour le blog courant" 
     1120 
     1121msgid "Compressed file for all blogs" 
     1122msgstr "Fichier compressé pour tous les blogs" 
    10921123 
    10931124#, php-format 
     
    11741205msgstr "Impossible de vider les tables." 
    11751206 
     1207msgid "Download media folder of current blog" 
     1208msgstr "Télécharger le dossier media du blog courant" 
     1209 
     1210msgid "Download active theme of current blog" 
     1211msgstr "Télécharger le theme actif du blog courant" 
     1212 
    11761213msgid "Back" 
    11771214msgstr "Retour" 
  • plugins/importExport/_prepend.php

    r891 r1955  
    1212if (!defined('DC_RC_PATH')) { return; } 
    1313 
    14 global $__autoload,$core; 
     14global $__autoload; 
    1515 
    1616$__autoload['dcIeModule'] =   dirname(__FILE__).'/inc/class.dc.ieModule.php'; 
     
    2828$__autoload['flatExport'] =   dirname(__FILE__).'/inc/flat/class.flat.export.php'; 
    2929 
    30 $core->addBehavior('importExportModules','registerIeModules'); 
     30$this->core->addBehavior('importExportModules','registerIeModules'); 
    3131 
    3232function registerIeModules($modules) 
     
    4242     } 
    4343} 
     44 
     45$__autoload['ieMaintenanceExportblog'] = dirname(__FILE__).'/inc/lib.ie.maintenance.php'; 
     46$__autoload['ieMaintenanceExportfull'] = dirname(__FILE__).'/inc/lib.ie.maintenance.php'; 
     47 
     48$this->core->addBehavior('dcMaintenanceRegister', 'ieMaintenanceRegister'); 
     49 
     50function ieMaintenanceRegister($core, $tasks, $groups, $tabs) 
     51{ 
     52     $tasks[] = 'ieMaintenanceExportblog'; 
     53     $tasks[] = 'ieMaintenanceExportfull'; 
     54} 
    4455?> 
  • plugins/maintenance/_admin.php

    r1940 r1955  
    4343      * @param $tasks    <b>arrayObject</b>  Array of tasks to register 
    4444      * @param $groups   <b>arrayObject</b>  Array of groups to register 
     45      * @param $tabs     <b>arrayObject</b>  Array of tabs to register 
    4546      */ 
    46       public static function register($core, $tasks, $groups) 
     47      public static function register($core, $tasks, $groups, $tabs) 
    4748     { 
     49          $tabs['maintenance'] = __('Servicing'); 
     50          $tabs['backup'] = __('Backup'); 
     51 
    4852          $groups['optimize'] = __('Optimize'); 
    4953          $groups['index'] = __('Count and index'); 
    5054          $groups['purge'] = __('Purge'); 
    5155          $groups['other'] = __('Other'); 
     56          $groups['zipblog'] = __('Compressed file for current blog'); 
     57          $groups['zipfull'] = __('Compressed file for all blogs'); 
    5258 
    5359          $tasks[] = 'dcMaintenanceCache'; 
     
    5763          $tasks[] = 'dcMaintenanceLogs'; 
    5864          $tasks[] = 'dcMaintenanceVacuum'; 
     65          $tasks[] = 'dcMaintenanceZipmedia'; 
     66          $tasks[] = 'dcMaintenanceZiptheme'; 
    5967     } 
    6068 
  • plugins/maintenance/_prepend.php

    r1925 r1955  
    2424$__autoload['dcMaintenanceLogs'] = dirname(__FILE__).'/inc/tasks/class.dc.maintenance.logs.php'; 
    2525$__autoload['dcMaintenanceVacuum'] = dirname(__FILE__).'/inc/tasks/class.dc.maintenance.vacuum.php'; 
     26$__autoload['dcMaintenanceZipmedia'] = dirname(__FILE__).'/inc/tasks/class.dc.maintenance.zipmedia.php'; 
     27$__autoload['dcMaintenanceZiptheme'] = dirname(__FILE__).'/inc/tasks/class.dc.maintenance.ziptheme.php'; 
    2628 
    2729$this->core->rest->addFunction('dcMaintenanceStep', array('dcMaintenanceRest', 'step')); 
  • 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} 
  • plugins/maintenance/index.php

    r1940 r1955  
    7070dcPage::jsPageTabs($tab); 
    7171 
    72 if ($task) { 
     72if (0){//$task) { 
    7373     echo  
    7474     '<script type="text/javascript">'."\n". 
     
    137137     // Simple task (with only a button to start it) 
    138138 
    139      echo  
    140      '<div id="maintenance" class="multi-part" title="'.__('Maintenance').'">'. 
    141      '<h3>'.__('Maintenance').'</h3>'. 
    142      '<form action="'.$p_url.'" method="post">'; 
    143  
    144      foreach($maintenance->getGroups($core) as $g_id => $g_name) 
     139     foreach($maintenance->getTabs() as $tab_id => $tab_name) 
    145140     { 
    146           $res = ''; 
    147           foreach($maintenance->getTasks($core) as $t) 
     141          $res_group = ''; 
     142          foreach($maintenance->getGroups($core) as $group_id => $group_name) 
    148143          { 
    149                if ($t->group() != $g_id) { 
    150                     continue; 
     144               $res_task = ''; 
     145               foreach($maintenance->getTasks($core) as $t) 
     146               { 
     147                    if ($t->group() != $group_id || $t->tab() != $tab_id) { 
     148                         continue; 
     149                    } 
     150 
     151                    $res_task .=   
     152                    '<p>'.form::radio(array('task', $t->id()), $t->id()).' '. 
     153                    '<label class="classic" for="'.$t->id().'">'. 
     154                    html::escapeHTML($t->task()).'</label>'; 
     155 
     156                    if (array_key_exists($t->id(), $expired)) { 
     157                         $res_task .=  
     158                         ' <span class="clear form-note warn">'.sprintf( 
     159                              __('Last execution of this task was on %s. You should execute it again.'), 
     160                              dt::dt2str(__('%Y-%m-%d %H:%M'), $expired[$t->id()]) 
     161                         ).'</span>'; 
     162                    } 
     163 
     164                    $res_task .= '</p>'; 
    151165               } 
    152166 
    153                $res .=   
    154                '<p>'.form::radio(array('task', $t->id()), $t->id()).' '. 
    155                '<label class="classic" for="'.$t->id().'">'. 
    156                html::escapeHTML($t->task()).'</label>'; 
    157  
    158                if (array_key_exists($t->id(), $expired)) { 
    159                     $res .=  
    160                     ' <span class="clear form-note warn">'.sprintf( 
    161                          __('Last execution of this task was on %s. You should execute it again.'), 
    162                          dt::dt2str(__('%Y-%m-%d %H:%M'), $expired[$t->id()]) 
    163                     ).'</span>'; 
     167               if (!empty($res_task)) { 
     168                    $res_group .=  
     169                    '<div class="fieldset">'. 
     170                    '<h4 id="'.$group_id.'">'.$group_name.'</h4>'. 
     171                    $res_task. 
     172                    '</div>'; 
    164173               } 
    165  
    166                $res .= '</p>'; 
    167           } 
    168  
    169           if (!empty($res)) { 
    170                echo '<div class="fieldset"><h4 id="'.$g_id.'">'.$g_name.'</h4>'.$res.'</div>'; 
    171           } 
    172      } 
    173  
    174      echo  
    175      '<p><input type="submit" value="'.__('Execute task').'" /> '. 
    176      form::hidden(array('tab'), 'maintenance'). 
    177      $core->formNonce().'</p>'. 
    178      '<p class="form-note info">'.__('This may take a very long time').'.</p>'. 
    179      '</form>'. 
    180      '</div>'; 
     174          } 
     175 
     176          if (!empty($res_group)) { 
     177               echo  
     178               '<div id="'.$tab_id.'" class="multi-part" title="'.$tab_name.'">'. 
     179               '<h3>'.$tab_name.'</h3>'. 
     180               '<form action="'.$p_url.'" method="post">'. 
     181               $res_group. 
     182               '<p><input type="submit" value="'.__('Execute task').'" /> '. 
     183               form::hidden(array('tab'), $tab_id). 
     184               $core->formNonce().'</p>'. 
     185               '<p class="form-note info">'.__('This may take a very long time').'.</p>'. 
     186               '</form>'. 
     187               '</div>'; 
     188          } 
     189     } 
    181190 
    182191     // Advanced tasks (that required a tab) 
Note: See TracChangeset for help on using the changeset viewer.

Sites map