Changeset 10293 for trunk/admin/include
- Timestamp:
- Apr 11, 2011, 12:30:56 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/include/plugins.class.php
r10129 r10293 79 79 { 80 80 case 'install': 81 if (!empty($crt_db_plugin)) 82 { 83 array_push($errors, 'CANNOT INSTALL - ALREADY INSTALLED'); 84 break; 85 } 86 if (!isset($this->fs_plugins[$plugin_id])) 87 { 88 array_push($errors, 'CANNOT INSTALL - NO SUCH PLUGIN'); 81 if (!empty($crt_db_plugin) or !isset($this->fs_plugins[$plugin_id])) 82 { 89 83 break; 90 84 } … … 110 104 if (!isset($crt_db_plugin)) 111 105 { 112 array_push($errors, 'CANNOT ACTIVATE - NOT INSTALLED'); 106 $errors = $this->perform_action('install', $plugin_id); 107 } 108 elseif ($crt_db_plugin['state'] == 'active') 109 { 113 110 break; 114 111 } 115 if ($crt_db_plugin['state'] != 'inactive') 116 { 117 array_push($errors, 'invalid current state ' . $crt_db_plugin['state']); 118 break; 119 } 120 if (file_exists($file_to_include)) 112 if (empty($errors) and file_exists($file_to_include)) 121 113 { 122 114 include_once($file_to_include); … … 137 129 138 130 case 'deactivate': 139 if (!isset($crt_db_plugin)) 140 { 141 die ('CANNOT DEACTIVATE - NOT INSTALLED'); 142 } 143 if ($crt_db_plugin['state'] != 'active') 144 { 145 die('invalid current state ' . $crt_db_plugin['state']); 131 if (!isset($crt_db_plugin) or $crt_db_plugin['state'] != 'active') 132 { 133 break; 146 134 } 147 135 $query = ' … … 161 149 if (!isset($crt_db_plugin)) 162 150 { 163 die ('CANNOT UNINSTALL - NOT INSTALLED'); 151 break; 152 } 153 if ($crt_db_plugin['state'] == 'active') 154 { 155 $this->perform_action('deactivate', $plugin_id); 164 156 } 165 157 $query = ' … … 176 168 break; 177 169 170 case 'restore': 171 $this->perform_action('uninstall', $plugin_id); 172 unset($this->db_plugins_by_id[$plugin_id]); 173 $errors = $this->perform_action('activate', $plugin_id); 174 break; 175 178 176 case 'delete': 179 177 if (!empty($crt_db_plugin)) 180 178 { 181 array_push($errors, 'CANNOT DELETE - PLUGIN IS INSTALLED'); 182 break; 179 $this->perform_action('uninstall', $plugin_id); 183 180 } 184 181 if (!isset($this->fs_plugins[$plugin_id])) 185 182 { 186 array_push($errors, 'CANNOT DELETE - NO SUCH PLUGIN');187 183 break; 188 184 }
Note: See TracChangeset
for help on using the changeset viewer.