Changeset 15680 for trunk/upgrade.php


Ignore:
Timestamp:
Jun 14, 2012, 11:46:47 PM (12 years ago)
Author:
plg
Message:

feature 2632: add a test on upgrade.php, if a remote site is detected downgrade to 2.3.4

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/upgrade.php

    r15679 r15680  
    229229  )
    230230);
     231
     232// +-----------------------------------------------------------------------+
     233// | Remote sites are not compatible with Piwigo 2.4+                      |
     234// +-----------------------------------------------------------------------+
     235
     236$has_remote_site = false;
     237
     238$query = 'SELECT galleries_url FROM '.SITES_TABLE.';';
     239$result = pwg_query($query);
     240while ($row = pwg_db_fetch_assoc($result))
     241{
     242  if (url_is_remote($row['galleries_url']))
     243  {
     244    $has_remote_site = true;
     245  }
     246}
     247
     248if ($has_remote_site)
     249{
     250  include_once(PHPWG_ROOT_PATH.'admin/include/updates.class.php');
     251  include_once(PHPWG_ROOT_PATH.'admin/include/pclzip.lib.php');
     252
     253  $page['errors'] = array();
     254  $step = 3;
     255  updates::upgrade_to('2.3.4', $step, false);
     256
     257  if (!empty($page['errors']))
     258  {
     259    echo '<ul>';
     260    foreach ($page['errors'] as $error)
     261    {
     262      echo '<li>'.$error.'</li>';
     263    }
     264    echo '</ul>';
     265  }
     266
     267  exit();
     268}
    231269
    232270// +-----------------------------------------------------------------------+
Note: See TracChangeset for help on using the changeset viewer.