[Cs-webdbupgrade-commits] SF.net SVN: cs-webdbupgrade:[19] trunk/0.1/cs_webdbupgrade.class.php
Status: Inactive
Brought to you by:
crazedsanity
From: <cra...@us...> - 2009-07-27 19:59:51
|
Revision: 19 http://cs-webdbupgrade.svn.sourceforge.net/cs-webdbupgrade/?rev=19&view=rev Author: crazedsanity Date: 2009-07-27 19:59:41 +0000 (Mon, 27 Jul 2009) Log Message: ----------- Fix so multiple inline upgrades work. /cs_webdbupgrade.class.php: * perform_upgrade(): -- logs total number of upgrades to be preformed -- logic for handling multiple upgrades vs. a single. * do_single_upgrade(): -- log the TARGET_VERSION instead of the matching (old) version. * get_upgrade_list(): -- use proper index of configuration so multiple inline upgrades work. Modified Paths: -------------- trunk/0.1/cs_webdbupgrade.class.php Modified: trunk/0.1/cs_webdbupgrade.class.php =================================================================== --- trunk/0.1/cs_webdbupgrade.class.php 2009-07-27 17:28:59 UTC (rev 18) +++ trunk/0.1/cs_webdbupgrade.class.php 2009-07-27 19:59:41 UTC (rev 19) @@ -281,7 +281,8 @@ try { $i=0; - $this->logsObj->log_by_class(__METHOD__ .": starting to run through the upgrade list, starting at (". $this->databaseVersion .")...", 'debug'); + $this->logsObj->log_by_class(__METHOD__ .": starting to run through the upgrade list, starting at (". $this->databaseVersion ."), " . + "total number of upgrades to perform: ". count($upgradeList), 'debug'); $this->db->beginTrans(__METHOD__); foreach($upgradeList as $fromVersion=>$toVersion) { @@ -295,12 +296,18 @@ $this->logsObj->log_by_class($details, 'system'); } - if($this->databaseVersion == $this->versionFileVersion) { - $this->logsObj->log_by_class(__METHOD__ .": finished upgrading after performing (". $i .") upgrades", 'debug'); - $this->newVersion = $this->databaseVersion; + if($i < count($upgradeList)) { + $this->logsObj->log_by_class(__METHOD__ .": completed upgrade ". $i ." of ". count($upgradeList), 'debug'); } else { - $this->error_handler(__METHOD__ .": finished upgrade, but version wasn't updated (expecting '". $this->versionFileVersion ."', got '". $this->databaseVersion ."')!!!"); + if($this->databaseVersion == $this->versionFileVersion) { + $this->logsObj->log_by_class(__METHOD__ .": finished upgrading after performing (". $i .") upgrades", 'debug'); + $this->newVersion = $this->databaseVersion; + } + else { + $this->logsObj->log_by_class(__METHOD__ .": upgradeList::: ". $this->gfObj->debug_print($upgradeList,0), 'debug'); + $this->error_handler(__METHOD__ .": finished upgrade, but version wasn't updated (expecting '". $this->versionFileVersion ."', got '". $this->databaseVersion ."')!!!"); + } } $this->remove_lockfile(); @@ -510,7 +517,7 @@ $this->error_handler(__METHOD__ .": target version not specified, unable to proceed with upgrade for ". $versionIndex); } } - $this->logsObj->log_by_class("Finished upgrade to ". $targetVersion, 'system'); + $this->logsObj->log_by_class("Finished upgrade to ". $upgradeData['TARGET_VERSION'], 'system'); }//end do_single_upgrade() //========================================================================= @@ -767,9 +774,9 @@ if(!$this->is_higher_version($dbVersion, $newVersion)) { $this->error_handler(__METHOD__ .": version (". $newVersion .") isn't higher than (". $dbVersion .")... something is broken"); } - elseif(is_array($this->config['MATCHING'])) { + elseif(is_array($this->config['UPGRADELIST']['MATCHING'])) { $lastVersion = $dbVersion; - foreach($this->config['MATCHING'] as $matchVersion=>$data) { + foreach($this->config['UPGRADELIST']['MATCHING'] as $matchVersion=>$data) { $matchVersion = preg_replace('/^V/', '', $matchVersion); if($matchVersion == $data['TARGET_VERSION']) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |