Permalink
Browse files

Added 0.91 upgrade possibility. Made MV reinstalls and table indexes …

…reinstall optional on upgrade - they are rarely necessary when upgrading.
  • Loading branch information...
nimda562 nimda562
nimda562 authored and nimda562 committed Jul 10, 2011
1 parent 994e0ad commit 1c77a5079d136c40201329d199c6f08bb89364c2
Showing with 40 additions and 39 deletions.
  1. +1 −6 INSTALL
  2. +6 −5 lib/class_sqlcore.php
  3. +23 −16 lib/mysql.php
  4. +5 −2 lib/mysql_upgrade_queries.php
  5. +0 −10 lib/settings_default.php
  6. +5 −0 upgrade.php
View
@@ -10,12 +10,7 @@ UPGRADING
NOTE: When upgrading please save your old settings file(s) as a reference for when filling out the new settings file(s).
0.8 -> 0.9
Replace all OBBLM files.
Run the upgrade.php file from a web-browser.
0.75 -> 0.8
0.75 -> Any larger version
Replace all OBBLM files.
Run the upgrade.php file from a web-browser.
View
@@ -1297,17 +1297,18 @@ public static function installTableIndexes()
return $status;
}
public static function installMVs($delIfExists) {
public static function installMVs() {
global $core_tables;
$status = true;
foreach ($core_tables as $name => $tbl) {
if (!preg_match('/^mv\_/', $name))
continue;
if ($delIfExists) {
$status &= mysql_query("DROP TABLE IF EXISTS $name");
}
// Done in Table::createTable() automatically
#if ($delIfExists) {
# $status &= mysql_query("DROP TABLE IF EXISTS $name");
#}
$status &= Table::createTable($name,$core_tables[$name]);
}
@@ -1323,7 +1324,7 @@ public static function reviseEStables()
// Create tables if not existing:
# This will create all the ES MV (and regular, though not needed) tables with the correct up-to-date fields.
self::installMVs(true);
self::installMVs();
# Create, if not exists, the match_data_es table.
Table::createTableIfNotExists('match_data_es', $MDES);
View
@@ -785,11 +785,13 @@ function upgrade_database($version, $opts)
}
// Core
echo "<b>Running SQLs for core system upgrade...</b><br>\n";
echo "<b>Running tasks for core system upgrade...</b><br>\n";
echo (SQLCore::syncGameData())
? "<font color='green'>OK &mdash; Synchronized game data with database</font><br>\n"
: "<font color='red'>FAILED &mdash; Error whilst synchronizing game data with database</font><br>\n";
if ($upgradeSettings[$version]['sync_gamedata']) {
echo (SQLCore::syncGameData())
? "<font color='green'>OK &mdash; Synchronized game data with database</font><br>\n"
: "<font color='red'>FAILED &mdash; Error whilst synchronizing game data with database</font><br>\n";
}
echo (SQLCore::installProcsAndFuncs(true))
? "<font color='green'>OK &mdash; created MySQL functions/procedures</font><br>\n"
@@ -799,7 +801,8 @@ function upgrade_database($version, $opts)
$core_SQLs = $upgradeSQLs[$version];
$status = true;
foreach ($core_SQLs as $query) { $status &= (mysql_query($query) or die(mysql_error()."\n<br>SQL:\n<br>---\n<br>".$query));}
echo ($status) ? "<font color='green'>OK &mdash; Core SQLs</font><br>\n" : "<font color='red'>FAILED &mdash; Core SQLs</font><br>\n";
$cnt = "(".count($core_SQLs)." total)";
echo ($status) ? "<font color='green'>OK &mdash; Core SQLs</font> $cnt<br>\n" : "<font color='red'>FAILED &mdash; Core SQLs</font> $cnt<br>\n";
}
if (isset($upgradeFuncs[$version])) {
@@ -809,18 +812,22 @@ function upgrade_database($version, $opts)
echo ($status) ? "<font color='green'>OK &mdash; Custom PHP upgrade code (<i>".implode(', ',$core_Funcs)."</i>)</font><br>\n" : "<font color='red'>FAILED &mdash; Custom PHP upgrade code</font><br>\n";
}
echo (SQLCore::installMVs(false))
? "<font color='green'>OK &mdash; created MV tables</font><br>\n"
: "<font color='red'>FAILED &mdash; could not create MV tables</font><br>\n";
list($status,$added,$dropped) = SQLCore::reviseEStables();
echo ($status)
? "<font color='green'>OK &mdash; create/update ES tables</font><br>\n" . '<!-- DEV. INFO: Added new cols: '.implode(', ', $added).'. Removed cols: '.implode(', ', $dropped).'.-->'
: "<font color='red'>FAILED &mdash; create/update ES tables</font><br>\n";
if ($upgradeSettings[$version]['syncall']) {
echo (SQLCore::installMVs())
? "<font color='green'>OK &mdash; created MV tables</font><br>\n"
: "<font color='red'>FAILED &mdash; could not create MV tables</font><br>\n";
list($status,$added,$dropped) = SQLCore::reviseEStables();
echo ($status)
? "<font color='green'>OK &mdash; create/update ES tables</font><br>\n" . '<!-- DEV. INFO: Added new cols: '.implode(', ', $added).'. Removed cols: '.implode(', ', $dropped).'.-->'
: "<font color='red'>FAILED &mdash; create/update ES tables</font><br>\n";
}
echo (SQLCore::installTableIndexes())
? "<font color='green'>OK &mdash; applied table indexes</font><br>\n"
: "<font color='red'>FAILED &mdash; could not apply one more more table indexes</font><br>\n";
if ($upgradeSettings[$version]['reload_indexes']) {
echo (SQLCore::installTableIndexes())
? "<font color='green'>OK &mdash; applied table indexes</font><br>\n"
: "<font color='red'>FAILED &mdash; could not apply one more more table indexes</font><br>\n";
}
switch ($version) {
case '075-080':
@@ -5,6 +5,7 @@
*/
$upgradeSQLs = array(
'090-091' => array(),
'080-090' => array(
// UnAjusted (ua) values now stored too.
SQLUpgrade::runIfColumnNOTExists('players', 'ma_ua', 'ALTER TABLE players ADD COLUMN ma_ua TINYINT SIGNED'),
@@ -184,10 +185,12 @@ function upgrade_075_080_pskills_migrate()
If you don\'t do this the non-tied teams may not be scheduled to play in any matches!',
),
'080-090' => array(),
'090-091' => array(),
);
$upgradeSettings = array(
'075-080' => array('syncall' => true),
'080-090' => array('syncall' => false),
'075-080' => array('syncall' => true, 'sync_gamedata' => true, 'reload_indexes' => true),
'080-090' => array('syncall' => false, 'sync_gamedata' => false, 'reload_indexes' => false),
'090-091' => array('syncall' => false, 'sync_gamedata' => false, 'reload_indexes' => false),
);
?>
View
@@ -10,16 +10,6 @@
$settings['default_leagues'] = array(1);
$settings['hide_ES_extensions'] = false;
$rules['cost_apothecary'] = 50000;
$rules['cost_fan_factor'] = 10000;
$rules['cost_ass_coaches'] = 10000;
$rules['cost_cheerleaders'] = 10000;
$rules['value_reduction_ma'] = 0;
$rules['value_reduction_av'] = 0;
$rules['value_reduction_ag'] = 0;
$rules['value_reduction_st'] = 0;
$hrs = array();
?>
View
@@ -49,6 +49,11 @@
<form method="POST">
<table border='1' style='font-size:small; mergin: 5px;'>
<tr style='font-weight:bold;'><td></td><td>Version upgrade</td><td>Required upgrade parameters</td></tr>
<tr>
<td><INPUT TYPE=RADIO NAME="version" VALUE="090-091"></td>
<td>0.90 to 0.91</td>
<td><i>None</i></td>
</tr>
<tr>
<td><INPUT TYPE=RADIO NAME="version" VALUE="080-090"></td>
<td>0.80 to 0.90</td>

0 comments on commit 1c77a50

Please sign in to comment.