Changeset 29779 for trunk/admin/include


Ignore:
Timestamp:
Sep 25, 2014, 11:25:24 AM (10 years ago)
Author:
mistic100
Message:

final fix for plugins update ?

  • plugins.version is not updated in "activate" action
  • plugins.version is updated in "update" action and "load_plugin()" function (not only for plugins using maintain.class.php)

cases covered:

  • autoupdate while active or inactive
  • FTP update while active or inactive
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/include/plugins.class.php

    r29778 r29779  
    153153      case 'update':
    154154        $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')
    158158        {
    159159          $this->get_fs_plugin($plugin_id); // refresh plugins list
     160          $new_version = $this->fs_plugins[$plugin_id]['version'];
    160161
    161162          $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 = '
     168UPDATE '. PLUGINS_TABLE .'
     169  SET version=\''. $new_version .'\'
     170  WHERE id=\''. $plugin_id .'\'
     171;';
     172            pwg_query($query);
     173          }
     174        }
     175
    166176        break;
    167177
     
    187197          $query = '
    188198UPDATE '. PLUGINS_TABLE .'
    189   SET state=\'active\',
    190     version=\''. $this->fs_plugins[$plugin_id]['version'] .'\'
     199  SET state=\'active\'
    191200  WHERE id=\''. $plugin_id .'\'
    192201;';
Note: See TracChangeset for help on using the changeset viewer.