aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/common.inc.php9
-rw-r--r--include/functions.inc.php9
-rw-r--r--install.php2
-rw-r--r--upgrade.php1
4 files changed, 21 insertions, 0 deletions
diff --git a/include/common.inc.php b/include/common.inc.php
index 048290e19..6081220e6 100644
--- a/include/common.inc.php
+++ b/include/common.inc.php
@@ -132,6 +132,15 @@ catch (Exception $e)
pwg_db_check_charset();
load_conf_from_db();
+
+if (!$conf['check_upgrade_feed'])
+{
+ if (!isset($conf['piwigo_db_version']) or $conf['piwigo_db_version'] != get_branch_from_version(PHPWG_VERSION))
+ {
+ redirect(get_root_url().'upgrade.php');
+ }
+}
+
load_plugins();
include(PHPWG_ROOT_PATH.'include/user.inc.php');
diff --git a/include/functions.inc.php b/include/functions.inc.php
index 7012db248..09ac3b668 100644
--- a/include/functions.inc.php
+++ b/include/functions.inc.php
@@ -1600,4 +1600,13 @@ function get_privacy_level_options()
}
return $options;
}
+
+
+/**
+ * return the branch from the version. For example version 2.2.4 is for branch 2.2
+ */
+function get_branch_from_version($version)
+{
+ return implode('.', array_slice(explode('.', $version), 0, 2));
+}
?> \ No newline at end of file
diff --git a/install.php b/install.php
index fe63248c6..29b2c86b5 100644
--- a/install.php
+++ b/install.php
@@ -339,6 +339,8 @@ INSERT INTO '.$prefixeTable.'config (param,value,comment)
\'a secret key specific to the gallery for internal use\');';
pwg_query($query);
+ conf_update_param('piwigo_db_version', get_branch_from_version(PHPWG_VERSION));
+
// fill languages table
foreach ($languages->fs_languages as $language_code => $fs_language)
{
diff --git a/upgrade.php b/upgrade.php
index 64f81964f..8257ba3fb 100644
--- a/upgrade.php
+++ b/upgrade.php
@@ -311,6 +311,7 @@ if ((isset($_POST['submit']) or isset($_GET['now']))
$page['upgrade_start'] = get_moment();
$conf['die_on_sql_error'] = false;
include($upgrade_file);
+ conf_update_param('piwigo_db_version', get_branch_from_version(PHPWG_VERSION));
// Something to add in database.inc.php?
if (!empty($mysql_changes))