Changeset 16312


Ignore:
Timestamp:
Jul 3, 2012, 12:28:07 AM (8 years ago)
Author:
plg
Message:

bug 2677 fixed: smarter check of the database version and manage partial upgrade.

Location:
branches/2.4
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/2.4/install/upgrade_2.3.0.php

    r15841 r16312  
    5353foreach ($to_apply as $upgrade_id)
    5454{
    55   if ($upgrade_id >= 98)
     55  if ($upgrade_id >= 112) // TODO change on each release
    5656  {
    5757    break;
     
    8484echo '<pre>';
    8585
    86 for ($upgrade_id = 112; $upgrade_id <= 127; $upgrade_id++)
     86for ($upgrade_id = 112; $upgrade_id <= 127; $upgrade_id++) // TODO change on each release
    8787{
    8888  if (!file_exists(UPGRADES_PATH.'/'.$upgrade_id.'-database.php'))
    8989  {
    90     break;
     90    continue;
     91  }
     92
     93  // maybe the upgrade task has already been applied in a previous and
     94  // incomplete upgrade
     95  if (in_array($upgrade_id, $applied))
     96  {
     97    continue;
    9198  }
    9299 
  • branches/2.4/upgrade.php

    r15680 r16312  
    323323  $current_release = '2.2.0';
    324324}
    325 else if (!in_array('coi', $columns_of[PREFIX_TABLE.'images']))
    326 {
    327   $current_release = '2.3.0';
    328 }
    329325else
    330326{
    331   die('No upgrade required, the database structure is up to date');
     327  // retrieve already applied upgrades
     328  $query = '
     329SELECT id
     330  FROM '.PREFIX_TABLE.'upgrade
     331;';
     332  $applied_upgrades = array_from_query($query, 'id');
     333
     334  if (!in_array(127, $applied_upgrades))
     335  {
     336    $current_release = '2.3.0';
     337  }
     338  else
     339  {
     340    // confirm that the database is in the same version as source code files
     341    conf_update_param('piwigo_db_version', get_branch_from_version(PHPWG_VERSION));
     342   
     343    echo 'No upgrade required, the database structure is up to date';
     344    echo '<br><a href="index.php">← back to gallery</a>';
     345    exit();
     346  }
    332347}
    333348
Note: See TracChangeset for help on using the changeset viewer.