Dotclear


Ignore:
Timestamp:
04/16/10 16:51:19 (13 years ago)
Author:
JcDenis
Message:

dcAdvancedCleaner 0.4:

  • Fixed list of tables (closes #440)
  • Fixed direct uninstaller
  • Added readable errors return
  • Added DC 2.2 compatibility (new settings)
  • Changed admin design
File:
1 edited

Legend:

Unmodified
Added
Removed
  • plugins/dcAdvancedCleaner/inc/class.dc.uninstaller.php

    r1567 r2199  
    33# This file is part of dcAdvancedCleaner, a plugin for Dotclear 2. 
    44#  
    5 # Copyright (c) 2009 JC Denis and contributors 
     5# Copyright (c) 2009-2010 JC Denis and contributors 
    66# jcdenis@gdwd.com 
    77#  
     
    4141     */ 
    4242     protected static $allowed_properties = array( 
     43          'versions' => array( 
     44               'delete' => 'delete version in dc' 
     45          ), 
    4346          'settings' => array( 
    4447               'delete_global' => 'delete global settings', 
     
    6164               'empty' => 'empty cache folder', 
    6265               'delete' => 'delete cache folder' 
    63           ), 
    64           'versions' => array( 
    65                'delete' => 'delete version in dc' 
    6666          ) 
     67     ); 
     68 
     69     protected static $priority_properties = array( 
     70          'versions','settings','tables','themes','plugins','caches' 
    6771     ); 
    6872 
     
    96100          $this->path = explode(PATH_SEPARATOR,$path); 
    97101 
    98           foreach ($this->path as $root) { 
    99                $this->loadModule($root); 
     102          foreach ($this->path as $root) 
     103          { 
     104               if (!is_dir($root) || !is_readable($root)) continue; 
     105 
     106               if (substr($root,-1) != '/') $root .= '/'; 
     107 
     108               if (($d = @dir($root)) === false) continue; 
     109 
     110               while (($entry = $d->read()) !== false) 
     111               { 
     112                    $full_entry = $root.'/'.$entry; 
     113 
     114                    if ($entry != '.' && $entry != '..' && is_dir($full_entry)) 
     115                    { 
     116                         $this->loadModule($full_entry); 
     117                    } 
     118               } 
     119               $d->close(); 
    100120          } 
    101121 
     
    113133     public function loadModule($root) 
    114134     { 
    115           if (!is_dir($root) || !is_readable($root)) return;; 
    116  
    117           if (substr($root,-1) != '/') $root .= '/'; 
    118  
    119           if (($d = @dir($root)) === false) return; 
    120  
    121           while (($entry = $d->read()) !== false) 
    122           { 
    123                $full_entry = $root.'/'.$entry; 
    124  
    125                if ($entry != '.' && $entry != '..' && is_dir($full_entry) 
    126                 && file_exists($full_entry.'/_define.php') 
    127                 && file_exists($full_entry.'/_uninstall.php')) { 
    128  
    129                     $this->id = $entry; 
    130                     $this->mroot = $full_entry; 
    131  
    132                     require $full_entry.'/_define.php'; 
    133                     require $full_entry.'/_uninstall.php'; 
    134  
    135                     $this->id = null; 
    136                     $this->mroot = null; 
    137                } 
    138           } 
    139           $d->close(); 
     135          if (file_exists($root.'/_define.php') 
     136           && file_exists($root.'/_uninstall.php')) { 
     137 
     138               $this->id = basename($root); 
     139               $this->mroot = $root; 
     140 
     141               require $root.'/_define.php'; 
     142               require $root.'/_uninstall.php'; 
     143 
     144               $this->id = null; 
     145               $this->mroot = null; 
     146          } 
    140147     } 
    141148      
     
    208215     } 
    209216 
    210      private function addAction($group,$type,$action,$ns,$desc='') 
     217     private function addAction($group,$type,$action,$ns,$desc) 
    211218     { 
    212219          $group = self::group($group); 
     
    229236     /** 
    230237     Returns modules <var>$id</var> predefined actions associative array 
     238     ordered by priority 
    231239      
    232240     @param    id        <b>string</b>       Optionnal module ID 
     
    249257          if (!isset($this->actions[$group][$id])) return array(); 
    250258 
    251           return $this->actions[$group][$id]; 
     259          $res = array(); 
     260          foreach(self::$priority_properties as $k => $v) 
     261          { 
     262               if (!isset($this->actions[$group][$id][$v])) continue; 
     263               $res[$v] = $this->actions[$group][$id][$v]; 
     264          } 
     265 
     266          return $res; 
    252267     } 
    253268 
Note: See TracChangeset for help on using the changeset viewer.

Sites map