Changeset 2816


Ignore:
Timestamp:
Nov 1, 2008, 10:22:08 PM (15 years ago)
Author:
patdenice
Message:

merge -c2815 from trunk to branch 2.0

  • bugs correction in upgrade_1.7.0.php.
  • only non-standard plugins are deactivated during upgrade.
Location:
branches/2.0
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/2.0/admin/include/functions_upgrade.php

    r2516 r2816  
    9595}
    9696
     97// Deactivate all non-standard plugins
     98function deactivate_non_standard_plugins()
     99{
     100  global $page;
     101
     102  $standard_plugins = array(
     103    'add_index',
     104    'admin_advices',
     105    'admin_multi_view',
     106    'c13y_upgrade',
     107    'event_tracer',
     108    'language_switch',
     109    'LocalFilesEditor'
     110    );
     111
     112  $query = '
     113SELECT id
     114FROM '.PREFIX_TABLE.'plugins
     115WHERE state = "active"
     116AND id NOT IN ("' . implode('","', $standard_plugins) . '")
     117;';
     118
     119  $result = pwg_query($query);
     120  $plugins = array();
     121  while ($row = mysql_fetch_assoc($result))
     122  {
     123    array_push($plugins, $row['id']);
     124  }
     125
     126  if (!empty($plugins))
     127  {
     128    $query = '
     129UPDATE '.PREFIX_TABLE.'plugins
     130SET state="inactive"
     131WHERE id IN ("' . implode('","', $plugins) . '")
     132;';
     133    mysql_query($query);
     134
     135    array_push(
     136      $page['infos'],
     137      'As a precaution, following plugins have been deactivated. You must check for plugins upgrade before reactiving them:
     138<pre>' . implode(', ', $plugins) . '</pre>'
     139      );
     140  }
     141}
     142
    97143?>
  • branches/2.0/install/upgrade_1.7.0.php

    r2754 r2816  
    3434}
    3535
    36 define('PREFIX_TABLE', $prefixeTable);
    3736define('UPGRADES_PATH', PHPWG_ROOT_PATH.'install/db');
    3837
     
    6968      'id' => $upgrade_id,
    7069      'applied' => CURRENT_DATE,
    71       'description' => '[migration from 1.7.0 to '.RELEASE.'] not applied',
     70      'description' => '[migration from 1.7.0 to '.PHPWG_VERSION.'] not applied',
    7271      )
    7372    );
    7473}
    75 mass_inserts(
    76   '`'.UPGRADE_TABLE.'`',
    77   array_keys($inserts[0]),
    78   $inserts
    79   );
     74
     75if (!empty($inserts))
     76{
     77  mass_inserts(
     78    '`'.UPGRADE_TABLE.'`',
     79    array_keys($inserts[0]),
     80    $inserts
     81    );
     82}
    8083
    8184// +-----------------------------------------------------------------------+
     
    107110  (id, applied, description)
    108111  VALUES
    109   (\''.$upgrade_id.'\', NOW(), \'[migration from 1.7.0 to '.RELEASE.'] '.$upgrade_description.'\')
     112  (\''.$upgrade_id.'\', NOW(), \'[migration from 1.7.0 to '.PHPWG_VERSION.'] '.$upgrade_description.'\')
    110113;';
    111114  pwg_query($query);
  • branches/2.0/upgrade.php

    r2811 r2816  
    238238    if (in_array(PREFIX_TABLE.'plugins', $tables))
    239239    {
    240       $query = '
    241 UPDATE '.PREFIX_TABLE.'plugins SET state="inactive" WHERE state="active"
    242 ;';
    243       mysql_query($query);
    244 
    245       if (mysql_affected_rows() > 0)
    246       {
    247         array_push(
    248           $page['infos'],
    249           'As a precaution, all activated plugins have been deactivated.
    250 You must check for plugins upgrade before reactiving them.'
    251         );
    252       }
     240      deactivate_non_standard_plugins();
    253241    }
    254242
Note: See TracChangeset for help on using the changeset viewer.