Thread: [Cs-webapplibs-commits] SF.net SVN: cs-webapplibs:[151] trunk/0.3/cs_webdbupgrade.class.php
Status: Beta
Brought to you by:
crazedsanity
From: <cra...@us...> - 2009-09-21 15:25:08
|
Revision: 151 http://cs-webapplibs.svn.sourceforge.net/cs-webapplibs/?rev=151&view=rev Author: crazedsanity Date: 2009-09-21 15:25:00 +0000 (Mon, 21 Sep 2009) Log Message: ----------- Fix invalid RWDIR setting. /cs_webdbupgrade.class.php: * move creation of cs_fileSystem{} down lower * set default rwDir to be TWO levels below the current file... * create cs_fileSystem{} using constant SITE_ROOT Modified Paths: -------------- trunk/0.3/cs_webdbupgrade.class.php Modified: trunk/0.3/cs_webdbupgrade.class.php =================================================================== --- trunk/0.3/cs_webdbupgrade.class.php 2009-09-21 04:40:36 UTC (rev 150) +++ trunk/0.3/cs_webdbupgrade.class.php 2009-09-21 15:25:00 UTC (rev 151) @@ -90,7 +90,6 @@ } - $this->fsObj = new cs_fileSystem(constant('SITE_ROOT')); parent::__construct(true); if(defined('DEBUGPRINTOPT')) { $this->gfObj->debugPrintOpt = constant('DEBUGPRINTOPT'); @@ -115,7 +114,7 @@ } $this->set_version_file_location($versionFileLocation); - $rwDir = dirname(__FILE__) .'/../rw'; + $rwDir = dirname(__FILE__) .'/../../rw'; if(defined(__CLASS__ .'-RWDIR')) { $rwDir = constant(__CLASS__ .'-RWDIR'); } @@ -133,6 +132,7 @@ throw new exception(__METHOD__ .": failed to connect to database or logger error: ". $e->getMessage()); } + $this->fsObj = new cs_fileSystem(constant('SITE_ROOT')); if($this->check_lockfile()) { //there is an existing lockfile... throw new exception(__METHOD__ .": upgrade in progress: ". $this->fsObj->read($this->lockfile)); @@ -952,20 +952,25 @@ */ public function create_lockfile($contents) { if(!$this->check_lockfile()) { - if($this->fsObj->create_file($this->lockfile)) { - if(!preg_match('/\n$/', $contents)) { - $contents .= "\n"; + try { + if($this->fsObj->create_file($this->lockfile)) { + if(!preg_match('/\n$/', $contents)) { + $contents .= "\n"; + } + $writeRes = $this->fsObj->write($contents); + if(is_numeric($writeRes) && $writeRes > 0) { + $this->fsObj->closeFile(); + } + else { + $this->error_handler(__METHOD__ .": failed to write contents (". $contents .") to lockfile"); + } } - $writeRes = $this->fsObj->write($contents); - if(is_numeric($writeRes) && $writeRes > 0) { - $this->fsObj->closeFile(); - } else { - $this->error_handler(__METHOD__ .": failed to write contents (". $contents .") to lockfile"); + $this->error_handler(__METHOD__ .": failed to create lockfile (". $this->lockfile .")"); } } - else { - $this->error_handler(__METHOD__ .": failed to create lockfile (". $this->lockfile .")"); + catch(exception $e) { + throw new exception(__METHOD__ .": failed to create lockfile (". $this->lockfile ." [root=". $this->fsObj->root ."] with contents (". $contents .")::: ". $e->getMessage()); } } else { @@ -1081,4 +1086,4 @@ }//end upgrade{} -?> \ No newline at end of file +?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2009-09-21 15:52:58
|
Revision: 153 http://cs-webapplibs.svn.sourceforge.net/cs-webapplibs/?rev=153&view=rev Author: crazedsanity Date: 2009-09-21 15:52:46 +0000 (Mon, 21 Sep 2009) Log Message: ----------- Set version file location in cs_webdbupgrade::__construct() to avoid errors. Modified Paths: -------------- trunk/0.3/cs_webdbupgrade.class.php Modified: trunk/0.3/cs_webdbupgrade.class.php =================================================================== --- trunk/0.3/cs_webdbupgrade.class.php 2009-09-21 15:51:40 UTC (rev 152) +++ trunk/0.3/cs_webdbupgrade.class.php 2009-09-21 15:52:46 UTC (rev 153) @@ -69,6 +69,7 @@ public function __construct($versionFileLocation, $upgradeConfigFile, array $dbParams=null, $lockFile='upgrade.lock') { //setup configuration parameters for database connectivity. + $this->set_version_file_location(dirname(__FILE__) .'/VERSION'); if(!is_array($dbParams) || !count($dbParams)) { $prefix = preg_replace('/-/', '_', $this->get_project()); $dbParams = array( This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2009-11-17 01:54:49
|
Revision: 158 http://cs-webapplibs.svn.sourceforge.net/cs-webapplibs/?rev=158&view=rev Author: crazedsanity Date: 2009-11-17 01:54:40 +0000 (Tue, 17 Nov 2009) Log Message: ----------- Fix situation where database version is not returned. /cs_webdbupgrade.class.php: * get_database_version(): -- calls itself if it has to load the database tables. -- NOTE::: this could possibly cause an infinite loop or a deadlock if loading the database tables is done incorrectly (though I am not sure how to test for that scenario). Modified Paths: -------------- trunk/0.3/cs_webdbupgrade.class.php Modified: trunk/0.3/cs_webdbupgrade.class.php =================================================================== --- trunk/0.3/cs_webdbupgrade.class.php 2009-11-09 18:48:26 UTC (rev 157) +++ trunk/0.3/cs_webdbupgrade.class.php 2009-11-17 01:54:40 UTC (rev 158) @@ -543,9 +543,7 @@ //add the table... $loadTableResult = $this->load_table(); if($loadTableResult === TRUE) { - //now try the SQL... - $numrows = $this->db->exec($sql); - $dberror = $this->db->errorMsg(); + $retval = $this->get_database_version(); } else { $this->error_handler(__METHOD__ .": no table in database, failed to create one... ORIGINAL " . This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2010-03-09 19:09:05
|
Revision: 159 http://cs-webapplibs.svn.sourceforge.net/cs-webapplibs/?rev=159&view=rev Author: crazedsanity Date: 2010-03-09 19:08:59 +0000 (Tue, 09 Mar 2010) Log Message: ----------- Fix a potential recursion issue. Modified Paths: -------------- trunk/0.3/cs_webdbupgrade.class.php Modified: trunk/0.3/cs_webdbupgrade.class.php =================================================================== --- trunk/0.3/cs_webdbupgrade.class.php 2009-11-17 01:54:40 UTC (rev 158) +++ trunk/0.3/cs_webdbupgrade.class.php 2010-03-09 19:08:59 UTC (rev 159) @@ -543,7 +543,9 @@ //add the table... $loadTableResult = $this->load_table(); if($loadTableResult === TRUE) { - $retval = $this->get_database_version(); + //now try the SQL... + $numrows = $this->db->exec($sql); + $dberror = $this->db->errorMsg(); } else { $this->error_handler(__METHOD__ .": no table in database, failed to create one... ORIGINAL " . This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2010-06-15 02:07:45
|
Revision: 164 http://cs-webapplibs.svn.sourceforge.net/cs-webapplibs/?rev=164&view=rev Author: crazedsanity Date: 2010-06-15 02:07:39 +0000 (Tue, 15 Jun 2010) Log Message: ----------- Remove suspended logging, as the logger should be using a forcibly different connection (thus not subject to any transaction). Modified Paths: -------------- trunk/0.3/cs_webdbupgrade.class.php Modified: trunk/0.3/cs_webdbupgrade.class.php =================================================================== --- trunk/0.3/cs_webdbupgrade.class.php 2010-06-09 01:25:09 UTC (rev 163) +++ trunk/0.3/cs_webdbupgrade.class.php 2010-06-15 02:07:39 UTC (rev 164) @@ -320,7 +320,6 @@ //========================================================================= private function perform_upgrade() { - $this->logsObj->suspendLogging=true; //make sure there's not already a lockfile. if($this->upgrade_in_progress()) { //ew. Can't upgrade. @@ -393,12 +392,9 @@ $this->error_handler(__METHOD__ .": transaction status=(". $transactionStatus ."), upgrade aborted:::". $e->getMessage()); $this->db->rollbackTrans(); } - $this->logsObj->suspendLogging=false; $this->do_log("Upgrade process complete", 'end'); } } - $this->logsObj->suspendLogging=false; - $logsHandled = $this->logsObj->handle_suspended_logs(); }//end perform_upgrade() //========================================================================= This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |