Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/db_update.php b/db_update.php
- index 1afd920..2a5d9c8 100644
- --- a/db_update.php
- +++ b/db_update.php
- @@ -8,7 +8,10 @@
- // The FluxBB version this script updates to
- define('UPDATE_TO', '1.4-rc3');
- -define('UPDATE_TO_DB_REVISION', 5);
- +
- +define('UPDATE_TO_DB_REVISION', 6);
- +define('UPDATE_TO_SI_REVISION', 1);
- +define('UPDATE_TO_PARSER_REVISION', 1);
- define('MIN_PHP_VERSION', '4.3.0');
- define('MIN_MYSQL_VERSION', '4.1.2');
- @@ -128,7 +131,10 @@ while ($cur_config_item = $db->fetch_row($result))
- $pun_config[$cur_config_item[0]] = $cur_config_item[1];
- // Check the database revision and the current version
- -if (isset($pun_config['o_database_revision']) && $pun_config['o_database_revision'] >= UPDATE_TO_DB_REVISION && version_compare($pun_config['o_cur_version'], UPDATE_TO, '>='))
- +if (isset($pun_config['o_database_revision']) && $pun_config['o_database_revision'] >= UPDATE_TO_DB_REVISION &&
- + isset($pun_config['o_searchindex_revision']) && $pun_config['o_searchindex_revision'] >= UPDATE_TO_SI_REVISION &&
- + isset($pun_config['o_parser_revision']) && $pun_config['o_parser_revision'] >= UPDATE_TO_PARSER_REVISION &&
- + version_compare($pun_config['o_cur_version'], UPDATE_TO, '>='))
- exit('Your database is already as up-to-date as this script can make it.');
- $default_style = $pun_config['o_default_style'];
- @@ -508,7 +514,11 @@ if (strpos($cur_version, '1.2') === 0)
- // Start by updating the database structure
- case 'start':
- - $query_str = '?stage=pre_finish';
- + $query_str = '?stage=preparse_posts';
- +
- + // If we don't need to parse the sigs, skip this stage
- + if (isset($pun_config['o_database_revision']) && $pun_config['o_database_revision'] >= UPDATE_TO_DB_REVISION)
- + break;
- // Make all email fields VARCHAR(80)
- $db->alter_field('bans', 'email', 'VARCHAR(80)', true) or error('Unable to alter email field', __FILE__, __LINE__, $db->error());
- @@ -547,6 +557,14 @@ if (strpos($cur_version, '1.2') === 0)
- if (!array_key_exists('o_database_revision', $pun_config))
- $db->query('INSERT INTO '.$db->prefix.'config (conf_name, conf_value) VALUES (\'o_database_revision\', \'0\')') or error('Unable to insert config value \'o_database_revision\'', __FILE__, __LINE__, $db->error());
- + // Add search index revision number
- + if (!array_key_exists('o_searchindex_revision', $pun_config))
- + $db->query('INSERT INTO '.$db->prefix.'config (conf_name, conf_value) VALUES (\'o_searchindex_revision\', \'0\')') or error('Unable to insert config value \'o_searchindex_revision\'', __FILE__, __LINE__, $db->error());
- +
- + // Add parser revision number
- + if (!array_key_exists('o_parser_revision', $pun_config))
- + $db->query('INSERT INTO '.$db->prefix.'config (conf_name, conf_value) VALUES (\'o_parser_revision\', \'0\')') or error('Unable to insert config value \'o_parser_revision\'', __FILE__, __LINE__, $db->error());
- +
- // Add default email setting option
- if (!array_key_exists('o_default_email_setting', $pun_config))
- $db->query('INSERT INTO '.$db->prefix.'config (conf_name, conf_value) VALUES (\'o_default_email_setting\', \'1\')') or error('Unable to insert config value \'o_default_email_setting\'', __FILE__, __LINE__, $db->error());
- @@ -1243,21 +1261,14 @@ if (strpos($cur_version, '1.2') === 0)
- break;
- - // Check if we need to do any more work
- - case 'pre_finish':
- - $query_str = '?stage=finish';
- -
- - // If we are doing a major update we should preparse the posts and reindex everything
- - if (strpos($cur_version, substr(UPDATE_TO, 0, 3)) !== 0)
- - $query_str = '?stage=preparse_posts';
- -
- - break;
- -
- -
- // Preparse posts
- case 'preparse_posts':
- $query_str = '?stage=preparse_sigs';
- + // If we don't need to parse the posts, skip this stage
- + if (isset($pun_config['o_parser_revision']) && $pun_config['o_parser_revision'] >= UPDATE_TO_PARSER_REVISION)
- + break;
- +
- require PUN_ROOT.'include/parser.php';
- // Fetch posts to process this cycle
- @@ -1289,6 +1300,10 @@ if (strpos($cur_version, '1.2') === 0)
- case 'preparse_sigs':
- $query_str = '?stage=rebuild_idx';
- + // If we don't need to parse the sigs, skip this stage
- + if (isset($pun_config['o_parser_revision']) && $pun_config['o_parser_revision'] >= UPDATE_TO_PARSER_REVISION)
- + break;
- +
- require PUN_ROOT.'include/parser.php';
- // Fetch users to process this cycle
- @@ -1319,6 +1334,10 @@ if (strpos($cur_version, '1.2') === 0)
- case 'rebuild_idx':
- $query_str = '?stage=finish';
- + // If we don't need to update the search index, skip this stage
- + if (isset($pun_config['o_searchindex_revision']) && $pun_config['o_searchindex_revision'] >= UPDATE_TO_SI_REVISION)
- + break;
- +
- if ($start_at == 0)
- {
- // Truncate the tables just in-case we didn't already (if we are coming directly here without converting the tables)
- @@ -1380,6 +1399,12 @@ if (strpos($cur_version, '1.2') === 0)
- // And the database revision number
- $db->query('UPDATE '.$db->prefix.'config SET conf_value = \''.UPDATE_TO_DB_REVISION.'\' WHERE conf_name = \'o_database_revision\'') or error('Unable to update database revision number', __FILE__, __LINE__, $db->error());
- + // And the search index revision number
- + $db->query('UPDATE '.$db->prefix.'config SET conf_value = \''.UPDATE_TO_SI_REVISION.'\' WHERE conf_name = \'o_searchindex_revision\'') or error('Unable to update search index revision number', __FILE__, __LINE__, $db->error());
- +
- + // And the parser revision number
- + $db->query('UPDATE '.$db->prefix.'config SET conf_value = \''.UPDATE_TO_PARSER_REVISION.'\' WHERE conf_name = \'o_parser_revision\'') or error('Unable to update parser revision number', __FILE__, __LINE__, $db->error());
- +
- // This feels like a good time to synchronize the forums
- $result = $db->query('SELECT id FROM '.$db->prefix.'forums') or error('Unable to fetch forum IDs', __FILE__, __LINE__, $db->error());
- diff --git a/include/common.php b/include/common.php
- index 46d990f..951f951 100644
- --- a/include/common.php
- +++ b/include/common.php
- @@ -11,7 +11,10 @@ if (!defined('PUN_ROOT'))
- // Define the version and database revision that this code was written for
- define('FORUM_VERSION', '1.4-rc3');
- -define('FORUM_DB_REVISION', 5);
- +
- +define('FORUM_DB_REVISION', 6);
- +define('FORUM_SI_REVISION', 1);
- +define('FORUM_PARSER_REVISION', 1);
- // Block prefetch requests
- if (isset($_SERVER['HTTP_X_MOZ']) && $_SERVER['HTTP_X_MOZ'] == 'prefetch')
- @@ -113,7 +116,10 @@ if (!defined('PUN_CONFIG_LOADED'))
- }
- // Verify that we are running the proper database schema revision
- -if (!isset($pun_config['o_database_revision']) || $pun_config['o_database_revision'] < FORUM_DB_REVISION || version_compare($pun_config['o_cur_version'], FORUM_VERSION, '<'))
- +if (!isset($pun_config['o_database_revision']) || $pun_config['o_database_revision'] < FORUM_DB_REVISION ||
- + !isset($pun_config['o_searchindex_revision']) || $pun_config['o_searchindex_revision'] < FORUM_SI_REVISION ||
- + !isset($pun_config['o_parser_revision']) || $pun_config['o_parser_revision'] < FORUM_PARSER_REVISION ||
- + version_compare($pun_config['o_cur_version'], FORUM_VERSION, '<'))
- exit('Your FluxBB database is out-of-date and must be upgraded in order to continue. Please run <a href="'.PUN_ROOT.'db_update.php">db_update.php</a> in order to complete the upgrade process.');
- // Enable output buffering
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement