aboutsummaryrefslogtreecommitdiffstats
path: root/upgrade.php
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2012-06-14 21:46:47 +0000
committerplegall <plg@piwigo.org>2012-06-14 21:46:47 +0000
commitc89365f10e1703a08f33b1798bcaecd169aa8861 (patch)
treec9649a38f0a044d016d6d941230db9089fb97938 /upgrade.php
parent754a12881d7a4c9a5bdc4a3456cb704822688630 (diff)
feature 2632: add a test on upgrade.php, if a remote site is detected downgrade to 2.3.4
git-svn-id: http://piwigo.org/svn/trunk@15680 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--upgrade.php38
1 files changed, 38 insertions, 0 deletions
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 |
// +-----------------------------------------------------------------------+