Dotclear


Ignore:
Timestamp:
06/05/15 15:56:08 (10 years ago)
Author:
Dsls
Branch:
default
Message:

Update dependencies management, add notices and prevent enabling/disabling modules when dependencies are unmet.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inc/admin/lib.moduleslist.php

    r2997 r3007  
    672672                    echo 
    673673                    '<td class="module-desc maximal">'.html::escapeHTML(__($module['desc'])); 
    674                     if (in_array('deps', $cols)) { 
    675  
    676                          if (isset($module['disable_also'])) { 
    677                               echo 
    678                               '<br/><span class="info">'.__('Disabling or removing this plugin will also disable the following plugins: '). 
    679                               join(',',$module['disable_also']).'</span>'; 
     674                    if (isset($module['cannot_disable']) && $module['enabled']) { 
     675                         echo 
     676                         '<br/><span class="info">'. 
     677                         sprintf(__('This module cannot be disabled nor deleted, since the following modules are also enabled : %s'), 
     678                                   join(',',$module['cannot_disable'])). 
     679                         '</span>'; 
     680                    } 
     681                    if (isset($module['cannot_enable']) && !$module['enabled']) { 
     682                         echo 
     683                         '<br/><span class="info">'. 
     684                         __('This module cannot be enabled, because of the following reasons :'). 
     685                         '<ul>'; 
     686                         foreach ($module['cannot_enable'] as $m=>$reason) { 
     687                              echo '<li>'.$reason.'</li>'; 
    680688                         } 
     689                         echo '</ul>'. 
     690                         '</span>'; 
    681691                    } 
    682692                    echo '</td>'; 
     
    815825 
    816826                    # Deactivate 
    817                     case 'activate': if ($this->core->auth->isSuperAdmin() && $module['root_writable']) { 
     827                    case 'activate': if ($this->core->auth->isSuperAdmin() && $module['root_writable'] && !isset($module['cannot_enable'])) { 
    818828                         $submits[] = 
    819829                         '<input type="submit" name="activate['.html::escapeHTML($id).']" value="'.__('Activate').'" />'; 
     
    821831 
    822832                    # Activate 
    823                     case 'deactivate': if ($this->core->auth->isSuperAdmin() && $module['root_writable']) { 
     833                    case 'deactivate': if ($this->core->auth->isSuperAdmin() && $module['root_writable'] && !isset($module['cannot_disable'])) { 
    824834                         $submits[] = 
    825835                         '<input type="submit" name="deactivate['.html::escapeHTML($id).']" value="'.__('Deactivate').'" class="reset" />'; 
     
    827837 
    828838                    # Delete 
    829                     case 'delete': if ($this->core->auth->isSuperAdmin() && $this->isDeletablePath($module['root'])) { 
     839                    case 'delete': if ($this->core->auth->isSuperAdmin() && $this->isDeletablePath($module['root'])&& !isset($module['cannot_disable'])) { 
    830840                         $dev = !preg_match('!^'.$this->path_pattern.'!', $module['root']) && defined('DC_DEV') && DC_DEV ? ' debug' : ''; 
    831841                         $submits[] = 
Note: See TracChangeset for help on using the changeset viewer.

Sites map