aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--admin/include/updates.class.php8
-rw-r--r--upgrade.php38
2 files changed, 42 insertions, 4 deletions
diff --git a/admin/include/updates.class.php b/admin/include/updates.class.php
index 524b627a7..3a81fbb0f 100644
--- a/admin/include/updates.class.php
+++ b/admin/include/updates.class.php
@@ -359,11 +359,11 @@ class updates
}
}
- function upgrade_to($upgrade_to, &$step)
+ function upgrade_to($upgrade_to, &$step, $check_current_version=true)
{
global $page, $conf, $template;
- if (!version_compare($_POST['upgrade_to'], PHPWG_VERSION, '>'))
+ if ($check_current_version and !version_compare($upgrade_to, PHPWG_VERSION, '>'))
{
redirect(get_root_url().'admin.php?page=plugin-'.basename(dirname(__FILE__)));
}
@@ -371,14 +371,14 @@ class updates
if ($step == 2)
{
preg_match('/(\d+\.\d+)\.(\d+)/', PHPWG_VERSION, $matches);
- $code = $matches[1].'.x_to_'.$_POST['upgrade_to'];
+ $code = $matches[1].'.x_to_'.$upgrade_to;
$dl_code = str_replace(array('.', '_'), '', $code);
$remove_path = $code;
$obsolete_list = 'obsolete.list';
}
else
{
- $code = $_POST['upgrade_to'];
+ $code = $upgrade_to;
$dl_code = $code;
$remove_path = version_compare($code, '2.0.8', '>=') ? 'piwigo' : 'piwigo-'.$code;
$obsolete_list = PHPWG_ROOT_PATH.'install/obsolete.list';
diff --git a/upgrade.php b/upgrade.php
index 7bee609aa..b0edd7609 100644
--- a/upgrade.php
+++ b/upgrade.php
@@ -230,6 +230,44 @@ $template->assign(array(
);
// +-----------------------------------------------------------------------+
+// | Remote sites are not compatible with Piwigo 2.4+ |
+// +-----------------------------------------------------------------------+
+
+$has_remote_site = false;
+
+$query = 'SELECT galleries_url FROM '.SITES_TABLE.';';
+$result = pwg_query($query);
+while ($row = pwg_db_fetch_assoc($result))
+{
+ if (url_is_remote($row['galleries_url']))
+ {
+ $has_remote_site = true;
+ }
+}
+
+if ($has_remote_site)
+{
+ include_once(PHPWG_ROOT_PATH.'admin/include/updates.class.php');
+ include_once(PHPWG_ROOT_PATH.'admin/include/pclzip.lib.php');
+
+ $page['errors'] = array();
+ $step = 3;
+ updates::upgrade_to('2.3.4', $step, false);
+
+ if (!empty($page['errors']))
+ {
+ echo '<ul>';
+ foreach ($page['errors'] as $error)
+ {
+ echo '<li>'.$error.'</li>';
+ }
+ echo '</ul>';
+ }
+
+ exit();
+}
+
+// +-----------------------------------------------------------------------+
// | upgrade choice |
// +-----------------------------------------------------------------------+