Changeset 29779
- Timestamp:
- Sep 25, 2014, 11:25:24 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/include/plugins.class.php
r29778 r29779 153 153 case 'update': 154 154 $previous_version = $this->fs_plugins[$plugin_id]['version']; 155 $ upgrade_status= $this->extract_plugin_files('upgrade', $options['revision'], $plugin_id);156 157 if ($ upgrade_status=== 'ok')155 $errors[0] = $this->extract_plugin_files('upgrade', $options['revision'], $plugin_id); 156 157 if ($errors[0] === 'ok') 158 158 { 159 159 $this->get_fs_plugin($plugin_id); // refresh plugins list 160 $new_version = $this->fs_plugins[$plugin_id]['version']; 160 161 161 162 $plugin_maintain = self::build_maintain_class($plugin_id); 162 $plugin_maintain->update($previous_version, $this->fs_plugins[$plugin_id]['version']); 163 } 164 165 return $upgrade_status; 163 $plugin_maintain->update($previous_version, $new_version, $errors); 164 165 if ($new_version != 'auto') 166 { 167 $query = ' 168 UPDATE '. PLUGINS_TABLE .' 169 SET version=\''. $new_version .'\' 170 WHERE id=\''. $plugin_id .'\' 171 ;'; 172 pwg_query($query); 173 } 174 } 175 166 176 break; 167 177 … … 187 197 $query = ' 188 198 UPDATE '. PLUGINS_TABLE .' 189 SET state=\'active\', 190 version=\''. $this->fs_plugins[$plugin_id]['version'] .'\' 199 SET state=\'active\' 191 200 WHERE id=\''. $plugin_id .'\' 192 201 ;'; -
trunk/include/functions_plugins.inc.php
r29316 r29779 377 377 function autoupdate_plugin(&$plugin) 378 378 { 379 $maintain_file = PHPWG_PLUGINS_PATH.$plugin['id'].'/maintain.class.php'; 380 381 // autoupdate is applicable only to plugins with 2.7 architecture 382 if (file_exists($maintain_file)) 383 { 384 // try to find the filesystem version in lines 2 to 10 of main.inc.php 385 $fh = fopen(PHPWG_PLUGINS_PATH.$plugin['id'].'/main.inc.php', 'r'); 386 $fs_version = null; 387 $i = -1; 388 389 while (($line = fgets($fh))!==false && $fs_version==null && $i<10) 390 { 391 $i++; 392 if ($i < 2) continue; // first lines are typically "<?php" and "/*" 393 394 if (preg_match('/Version:\\s*([\\w.-]+)/', $line, $matches)) 395 { 396 $fs_version = $matches[1]; 397 } 398 } 399 400 fclose($fh); 401 402 if ($fs_version != null) 403 { 404 global $pwg_loaded_plugins, $page; 405 406 // if version is auto (dev) or superior 407 if ( 408 $fs_version == 'auto' or $plugin['version'] == 'auto' 409 or safe_version_compare($plugin['version'], $fs_version, '<') 410 ) 411 { 412 // call update method 413 include_once($maintain_file); 414 415 $classname = $plugin['id'].'_maintain'; 416 $plugin_maintain = new $classname($plugin['id']); 417 $plugin_maintain->update($plugin['version'], $fs_version, $page['errors']); 418 419 $plugin['version'] = $fs_version; 420 421 // update database (only on production) 422 if ($plugin['version'] != 'auto') 423 { 424 $query = ' 379 // try to find the filesystem version in lines 2 to 10 of main.inc.php 380 $fh = fopen(PHPWG_PLUGINS_PATH.$plugin['id'].'/main.inc.php', 'r'); 381 $fs_version = null; 382 $i = -1; 383 384 while (($line = fgets($fh))!==false && $fs_version==null && $i<10) 385 { 386 $i++; 387 if ($i < 2) continue; // first lines are typically "<?php" and "/*" 388 389 if (preg_match('/Version:\\s*([\\w.-]+)/', $line, $matches)) 390 { 391 $fs_version = $matches[1]; 392 } 393 } 394 395 fclose($fh); 396 397 // if version is auto (dev) or superior 398 if ($fs_version != null && ( 399 $fs_version == 'auto' || $plugin['version'] == 'auto' || 400 safe_version_compare($plugin['version'], $fs_version, '<') 401 ) 402 ) { 403 $plugin['version'] = $fs_version; 404 405 $maintain_file = PHPWG_PLUGINS_PATH.$plugin['id'].'/maintain.class.php'; 406 407 // autoupdate is applicable only to plugins with 2.7 architecture 408 if (file_exists($maintain_file)) 409 { 410 global $page; 411 412 // call update method 413 include_once($maintain_file); 414 415 $classname = $plugin['id'].'_maintain'; 416 $plugin_maintain = new $classname($plugin['id']); 417 $plugin_maintain->update($plugin['version'], $fs_version, $page['errors']); 418 } 419 420 // update database (only on production) 421 if ($plugin['version'] != 'auto') 422 { 423 $query = ' 425 424 UPDATE '. PLUGINS_TABLE .' 426 425 SET version = "'. $plugin['version'] .'" 427 426 WHERE id = "'. $plugin['id'] .'" 428 427 ;'; 429 pwg_query($query); 430 } 431 } 428 pwg_query($query); 432 429 } 433 430 } -
trunk/include/ws_functions/pwg.extensions.php
r29773 r29779 189 189 } 190 190 191 $upgrade_status= $extension->perform_action('update', $extension_id, array('revision'=>$revision));191 list($upgrade_status) = $extension->perform_action('update', $extension_id, array('revision'=>$revision)); 192 192 $extension_name = $extension->fs_plugins[$extension_id]['name']; 193 193
Note: See TracChangeset
for help on using the changeset viewer.