[CS-Project-svn_notify] SF.net SVN: cs-project: [860] trunk/1.2
Brought to you by:
crazedsanity
From: <cra...@us...> - 2008-03-30 06:25:44
|
Revision: 860 http://cs-project.svn.sourceforge.net/cs-project/?rev=860&view=rev Author: crazedsanity Date: 2008-03-29 23:25:40 -0700 (Sat, 29 Mar 2008) Log Message: ----------- Update setup to write proper config & remove setup config, give URL for user to go after setup, set constants & so forth properly. /includes/setup/5.inc: * when setting message, set linkURL as "/login" * __finalStep{}: -- __construct(): ++ use constant for config directory (instead of hard-coding lib). -- write_config(): ++ use constant for config filename instead of hard-coding. ++ use constant for config directory/config location... ++ update an error to be less misleading. ++ remove the setup config file. /lib/config.class.php: * get_config_contents(): -- ARG CHANGE: NEW ARG: #2 ($setConstants=FALSE) -- ARG CHANGE: NEW ARG: #3 ($setEverything=FALSE) -- set constants so getting config database parameters works properly. * remove_setup_config() [NEW]: -- method to destroy rw/setup.xml /lib/site_config.php: * call config::get_config_contents() with new arguments to set constants. Modified Paths: -------------- trunk/1.2/includes/setup/5.inc trunk/1.2/lib/config.class.php trunk/1.2/lib/site_config.php Modified: trunk/1.2/includes/setup/5.inc =================================================================== --- trunk/1.2/includes/setup/5.inc 2008-03-30 05:44:19 UTC (rev 859) +++ trunk/1.2/includes/setup/5.inc 2008-03-30 06:25:40 UTC (rev 860) @@ -11,8 +11,9 @@ $page->set_message_wrapper(array( 'title' => "Reloaded... ", - 'message' => "Result of writing the config file:<BR>\n". $writeConfigResult, - 'type' => "status" + 'message' => $writeConfigResult, + 'type' => "status", + 'linkURL' => '/login' )); $page->conditional_header("/setup/5", TRUE); } @@ -50,7 +51,7 @@ unset($this->stepData[5]); $this->gfObj = new cs_globalFunctions; - $this->fsObj = new cs_fileSystemClass(dirname(__FILE__) ."/../../lib"); + $this->fsObj = new cs_fileSystemClass(dirname(__FILE__) ."/../../". CONFIG_DIRECTORY); }//end __construct() //========================================================================= @@ -60,7 +61,7 @@ function write_config() { if($this->fsObj->is_writable(NULL)) { $lsData = $this->fsObj->ls(); - if(!is_array($lsData['config.xml'])) { + if(!is_array($lsData[CONFIG_FILENAME])) { $myData = array(); foreach($this->stepData as $stepNum=>$garbage) { $tempStepData = get_setup_data($stepNum, 'data'); @@ -86,8 +87,8 @@ //now, create an XML string... $xmlString = $xmlCreator->create_xml_string(); - $this->fsObj->create_file('config.xml', TRUE); - $writeRes = $this->fsObj->write($xmlString, 'config.xml'); + $this->fsObj->create_file(CONFIG_FILENAME, TRUE); + $writeRes = $this->fsObj->write($xmlString, CONFIG_FILENAME); if($writeRes > 0) { $retval = "Successfully created the XML config file"; @@ -99,13 +100,16 @@ } } else { - throw new exception(__METHOD__ .": config.xml already exists!"); + throw new exception(__METHOD__ .": ". CONFIG_FILE_LOCATION ." already exists!"); } } else { - throw new exception(__METHOD__ .": the lib directory is not writable!"); + throw new exception(__METHOD__ .": the config directory is not writable!"); } + $configObj = new config(CONFIG_FILE_LOCATION); + $configObj->remove_setup_config(); + return($retval); }//end write_config() //========================================================================= Modified: trunk/1.2/lib/config.class.php =================================================================== --- trunk/1.2/lib/config.class.php 2008-03-30 05:44:19 UTC (rev 859) +++ trunk/1.2/lib/config.class.php 2008-03-30 06:25:40 UTC (rev 860) @@ -43,7 +43,7 @@ /** * Get the contents of the config file. */ - public function get_config_contents($simple=TRUE) { + public function get_config_contents($simple=TRUE, $setConstants=FALSE, $setEverything=FALSE) { if($this->fileExists) { $xmlString = $this->fs->read($this->fileName); @@ -58,6 +58,26 @@ $config = $xmlParser->get_path('/CONFIG'); unset($config['type'], $config['attributes']); } + + if($setConstants) { + $myConfig = $config; + if(!$simple) { + $myConfig = $xmlParser->get_tree(TRUE); + $myConfig = $myConfig['CONFIG']; + } + $conditionallySet = array('VERSION_STRING', 'WORKINGONIT'); + foreach($myConfig as $index=>$value) { + if(in_array($index, $conditionallySet)) { + //only set this part if we're told to. + if($setEverything) { + define($index, $value); + } + } + else { + define($index, $value); + } + } + } } else { $config = NULL; @@ -270,5 +290,13 @@ return($this->siteStatus); }//end get_site_status() //------------------------------------------------------------------------- + + + + //------------------------------------------------------------------------- + public function remove_setup_config() { + return($this->fs->rm(SETUP_FILE_LOCATION)); + }//end remove_setup_config() + //------------------------------------------------------------------------- }//end config{} ?> \ No newline at end of file Modified: trunk/1.2/lib/site_config.php =================================================================== --- trunk/1.2/lib/site_config.php 2008-03-30 05:44:19 UTC (rev 859) +++ trunk/1.2/lib/site_config.php 2008-03-30 06:25:40 UTC (rev 860) @@ -85,6 +85,9 @@ if($configObj->is_setup_required()) { $configObj->do_setup_redirect(); } + else { + $configObj->get_config_contents(NULL,TRUE,TRUE); + } } else { //tell 'em what the site's status is. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |