aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2012-06-15 21:17:55 +0000
committerplegall <plg@piwigo.org>2012-06-15 21:17:55 +0000
commit61f0f76ffa0345bb00a292feb060c26e7b4754a0 (patch)
tree921333f7127e5a973c7e6c153cd6c828dd0b0659
parente160f4f086d7e8869f025015419a815f694ea9c0 (diff)
feature 2654: forbid upgrade in case we find a remote site + dynamic message displayed from piwigo.org
git-svn-id: http://piwigo.org/svn/branches/2.3@15737 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--admin/themes/default/template/updates_pwg.tpl5
-rw-r--r--admin/updates_pwg.php29
2 files changed, 33 insertions, 1 deletions
diff --git a/admin/themes/default/template/updates_pwg.tpl b/admin/themes/default/template/updates_pwg.tpl
index 5b1bf3238..2b9d820c5 100644
--- a/admin/themes/default/template/updates_pwg.tpl
+++ b/admin/themes/default/template/updates_pwg.tpl
@@ -86,12 +86,17 @@ li { margin: 5px; }
<p><ul>{foreach from=$missing.themes item=theme}<li><a href="{$theme.uri}" class="externalLink">{$theme.name}</a></li>{/foreach}</ul><br></p>
{/if}
<p>
+
+{if isset($forbid_upgrade_message)}
+ {$forbid_upgrade_message}
+{else}
{if !empty($missing.plugins) or !empty($missing.themes)}
<p><label><input type="checkbox" name="understand"> &nbsp;{'I decide to update anyway'|@translate}</label></p>
{/if}
<p><input type="submit" name="submit" value="{'Update to Piwigo %s'|@translate|@sprintf:$UPGRADE_TO}" {if !empty($missing.plugins) or !empty($missing.themes)}disabled="disabled"{/if}>
</p>
<p class="autoupdate_bar" style="display:none;">&nbsp; {'Update in progress...'|@translate}<br><img src="admin/themes/default/images/ajax-loader-bar.gif"></p>
+{/if}
</fieldset>
<p><input type="hidden" name="upgrade_to" value="{$UPGRADE_TO}"></p>
diff --git a/admin/updates_pwg.php b/admin/updates_pwg.php
index 016deeecd..9b980d546 100644
--- a/admin/updates_pwg.php
+++ b/admin/updates_pwg.php
@@ -127,12 +127,39 @@ if ($step == 2 and is_webmaster())
// +-----------------------------------------------------------------------+
if ($step == 3 and is_webmaster())
{
+ // 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)
+ {
+ $url = PHPWG_URL.'/download/messages/upgrade24-remote-sites.php';
+ $url.= '?lang='.$user['language'];
+ $url.= '&rand='.md5(uniqid(rand(), true)); // Avoid server cache
+
+ $result = null;
+ if (@fetchRemote($url, $result))
+ {
+ $template->assign('forbid_upgrade_message', $result);
+ array_push($page['errors'], $result);
+ }
+ }
+
if (isset($_POST['dumpDatabase']))
{
updates::dump_database(isset($_POST['includeHistory']));
}
- if (isset($_POST['submit']) and isset($_POST['upgrade_to']))
+ if (!$has_remote_site and isset($_POST['submit']) and isset($_POST['upgrade_to']))
{
updates::upgrade_to($_POST['upgrade_to'], $step);
}