[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. |