Skip to content

Commit

Permalink
feature 2365 added: Piwigo version is written in the database (as
Browse files Browse the repository at this point in the history
"piwigo_db_version" in the config table). We only store the branch,
not the release : 2.3 and not 2.3.1, because database structure is
not changing between minor releases.


git-svn-id: http://piwigo.org/svn/trunk@11511 68402e56-0260-453c-a942-63ccdbb3a9ee
  • Loading branch information
plegall committed Jun 25, 2011
1 parent fa9b4f8 commit d9f8479
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
9 changes: 9 additions & 0 deletions include/common.inc.php
Expand Up @@ -132,6 +132,15 @@ function sanitize_mysql_kv(&$v, $k)
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');
Expand Down
9 changes: 9 additions & 0 deletions include/functions.inc.php
Expand Up @@ -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));
}
?>
2 changes: 2 additions & 0 deletions install.php
Expand Up @@ -339,6 +339,8 @@
\'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)
{
Expand Down
1 change: 1 addition & 0 deletions upgrade.php
Expand Up @@ -311,6 +311,7 @@ function print_time($message)
$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))
Expand Down

0 comments on commit d9f8479

Please sign in to comment.