Changeset 10037
- Timestamp:
- Apr 4, 2011, 4:09:03 PM (13 years ago)
- Location:
- extensions/autoupdate/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/autoupdate/trunk/include/autoupdate.class.php
r10028 r10037 13 13 var $default_themes = array(); 14 14 var $default_languages = array(); 15 var $merged_extensions = array(); 16 var $merged_extension_url = 'http://piwigo.org/download/merged_extensions.txt'; 15 17 16 18 function autoupdate() … … 198 200 foreach ($this->$type->$fs as $ext_id => $ext) 199 201 { 200 if (isset($ext['extension']) and $id == $ext['extension'] and !in_array($ext_id, $this->$default)) 202 if (isset($ext['extension']) and $id == $ext['extension'] 203 and !in_array($ext_id, $this->$default) 204 and !in_array($ext['extension'], $this->merged_extensions)) 201 205 { 202 206 $this->missing[$type][] = $ext; … … 207 211 } 208 212 213 function get_merged_extensions($version) 214 { 215 if (fetchRemote($this->merged_extension_url, $result)) 216 { 217 $rows = explode("\n", $result); 218 foreach ($rows as $row) 219 { 220 if (preg_match('/^(\d+\.\d+): *(.*)$/', $row, $match)) 221 { 222 if (version_compare($version, $match[1], '>=')) 223 { 224 $extensions = explode(',', trim($match[2])); 225 $this->merged_extensions = array_merge($this->merged_extensions, $extensions); 226 } 227 } 228 } 229 } 230 } 231 209 232 function version_compare($a, $b, $type) 210 233 { -
extensions/autoupdate/trunk/update_pwg.inc.php
r10028 r10037 118 118 include_once(AUTOUPDATE_PATH.'include/autoupdate.class.php'); 119 119 $autoupdate = new autoupdate(); 120 $autoupdate->get_merged_extensions($upgrade_to); 120 121 $autoupdate->get_server_extensions($upgrade_to); 121 122 $template->assign('missing', $autoupdate->missing); -
extensions/autoupdate/trunk/ws_functions.inc.php
r9947 r10037 73 73 $plugins = new plugins(); 74 74 75 if (isset($params['upgradestatus']) and isset($params['id']))76 {77 switch ($params['upgradestatus'])78 {79 case 'ok':80 return sprintf(l10n('%s has been successfully upgraded.'), $plugins->fs_plugins[$params['id']]['name']);81 82 case 'temp_path_error':83 return new PwgError(null, l10n('Can\'t create temporary file.'));84 85 case 'dl_archive_error':86 return new PwgError(null, l10n('Can\'t download archive.'));87 88 case 'archive_error':89 return new PwgError(null, l10n('Can\'t read or extract archive.'));90 91 default:92 return new PwgError(null, sprintf(l10n('An error occured during extraction (%s).'), $params['upgradestatus']));93 }94 }95 96 75 if (empty($params['id']) or empty($params['revision'])) 97 76 { … … 103 82 104 83 if (isset($plugins->db_plugins_by_id[$plugin_id]) 105 and $plugins->db_plugins_by_id[$plugin_id]['state'] == 'active') 84 and $plugins->db_plugins_by_id[$plugin_id]['state'] == 'active' 85 and $plugin_id != 'autoupdate') 106 86 { 107 87 $plugins->perform_action('deactivate', $plugin_id); … … 128 108 $template->delete_compiled_templates(); 129 109 130 redirect(PHPWG_ROOT_PATH 131 . 'ws.php' 132 . '?method=pwg.plugins.update' 133 . '&revision=' . $revision 134 . '&id=' . $plugin_id 135 . '&upgradestatus='.$upgrade_status 136 . '&pwg_token=' . get_pwg_token() 137 . '&format=json' 138 ); 110 switch ($upgrade_status) 111 { 112 case 'ok': 113 return sprintf(l10n('%s has been successfully upgraded.'), $plugins->fs_plugins[$plugin_id]['name']); 114 115 case 'temp_path_error': 116 return new PwgError(null, l10n('Can\'t create temporary file.')); 117 118 case 'dl_archive_error': 119 return new PwgError(null, l10n('Can\'t download archive.')); 120 121 case 'archive_error': 122 return new PwgError(null, l10n('Can\'t read or extract archive.')); 123 124 default: 125 return new PwgError(null, sprintf(l10n('An error occured during extraction (%s).'), $upgrade_status)); 126 } 139 127 } 140 128
Note: See TracChangeset
for help on using the changeset viewer.