cs-project-svn_notify Mailing List for CS-Project (Page 8)
Brought to you by:
crazedsanity
You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(65) |
Dec
(47) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(34) |
Feb
(82) |
Mar
(21) |
Apr
(12) |
May
(16) |
Jun
|
Jul
(6) |
Aug
(8) |
Sep
|
Oct
|
Nov
|
Dec
|
2009 |
Jan
(1) |
Feb
(52) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(9) |
Aug
(5) |
Sep
(12) |
Oct
(11) |
Nov
(4) |
Dec
(15) |
2010 |
Jan
|
Feb
|
Mar
(6) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(9) |
2012 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
From: <cra...@us...> - 2008-03-31 01:56:57
|
Revision: 866 http://cs-project.svn.sourceforge.net/cs-project/?rev=866&view=rev Author: crazedsanity Date: 2008-03-30 18:56:53 -0700 (Sun, 30 Mar 2008) Log Message: ----------- Modify BBCode & email template to show issue ancestry. FIXES ISSUE::: #146: Email notice -- display ancestry /templates/email/helpdesk-remark.tmpl: -- change template var from {name} to "[helpdesk_id={public_id}]" so it can be parsed by the BBCode parser. /lib/bbCodeParser.class.php: * get_helpdesk_bbcode(): -- adds linkage to parent project if one is set. Modified Paths: -------------- trunk/1.2/lib/bbCodeParser.class.php trunk/1.2/templates/email/helpdesk-remark.tmpl Modified: trunk/1.2/lib/bbCodeParser.class.php =================================================================== --- trunk/1.2/lib/bbCodeParser.class.php 2008-03-31 00:54:12 UTC (rev 865) +++ trunk/1.2/lib/bbCodeParser.class.php 2008-03-31 01:56:53 UTC (rev 866) @@ -69,8 +69,18 @@ $retval = '[helpdesk_id='. $helpdeskId .']'; if(is_numeric($helpdeskId)) { try { - $data = $this->helpdeskObj->get_record($helpdeskId); - $retval = '[<a href="http://'. PROJECT_URL .'/content/helpdesk/view?ID='. $helpdeskId .'">'. $data['name'] .'</a>]'; + $data = $this->helpdeskObj->get_record($helpdeskId); + $displayName = $data['name']; + + //add project linkage if there is any... + if($data['ancestry_level'] > 1) { + //pull the ancestry string. + $parentRecord = $this->projectObj->get_parent_record($data['ancestry']); + $x = $this->projectObj->get_ancestry_link_list($parentRecord['public_id'], TRUE, TRUE, TRUE); + $displayName = $x .' / <b>'. $displayName ."</b>"; + } + + $retval = '[<a href="http://'. PROJECT_URL .'/content/helpdesk/view?ID='. $helpdeskId .'">'. $displayName .'</a>]'; } catch(exception $e) { debug_print($e->getMessage); Modified: trunk/1.2/templates/email/helpdesk-remark.tmpl =================================================================== --- trunk/1.2/templates/email/helpdesk-remark.tmpl 2008-03-31 00:54:12 UTC (rev 865) +++ trunk/1.2/templates/email/helpdesk-remark.tmpl 2008-03-31 01:56:53 UTC (rev 866) @@ -12,7 +12,7 @@ </tr> <tr> <th>Name of Issue:</th> - <td><pre>{name}</pre></td> + <td><pre>[helpdesk_id={public_id}]</pre></td> </tr> <tr> <th>Submitted by:</th> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-03-31 00:54:14
|
Revision: 865 http://cs-project.svn.sourceforge.net/cs-project/?rev=865&view=rev Author: crazedsanity Date: 2008-03-30 17:54:12 -0700 (Sun, 30 Mar 2008) Log Message: ----------- *** RELEASE 1.1.4 *** Fixed critical bug in mainRecord{} (issue #165) Modified Paths: -------------- releases/1.1/VERSION Modified: releases/1.1/VERSION =================================================================== --- releases/1.1/VERSION 2008-03-31 00:53:47 UTC (rev 864) +++ releases/1.1/VERSION 2008-03-31 00:54:12 UTC (rev 865) @@ -1,4 +1,4 @@ $Id:VERSION 628 2007-11-20 16:58:45Z crazedsanity $ -VERSION: 1.1.3 +VERSION: 1.1.4 $HeadURL:https://cs-project.svn.sourceforge.net/svnroot/cs-project/trunk/VERSION $ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-03-31 00:53:50
|
Revision: 864 http://cs-project.svn.sourceforge.net/cs-project/?rev=864&view=rev Author: crazedsanity Date: 2008-03-30 17:53:47 -0700 (Sun, 30 Mar 2008) Log Message: ----------- *** RELEASE 1.1.4 *** Fixed critical bug in mainRecord{} (issue #165) Modified Paths: -------------- trunk/1.1/VERSION Modified: trunk/1.1/VERSION =================================================================== --- trunk/1.1/VERSION 2008-03-30 22:13:52 UTC (rev 863) +++ trunk/1.1/VERSION 2008-03-31 00:53:47 UTC (rev 864) @@ -1,4 +1,4 @@ $Id:VERSION 628 2007-11-20 16:58:45Z crazedsanity $ -VERSION: 1.1.3 +VERSION: 1.1.4 $HeadURL:https://cs-project.svn.sourceforge.net/svnroot/cs-project/trunk/VERSION $ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-03-30 22:13:57
|
Revision: 863 http://cs-project.svn.sourceforge.net/cs-project/?rev=863&view=rev Author: crazedsanity Date: 2008-03-30 15:13:52 -0700 (Sun, 30 Mar 2008) Log Message: ----------- Fix a logic error when retrieving record_id from an ancestry string with 0 parents. FIXES ISSUE::: #165: Fatal error retrieving tod records on issue with root-level ancestry SVN COMMAND: merge -r861:862 https://cs-project.svn.sourceforge.net/svnroot/cs-project/trunk/1. /lib/mainRecordClass.php: * get_parent_from_ancestry(): -- extra check check so if there are no ":" characters in the ancestry string, but $goBackLevels is 0 (given the ancestry string is numeric), it will simply return the value of the given string. Modified Paths: -------------- releases/1.1/lib/mainRecordClass.php Modified: releases/1.1/lib/mainRecordClass.php =================================================================== --- releases/1.1/lib/mainRecordClass.php 2008-03-30 22:03:03 UTC (rev 862) +++ releases/1.1/lib/mainRecordClass.php 2008-03-30 22:13:52 UTC (rev 863) @@ -597,6 +597,9 @@ } } } + elseif(!preg_match('/:/', $ancestryString) && is_numeric($ancestryString)) { + $retval = $ancestryString; + } return($retval); }//end get_parent_from_ancestry() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-03-30 22:03:35
|
Revision: 862 http://cs-project.svn.sourceforge.net/cs-project/?rev=862&view=rev Author: crazedsanity Date: 2008-03-30 15:03:03 -0700 (Sun, 30 Mar 2008) Log Message: ----------- Backport for issue #165 (no exception if retval is non-numeric). FIXES ISSUE::: #165: Fatal error retrieving tod records on issue with root-level ancestry /lib/mainRecordClass.php: * get_parent_from_ancestry(): -- extra check check so if there are no ":" characters in the ancestry string, but $goBackLevels is 0 (given the ancestry string is numeric), it will simply return the value of the given string. Modified Paths: -------------- trunk/1.1/lib/mainRecordClass.php Modified: trunk/1.1/lib/mainRecordClass.php =================================================================== --- trunk/1.1/lib/mainRecordClass.php 2008-03-30 21:52:11 UTC (rev 861) +++ trunk/1.1/lib/mainRecordClass.php 2008-03-30 22:03:03 UTC (rev 862) @@ -597,6 +597,9 @@ } } } + elseif(!preg_match('/:/', $ancestryString) && is_numeric($ancestryString)) { + $retval = $ancestryString; + } return($retval); }//end get_parent_from_ancestry() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-03-30 21:52:23
|
Revision: 861 http://cs-project.svn.sourceforge.net/cs-project/?rev=861&view=rev Author: crazedsanity Date: 2008-03-30 14:52:11 -0700 (Sun, 30 Mar 2008) Log Message: ----------- Fix a logic error when retrieving record_id from an ancestry string with 0 parents. FIXES ISSUE::: #165: Fatal error retrieving tod records on issue with root-level ancestry /lib/mainRecordClass.php: * get_parent_from_ancestry(): -- extra check check so if there are no ":" characters in the ancestry string, but $goBackLevels is 0 (given the ancestry string is numeric), it will simply return the value of the given string. -- NOTE: at present, this method will throw an exception if the final return value isn't numeric. Modified Paths: -------------- trunk/1.2/lib/mainRecordClass.php Modified: trunk/1.2/lib/mainRecordClass.php =================================================================== --- trunk/1.2/lib/mainRecordClass.php 2008-03-30 06:25:40 UTC (rev 860) +++ trunk/1.2/lib/mainRecordClass.php 2008-03-30 21:52:11 UTC (rev 861) @@ -600,7 +600,14 @@ } } } + elseif(!preg_match('/:/', $ancestryString) && is_numeric($ancestryString)) { + $retval = $ancestryString; + } + if(!is_numeric($retval)) { + throw new exception(__METHOD__ .": failed to get ancestry from (". $ancestryString .")"); + } + return($retval); }//end get_parent_from_ancestry() //========================================================================= This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
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. |
From: <cra...@us...> - 2008-03-30 05:44:21
|
Revision: 859 http://cs-project.svn.sourceforge.net/cs-project/?rev=859&view=rev Author: crazedsanity Date: 2008-03-29 22:44:19 -0700 (Sat, 29 Mar 2008) Log Message: ----------- Implemented config::check_site_status() to determine if site is okay, locked, going through setup by another user, or if the current user has locked the setup. /lib/config.class.php: * MAIN::: -- NEW PROPERTY: siteStatus -- NEW PROPERTY: setupRequired=FALSE -- NEW PROPERTY: config * __construct(): -- run check to ensure the CONFIG_DIRECTORY (rw) is writable; if it's not, throw an exception. -- read the config file into $this->config * do_setup_redirect() -- only do a redirect if site status is okay, setup is required, and the current URL isn't /setup. -- call create_setup_config() to create /rw/setup.xml, so we know who is running the setup. * check_site_status(): -- updated header. -- always check if there's an old config; if there is, copy it to the rw directory & delete the old file. -- intelligent checks: if there's a setup file, site status is only good if the current user is the owner. -- if the config file exists, make sure the site isn't locked. -- if there's no config, site status is good & setupRequired is set. * is_workingonit_set() [NEW]: -- determines if the "WORKINGONIT" section of the site config has caused the site to be locked or not. * setup_config_exists() [NEW]: -- determines if setup is already being run, optionally saying if the current user owns the setup process. -- NOTE: the check for ownership should probably be moved to another method for sanity's sake. * is_setup_required() [NEW]: -- returns the value of the private property "setupRequired". * create_setup_config() [NEW]: -- create a setup config file (rw/setup.xml). * get_site_status() [NEW]: -- return the value of the private property "siteStatus". /lib/site_config.php: * define where and what the setup config file is. * turn on error reporting. * when creating config{}, pass CONFIG_FILE_LOCATION instead of deriving it. * use config::check_site_status() to determine if it needs to be setup, has already been setup, setup running by other users, etc. * removed an old global SITE_ROOT setting for CLI scripts. Modified Paths: -------------- trunk/1.2/lib/config.class.php trunk/1.2/lib/site_config.php Modified: trunk/1.2/lib/config.class.php =================================================================== --- trunk/1.2/lib/config.class.php 2008-03-30 04:08:45 UTC (rev 858) +++ trunk/1.2/lib/config.class.php 2008-03-30 05:44:19 UTC (rev 859) @@ -8,8 +8,10 @@ private $gf; private $fileExists; - + private $siteStatus; + private $setupRequired = FALSE; private $fileName; + private $config; //------------------------------------------------------------------------- public function __construct($fileName=NULL) { @@ -27,6 +29,11 @@ else { $this->fileExists = TRUE; } + + if(!$this->fs->is_writable(CONFIG_DIRECTORY)) { + throw new exception(__METHOD__ .": the config directory (". CONFIG_DIRECTORY .") isn't writable!"); + } + $this->config = $this->get_config_contents(TRUE); }//end __construct() //------------------------------------------------------------------------- @@ -93,23 +100,17 @@ //------------------------------------------------------------------------- public function do_setup_redirect() { - if(!preg_match('/^setup/', $_SERVER['REQUEST_URI']) && !$_SESSION[SESSION_SETUP_KEY]) { - - //set something in the session so we know. - if(!isset($_SESSION[SESSION_SETUP_KEY])) { - $_SESSION[SESSION_SETUP_KEY]++; + if($this->check_site_status() && $this->setupRequired) { + if(!($_SERVER['SCRIPT_NAME'] == '/setup')) { + $this->gf->debug_print("script_name check=(". ($_SERVER['script_name'] != '/setup') .")", 1); + $goHere = '/setup'; + if(strlen($_SERVER['REQUEST_URI']) > 1 && !isset($_SESSION['setup__viewed'])) { + $goHere .= '?from='. urlencode($_SERVER['REQUEST_URI']); + } + $_SESSION['setup_redirect'] = time(); + $this->create_setup_config(); + $this->gf->conditional_header($goHere); } - else { - throw new exception(__METHOD__ .": setup key (". SESSION_SETUP_KEY .") found in session already"); - } - - - $goHere = '/setup'; - - if(strlen($_SERVER['REQUEST_URI']) > 1) { - $goHere .= '?from='. urlencode($_SERVER['REQUEST_URI']); - } - $this->gf->conditional_header($goHere); } }//end do_setup_redirect() //------------------------------------------------------------------------- @@ -129,86 +130,145 @@ * TODO: instead of a ton of returns, just set true/false for return, and have internal message explaining what's up. * * @return TRUE OK: display normal page (no upgrade/setup needed/running) - * @return 1 OK: setup required (perform redirect) - * @return 2 OK: setup initiated by current user (display setup page) - * @return 3 ERROR: setup initiated by OTHER user (show "setup running" error) - * @return 4 OK: upgrade required (starts upgrade process, then displays normal page) - * @return 5 ERROR: upgrade started by other user (show temporary "upgrade in progress" message, set reload timer) + * @return FALSE FAIL: somebody else is running setup, or the site is otherwise locked. */ public function check_site_status() { - //============================================================= - //BEGIN pseudo code: - //-------------------------------------------------- + //check for the OLD config file. + /** + * WHY THE CHECK IS HERE::: + * + * The setup system expects that the config file exists in the location + * specified by CONFIG_FILE_LOCATION; if it's not there, the site_config + * will assume setup must be run... so we have to circumvent that + * behaviour right here. + */ + if(file_exists(OLD_CONFIG_FILE_LOCATION)) { + //copy old file to new location... + if(!$this->fs->copy_file(OLD_CONFIG_FILE_LOCATION, CONFIG_FILE_LOCATION)) { + throw new exception(__METHOD__ .": failed to copy existing config into new location"); + } + $this->fs->rm(OLD_CONFIG_FILE_LOCATION); + } - if($this->configFileExists()) { + if($this->setup_config_exists()) { + if($this->setup_config_exists(TRUE)) { + //the currently logged-in user is actually running the setup, no worries. + $this->siteStatus = 'You are running setup... please continue.'; + $this->setupRequired = TRUE; + $retval = TRUE; + } + else { + //tell 'em somebody is working on setup and to WAIT. + $this->siteStatus = 'Setup is in progress by another user. Please wait.'; + $retval = FALSE; + } + } + elseif($this->fileExists) { //got an existing config file. - if($this->isWorkingOnItSet()) { - //site access is locked (probably an upgrade); get the message and show 'em. - $retval = $this->isWorkingOnItSet(TRUE); - $this->showFatalError($retval); + if($this->is_workingonit_set()) { + //site access is locked; get the message and show 'em. + $this->siteStatus = $this->is_workingonit_set(TRUE); + $retval = $this->siteStatus; } - elseif($this->setupConfigExists()) { - if($this->setupConfigExists() === 'current_user') { - //the currently logged-in user is actually running the setup, no worries. - $retval = 'undergoing setup by current user'; - } - else { - //tell 'em somebody is working on setup and to WAIT. - $retval = $this->showSetupMessage(); - } - } else { //config exists, site not locked... GOOD TO GO! - $retval = $this->setOkay(); + $this->siteStatus = 'Normal (site is setup).'; + $retval = TRUE; } } else { - //check for the OLD config file. - if($this->oldConfigFileExists()) { - //copy old file to new location... - $this->copyOldConfigFile(); + //good to go! + $this->siteStatus = 'No existing config or setup file: you may initiate the setup process now.'; + $this->setupRequired = TRUE; + $retval = TRUE; + } + + return($retval); + + }//end check_site_status() + //------------------------------------------------------------------------- + + + + //------------------------------------------------------------------------- + private function is_workingonit_set($giveValue=FALSE) { + if((is_numeric($this->config['WORKINGONIT']) && $this->config['WORKINGONIT'] == 0) || ($this->config['WORKINGONIT'] === FALSE)) { + $retval = FALSE; + } + else { + $retval = TRUE; + } + + if($giveValue === TRUE) { + $retval = $this->config['WORKINGONIT']; + } + + return($retval); + }//end is_workingonit_set() + //------------------------------------------------------------------------- + + + + //------------------------------------------------------------------------- + public function setup_config_exists($checkOwnership=FALSE) { + $retval = FALSE; + + $dirContents = $this->fs->ls(CONFIG_DIRECTORY); + if($dirContents[SETUP_FILENAME]) { + $retval = TRUE; + + if($checkOwnership === TRUE) { + //read the object. + $xmlParser = new xmlParser($this->fs->read(SETUP_FILE_LOCATION)); + $configData = $xmlParser->get_tree(TRUE); + $configData = $configData['CONFIG']; - //now check if the site is locked. - if($this->isWorkingOnItSet()) { - //upgrade running. Show 'em the message. - $retval = $this->isWorkingOnItSet(TRUE); - $this->showFatalError($retval); + //now that we've got the data, determine if the current user is the owner. + if($configData['OWNER_SESSION'] === session_id()) { + $retval = TRUE; } - elseif($this->setupConfigExists()) { - //SETUP IN PROGRESS... - - if($this->setupConfigExists() === 'current_user') { - //the currently logged-in user is actually running the setup, no worries. - $retval = 'undergoing setup by current user'; - } - else { - //tell 'em somebody is working on setup and to WAIT. - $retval = $this->showSetupMessage(); - } - } else { - //good to go! - $retval=$this->setOkay(); + $retval = FALSE; } } - else { - //okay, no config file (new or old), no setup running, so current user has option - // to run setup (viewing the page not enough; must click something to create the - // setup config file which locks setup to their session) - $this->do_setup_redirect(); - } } return($retval); - //-------------------------------------------------- - //END pseudo code; - //============================================================= + }//end setup_config_exists() + //------------------------------------------------------------------------- + + + + //------------------------------------------------------------------------- + public function is_setup_required() { + return($this->setupRequired); + }//end is_setup_required() + //------------------------------------------------------------------------- + + + + //------------------------------------------------------------------------- + private function create_setup_config() { + $xmlCreator = new xmlCreator('config'); + $attributes = array( + 'creation' => time() + ); + $xmlCreator->add_tag('/config/owner_session', session_id(), $attributes); - }//end check_site_status() + $this->fs->create_file(SETUP_FILE_LOCATION); + $this->fs->write($xmlCreator->create_xml_string()); + }//end create_setup_config() //------------------------------------------------------------------------- + + + //------------------------------------------------------------------------- + public function get_site_status() { + return($this->siteStatus); + }//end get_site_status() + //------------------------------------------------------------------------- }//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 04:08:45 UTC (rev 858) +++ trunk/1.2/lib/site_config.php 2008-03-30 05:44:19 UTC (rev 859) @@ -25,9 +25,10 @@ require_once(dirname(__FILE__) .'/config.class.php'); define(CONFIG_FILENAME, 'config.xml'); +define(SETUP_FILENAME, 'setup.xml'); define(CONFIG_DIRECTORY, 'rw'); define(CONFIG_FILE_LOCATION, CONFIG_DIRECTORY .'/'. CONFIG_FILENAME); -define(SESSION_SETUP_KEY, '___setup_key___'); +define(SETUP_FILE_LOCATION, CONFIG_DIRECTORY .'/'. SETUP_FILENAME); //location where the config file USED to be, for the purpose of upgrading from previous versions. define(OLD_CONFIG_DIRECTORY, 'lib'); @@ -39,6 +40,7 @@ //TODO: turn off if it's not a dev site, but NOT if setup is running (so they can see problems). ini_set('error_reporting', 'On'); ini_set('display_errors', 'On'); +error_reporting(E_ALL && ~E_NOTICE); //########################################################################## function exception_handler($exception) { $exceptionMessage = $exception->getMessage(); @@ -72,14 +74,24 @@ //########################################################################## -$configObj = new config(dirname(__FILE__) .'/'. CONFIG_FILENAME, FALSE); -$configObj->read_config_file(TRUE, TRUE); +$configObj = new config(CONFIG_FILE_LOCATION, FALSE); check_external_lib_versions(); //call a method to see if setup should run. -$configObj->check_site_status(); +unset($_SESSION['setup_redirect']); +if($configObj->check_site_status()) { + if($configObj->is_setup_required()) { + $configObj->do_setup_redirect(); + } +} +else { + //tell 'em what the site's status is. + //TODO: make this look nicer. + echo($configObj->get_site_status()); + exit; +} if($_SERVER['DOCUMENT_ROOT']) { @@ -89,7 +101,7 @@ } else { //called from the command line. - $GLOBALS['SITE_ROOT'] = $_SERVER['HOME'] ."/partslogistics2002"; + $GLOBALS['SITE_ROOT'] = $_SERVER['HOME']; } $GLOBALS['LIBDIR']=$GLOBALS['SITE_ROOT'] . "/lib"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-03-30 04:08:47
|
Revision: 858 http://cs-project.svn.sourceforge.net/cs-project/?rev=858&view=rev Author: crazedsanity Date: 2008-03-29 21:08:45 -0700 (Sat, 29 Mar 2008) Log Message: ----------- Consolidated all upgrades into 1.2.0-ALPHA4, removed previous upgrade scripts. Modified Paths: -------------- trunk/1.2/upgrade/upgrade.xml trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA4.php Removed Paths: ------------- trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA2.php trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA3.php Modified: trunk/1.2/upgrade/upgrade.xml =================================================================== --- trunk/1.2/upgrade/upgrade.xml 2008-03-28 05:16:39 UTC (rev 857) +++ trunk/1.2/upgrade/upgrade.xml 2008-03-30 04:08:45 UTC (rev 858) @@ -19,17 +19,11 @@ in an unstable state. Unstable is bad, m'kay?</system_note> <matching> - <v1.2.0-ALPHA1> - <target_version>1.2.0-ALPHA2</target_version> - <script_name>upgradeTo1.2.0-ALPHA2.php</script_name> - <class_name>upgrade_to_1_2_0_ALPHA2</class_name> + <v1.2.0-ALPHA3> + <target_version>1.2.0-ALPHA4</target_version> + <script_name>upgradeTo1.2.0-ALPHA4.php</script_name> + <class_name>upgrade_to_1_2_0_ALPHA4</class_name> <call_method>run_upgrade</call_method> - </v1.2.0-ALPHA1> - <v1.2.0-ALPHA2> - <target_version>1.2.0-ALPHA3</target_version> - <script_name>upgradeTo1.2.0-ALPHA3.php</script_name> - <class_name>upgrade_to_1_2_0_ALPHA3</class_name> - <call_method>run_upgrade</call_method> - </v1.2.0-ALPHA2> + </v1.2.0-ALPHA3> </matching> </upgrade> Deleted: trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA2.php =================================================================== --- trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA2.php 2008-03-28 05:16:39 UTC (rev 857) +++ trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA2.php 2008-03-30 04:08:45 UTC (rev 858) @@ -1,95 +0,0 @@ -<?php -/* - * Created on Nov 20, 2007 - */ - - -class upgrade_to_1_2_0_ALPHA2 extends dbAbstract { - - private $logsObj; - - //========================================================================= - public function __construct(cs_phpDB &$db) { - if(!$db->is_connected()) { - throw new exception(__METHOD__ .": database is not connected"); - } - $this->db = $db; - - $this->logsObj = new logsClass($this->db, 'Upgrade'); - - $this->gfObj = new cs_globalFunctions; - $this->gfObj->debugPrintOpt = DEBUGPRINTOPT; - }//end __construct() - //========================================================================= - - - - //========================================================================= - public function run_upgrade() { - - - $this->db->beginTrans(__METHOD__); - - $this->run_schema_changes(); - $this->update_tag_icons(); - - $this->db->commitTrans(__METHOD__); - - }//end run_upgrade() - //========================================================================= - - - - //========================================================================= - private function run_schema_changes() { - - $this->gfObj->debug_print(__METHOD__ .": running SQL file..."); - $this->run_sql_file(dirname(__FILE__) .'/../docs/sql/upgrades/upgradeTo1.2.0-ALPHA2.sql'); - - $details = "Executed SQL file, '". $this->lastSQLFile ."'. Encoded contents::: ". - base64_encode($this->fsObj->read($this->lastSQLFile)); - $this->logsObj->log_by_class($details, 'system'); - }//end run_schema_changes() - //========================================================================= - - - - //========================================================================= - private function update_tag_icons() { - - $sql = "SELECT tag_name_id, name, icon_name FROM tag_name_table ORDER BY tag_name_id"; - if($this->run_sql($sql) && $this->lastNumrows > 1) { - $allTags = $this->db->farray_fieldnames('name', 'tag_name_id'); - - $iconMods = array( - 'critical' => 'red_x', - 'bug' => 'bug', - 'feature request' => 'feature_request', - 'committed' => 'check_red', - 'verified' => 'check_yellow', - 'released' => 'check_green' - ); - - $updates = 0; - foreach($iconMods as $name=>$icon) { - if(isset($allTags[$name])) { - //update. - $sql = "UPDATE tag_name_table SET icon_name='". $icon ."' WHERE tag_name_id=". $allTags[$name]['tag_name_id']; - } - else { - //insert. - $sql = "INSERT INTO tag_name_table (name, icon_name) VALUES ('". $name ."', '". $icon ."');"; - } - $this->run_sql($sql); - $updates += $this->lastNumrows; - } - } - else { - throw new exception(__METHOD__ .": failed to retrieve tag names"); - } - - }//end update_tag_modifiers() - //========================================================================= -} - -?> Deleted: trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA3.php =================================================================== --- trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA3.php 2008-03-28 05:16:39 UTC (rev 857) +++ trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA3.php 2008-03-30 04:08:45 UTC (rev 858) @@ -1,86 +0,0 @@ -<?php -/* - * Created on February 08, 2008 - */ - - -class upgrade_to_1_2_0_ALPHA3 extends dbAbstract { - - private $logsObj; - - //========================================================================= - public function __construct(cs_phpDB &$db) { - if(!$db->is_connected()) { - throw new exception(__METHOD__ .": database is not connected"); - } - $this->db = $db; - - $this->logsObj = new logsClass($this->db, 'Upgrade'); - - $this->gfObj = new cs_globalFunctions; - $this->gfObj->debugPrintOpt = 1; - }//end __construct() - //========================================================================= - - - - //========================================================================= - public function run_upgrade() { - - $this->update_config_file(); - - return('Upgrade complete'); - }//end run_upgrade() - //========================================================================= - - - - //========================================================================= - public function update_config_file() { - $fs = new cs_fileSystemClass(dirname(__FILE__) .'/../'); - $sampleXmlObj = new XMLParser($fs->read('docs/samples/sample_config.xml')); - $siteXmlObj = new XMLParser($fs->read(CONFIG_FILE_LOCATION)); - - $updateXml = new xmlCreator(); - $updateXml->load_xmlparser_data($siteXmlObj); - - - //BACKUP ORIGINAL XML CONFIG... - $backupFile = 'lib/__BACKUP__'. time() .'__'. CONFIG_FILENAME; - $fs->create_file($backupFile); - $fs->openFile($backupFile); - $fs->write($updateXml->create_xml_string()); - - $sampleIndexes = $sampleXmlObj->get_tree(TRUE); - $sampleIndexes = $sampleIndexes['CONFIG']; - - $siteConfigIndexes = $siteXmlObj->get_tree(TRUE); - $siteConfigIndexes = $siteConfigIndexes['CONFIG']; - - foreach($sampleIndexes as $indexName=>$indexValue) { - $path = '/CONFIG/'. $indexName; - $attributes = $sampleXmlObj->get_attribute($path); - #debug_print(__METHOD__ .": attributes from sample (/CONFIG/". $indexName ."::: ",1); - #debug_print($attributes,1); - debug_print(__METHOD__ .': indexName=('. $indexName .'), indexValue=('. $indexValue .'), original config value=('. $siteConfigIndexes[$indexName] .')'); - - //add tag if it's not there, update values otherwise. - $tagValue = $attributes['DEFAULT']; - if(isset($siteConfigIndexes[$indexName])) { - $tagValue = $siteConfigIndexes[$indexName]; - } - elseif($indexName == 'PHPMAILER_HOST' && isset($siteConfigIndexes['CONFIG_EMAIL_SERVER_IP'])) { - $tagValue = $siteConfigIndexes['CONFIG_EMAIL_SERVER_IP']; - $updateXml->remove_path('/CONFIG/CONFIG_EMAIL_SERVER_IP'); - } - $updateXml->add_tag($path, $tagValue, $attributes); - } - - $this->gfObj->debug_print($this->gfObj->cleanString($updateXml->create_xml_string(), 'htmlentity_plus_brackets')); - $fs->openFile(CONFIG_FILE_LOCATION); - $fs->write($updateXml->create_xml_string()); - }//end update_config_file() - //========================================================================= -} - -?> Modified: trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA4.php =================================================================== --- trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA4.php 2008-03-28 05:16:39 UTC (rev 857) +++ trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA4.php 2008-03-30 04:08:45 UTC (rev 858) @@ -1,10 +1,6 @@ <?php -/* - * Created on February 08, 2008 - */ - -class upgrade_to_1_2_0_ALPHA3 extends dbAbstract { +class upgrade_to_1_2_0_ALPHA4 extends dbAbstract { private $logsObj; @@ -27,8 +23,16 @@ //========================================================================= public function run_upgrade() { + $this->db->beginTrans(__METHOD__); + + + $this->run_schema_changes(); + $this->update_tag_icons(); $this->update_config_file(); + + $this->db->commitTrans(__METHOD__); + return('Upgrade complete'); }//end run_upgrade() //========================================================================= @@ -36,35 +40,102 @@ //========================================================================= + private function run_schema_changes() { + + $this->gfObj->debug_print(__METHOD__ .": running SQL file..."); + $this->run_sql_file(dirname(__FILE__) .'/../docs/sql/upgrades/upgradeTo1.2.0-ALPHA2.sql'); + + $details = "Executed SQL file, '". $this->lastSQLFile ."'. Encoded contents::: ". + base64_encode($this->fsObj->read($this->lastSQLFile)); + $this->logsObj->log_by_class($details, 'system'); + }//end run_schema_changes() + //========================================================================= + + + + //========================================================================= + private function update_tag_icons() { + + $sql = "SELECT tag_name_id, name, icon_name FROM tag_name_table ORDER BY tag_name_id"; + if($this->run_sql($sql) && $this->lastNumrows > 1) { + $allTags = $this->db->farray_fieldnames('name', 'tag_name_id'); + + $iconMods = array( + 'critical' => 'red_x', + 'bug' => 'bug', + 'feature request' => 'feature_request', + 'committed' => 'check_red', + 'verified' => 'check_yellow', + 'released' => 'check_green' + ); + + $updates = 0; + foreach($iconMods as $name=>$icon) { + if(isset($allTags[$name])) { + //update. + $sql = "UPDATE tag_name_table SET icon_name='". $icon ."' WHERE tag_name_id=". $allTags[$name]['tag_name_id']; + } + else { + //insert. + $sql = "INSERT INTO tag_name_table (name, icon_name) VALUES ('". $name ."', '". $icon ."');"; + } + $this->run_sql($sql); + $updates += $this->lastNumrows; + } + } + else { + throw new exception(__METHOD__ .": failed to retrieve tag names"); + } + + }//end update_tag_modifiers() + //========================================================================= + + + + //========================================================================= public function update_config_file() { $fs = new cs_fileSystemClass(dirname(__FILE__) .'/../'); + $sampleXmlObj = new XMLParser($fs->read('docs/samples/sample_config.xml')); + $siteXmlObj = new XMLParser($fs->read(CONFIG_FILE_LOCATION)); - $configFileContents = $fs->read(CONFIG_FILE_LOCATION); + $updateXml = new xmlCreator(); + $updateXml->load_xmlparser_data($siteXmlObj); - //TODO: test that /rw is readable & writable - //TODO: write to new config file location - //TODO: delete old config file - /* - * PROBLEMS WITH MOVING THE CONFIG FILE: - * 1.) upgrades currently won't survive (through multiple version updates) - * if the config location changes, since it is statically set. - * - * 2.) upgrades from 1.1 MUST be able to work automatically. - * - * 3.) upgrades MUST BE SURVIVABLE through multiple version changes (see #1) - * - * SOLUTION: - * - * TODO: add "trigger" to check for old config file; if old config exists, bypass setup & go to upgrade. - * TODO: remove support for pre-alpha4 installs - * TODO: consolidate pre-alpha4 changes into alpha4 upgrade - * TODO: warn existing developers of changes and how to manually upgrade (update to r{x}, let setup run, update db + VERSION file) - * - * NOTE: while it might cause headaches for one or two developers, this - * minimizes pain for users upgrading from previous versions. Yay. - */ + //BACKUP ORIGINAL XML CONFIG... + $backupFile = 'lib/__BACKUP__'. time() .'__'. CONFIG_FILENAME; + $fs->create_file($backupFile); + $fs->openFile($backupFile); + $fs->write($updateXml->create_xml_string()); + $sampleIndexes = $sampleXmlObj->get_tree(TRUE); + $sampleIndexes = $sampleIndexes['CONFIG']; + + $siteConfigIndexes = $siteXmlObj->get_tree(TRUE); + $siteConfigIndexes = $siteConfigIndexes['CONFIG']; + + foreach($sampleIndexes as $indexName=>$indexValue) { + $path = '/CONFIG/'. $indexName; + $attributes = $sampleXmlObj->get_attribute($path); + #debug_print(__METHOD__ .": attributes from sample (/CONFIG/". $indexName ."::: ",1); + #debug_print($attributes,1); + debug_print(__METHOD__ .': indexName=('. $indexName .'), indexValue=('. $indexValue .'), original config value=('. $siteConfigIndexes[$indexName] .')'); + + //add tag if it's not there, update values otherwise. + $tagValue = $attributes['DEFAULT']; + if(isset($siteConfigIndexes[$indexName])) { + $tagValue = $siteConfigIndexes[$indexName]; + } + elseif($indexName == 'PHPMAILER_HOST' && isset($siteConfigIndexes['CONFIG_EMAIL_SERVER_IP'])) { + $tagValue = $siteConfigIndexes['CONFIG_EMAIL_SERVER_IP']; + $updateXml->remove_path('/CONFIG/CONFIG_EMAIL_SERVER_IP'); + } + $updateXml->add_tag($path, $tagValue, $attributes); + } + + $this->gfObj->debug_print($this->gfObj->cleanString($updateXml->create_xml_string(), 'htmlentity_plus_brackets')); + $fs->openFile(CONFIG_FILE_LOCATION); + $fs->write($updateXml->create_xml_string()); }//end update_config_file() //========================================================================= } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-03-28 05:16:41
|
Revision: 857 http://cs-project.svn.sourceforge.net/cs-project/?rev=857&view=rev Author: crazedsanity Date: 2008-03-27 22:16:39 -0700 (Thu, 27 Mar 2008) Log Message: ----------- Old site config constant, thoughts + pseudo-code for config::check_site_status(). Modified Paths: -------------- trunk/1.2/lib/config.class.php trunk/1.2/lib/site_config.php Modified: trunk/1.2/lib/config.class.php =================================================================== --- trunk/1.2/lib/config.class.php 2008-03-27 04:43:00 UTC (rev 856) +++ trunk/1.2/lib/config.class.php 2008-03-28 05:16:39 UTC (rev 857) @@ -117,35 +117,96 @@ //------------------------------------------------------------------------- + /** + * Determines if the site is a fresh install, undergoing setup, being + * upgraded (by someone else), or good to go. + * + * @param (void) No parameters accepted + * + * TODO: make this actually WORK. + * TODO: match actual returns with those specified below + * TODO: implement a "reload timer" so the page with do a meta-refresh after X minutes/seconds (make sure any POST vars are retained!!!) + * TODO: instead of a ton of returns, just set true/false for return, and have internal message explaining what's up. + * + * @return TRUE OK: display normal page (no upgrade/setup needed/running) + * @return 1 OK: setup required (perform redirect) + * @return 2 OK: setup initiated by current user (display setup page) + * @return 3 ERROR: setup initiated by OTHER user (show "setup running" error) + * @return 4 OK: upgrade required (starts upgrade process, then displays normal page) + * @return 5 ERROR: upgrade started by other user (show temporary "upgrade in progress" message, set reload timer) + */ public function check_site_status() { - if(!defined("PROJECT__INITIALSETUP") || PROJECT__INITIALSETUP !== TRUE) { - $this->do_setup_redirect(); - $config = $this->read_config_file(FALSE); + + //============================================================= + //BEGIN pseudo code: + //-------------------------------------------------- + + + if($this->configFileExists()) { + //got an existing config file. - if(($config['WORKINGONIT'] != "0" && strlen($config['WORKINGONIT'])) || strlen($config['WORKINGONIT']) > 1) { - //TODO: consider making this look prettier... - $details = "The website/database is under construction... try back in a bit."; - if(preg_match('/upgrade/i', $config['WORKINGONIT'])) { - $details = "<b>Upgrade in progress</b>: ". $config['WORKINGONIT']; + if($this->isWorkingOnItSet()) { + //site access is locked (probably an upgrade); get the message and show 'em. + $retval = $this->isWorkingOnItSet(TRUE); + $this->showFatalError($retval); + } + elseif($this->setupConfigExists()) { + if($this->setupConfigExists() === 'current_user') { + //the currently logged-in user is actually running the setup, no worries. + $retval = 'undergoing setup by current user'; } - elseif(strlen($config['WORKINGONIT']) > 1) { - $details .= "MORE INFORMATION::: ". $config['WORKINGONIT']; + else { + //tell 'em somebody is working on setup and to WAIT. + $retval = $this->showSetupMessage(); } - throw new exception($details); } else { - //don't panic: we're going to check for upgrades, but this doesn't - // necessarily mean anything will ACTUALLY be upgraded. - $upgrade = new upgrade; - if($upgrade->upgrade_in_progress()) { - throw new exception("Upgrade in progress... reload the page after a few minutes and it should be complete. :) "); + //config exists, site not locked... GOOD TO GO! + $retval = $this->setOkay(); + } + } + else { + //check for the OLD config file. + if($this->oldConfigFileExists()) { + //copy old file to new location... + $this->copyOldConfigFile(); + + //now check if the site is locked. + if($this->isWorkingOnItSet()) { + //upgrade running. Show 'em the message. + $retval = $this->isWorkingOnItSet(TRUE); + $this->showFatalError($retval); } + elseif($this->setupConfigExists()) { + //SETUP IN PROGRESS... + + if($this->setupConfigExists() === 'current_user') { + //the currently logged-in user is actually running the setup, no worries. + $retval = 'undergoing setup by current user'; + } + else { + //tell 'em somebody is working on setup and to WAIT. + $retval = $this->showSetupMessage(); + } + } else { - $upgrade->check_versions(); + //good to go! + $retval=$this->setOkay(); } - $this->read_config_file(TRUE); } + else { + //okay, no config file (new or old), no setup running, so current user has option + // to run setup (viewing the page not enough; must click something to create the + // setup config file which locks setup to their session) + $this->do_setup_redirect(); + } } + + return($retval); + //-------------------------------------------------- + //END pseudo code; + //============================================================= + }//end check_site_status() //------------------------------------------------------------------------- Modified: trunk/1.2/lib/site_config.php =================================================================== --- trunk/1.2/lib/site_config.php 2008-03-27 04:43:00 UTC (rev 856) +++ trunk/1.2/lib/site_config.php 2008-03-28 05:16:39 UTC (rev 857) @@ -29,6 +29,11 @@ define(CONFIG_FILE_LOCATION, CONFIG_DIRECTORY .'/'. CONFIG_FILENAME); define(SESSION_SETUP_KEY, '___setup_key___'); +//location where the config file USED to be, for the purpose of upgrading from previous versions. +define(OLD_CONFIG_DIRECTORY, 'lib'); +define(OLD_CONFIG_FILENAME, CONFIG_FILENAME); +define(OLD_CONFIG_FILE_LOCATION, OLD_CONFIG_DIRECTORY .'/'. OLD_CONFIG_FILENAME); + set_exception_handler('exception_handler'); //TODO: turn off if it's not a dev site, but NOT if setup is running (so they can see problems). This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-03-27 04:43:07
|
Revision: 856 http://cs-project.svn.sourceforge.net/cs-project/?rev=856&view=rev Author: crazedsanity Date: 2008-03-26 21:43:00 -0700 (Wed, 26 Mar 2008) Log Message: ----------- More thoughts on the upgrade, plus "rw" directory for reading & writing stuff. Modified Paths: -------------- trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA4.php Added Paths: ----------- trunk/1.2/rw/ Property changes on: trunk/1.2/rw ___________________________________________________________________ Name: svn:ignore + *.xml Modified: trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA4.php =================================================================== --- trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA4.php 2008-03-27 04:34:34 UTC (rev 855) +++ trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA4.php 2008-03-27 04:43:00 UTC (rev 856) @@ -41,57 +41,30 @@ $configFileContents = $fs->read(CONFIG_FILE_LOCATION); + //TODO: test that /rw is readable & writable + //TODO: write to new config file location + //TODO: delete old config file + /* - * PROBLEM: the config file MUST be readable in the specified location... - * once it is moved, the site config needs to be updated to point at the - * new location... we could throw an error here, explaining that the - * file needs to be moved manually, but if the user upgrades to the NEXT - * version, the system would believe that there's a problem because the - * config file would be MISSING (they'd have to go through setup all over - * again, even though they have an existing WORKING db)... + * PROBLEMS WITH MOVING THE CONFIG FILE: + * 1.) upgrades currently won't survive (through multiple version updates) + * if the config location changes, since it is statically set. * - * STEPS THAT NEED TO OCCUR::: - * 1.) move the config file to /rw/config.xml from /lib/config.xml - * 2.) ensure the site_config points to the CURRENT config file - * OPTIONS: - * a.) set "trigger" to look for old config when rw/config.xml - * is missing & do the proper change (must be set prior - * to the upgrade/setup system checks) - * ++ ALPHA3 -> ALPHA4 would work - * -- potentially breaks future upgrades - * -- bypasses upgrade system - * b.) scriptify direct modification of the site_config.php file - * so it points to the new location during this upgrade - * ++ ALPHA3 -> ALPHA4 would work - * ++ doesn't bypass upgrade system - * c.) drop all auto-upgrades prior to this one (ALPHA4), with - * moving the config file being the FIRST step, then run - * ALL other changes; it's an ALPHA, so things are - * expected to possibly be hairy. - * -- developers running pre-ALPHA4 will have problems - * ++ ALPHA3 -> ALPHA4 would work - * ++ doesn't bypass upgrade system - * 3.) systems upgrading from 1.1 must be able to do so automatically. + * 2.) upgrades from 1.1 MUST be able to work automatically. * - * PROBLEMS: - * 1.) setup MUST know where current config file is: if it is pointing - * to the NEW location and it exists in the OLD, setup will run; if it - * is pointing to the OLD location but it's in the NEW, setup will run. - * a.) if 1.2 (post-ALPHA4) always expects config to be in the new - * location, those caught in the mix can just manually move it - * to the new location - * b.) no reason to believe it would EVER point to the old location - * when there's one in the new location. + * 3.) upgrades MUST BE SURVIVABLE through multiple version changes (see #1) * + * SOLUTION: * + * TODO: add "trigger" to check for old config file; if old config exists, bypass setup & go to upgrade. * TODO: remove support for pre-alpha4 installs * TODO: consolidate pre-alpha4 changes into alpha4 upgrade * TODO: warn existing developers of changes and how to manually upgrade (update to r{x}, let setup run, update db + VERSION file) + * + * NOTE: while it might cause headaches for one or two developers, this + * minimizes pain for users upgrading from previous versions. Yay. */ - $this->gfObj->debug_print($this->gfObj->cleanString($updateXml->create_xml_string(), 'htmlentity_plus_brackets')); - $fs->openFile(CONFIG_FILE_LOCATION); - $fs->write($updateXml->create_xml_string()); }//end update_config_file() //========================================================================= } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-03-27 04:34:36
|
Revision: 855 http://cs-project.svn.sourceforge.net/cs-project/?rev=855&view=rev Author: crazedsanity Date: 2008-03-26 21:34:34 -0700 (Wed, 26 Mar 2008) Log Message: ----------- Temporary (non-working) script to upgrade to ALPHA4 with thoughts about moving the config file. Added Paths: ----------- trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA4.php Copied: trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA4.php (from rev 854, trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA3.php) =================================================================== --- trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA4.php (rev 0) +++ trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA4.php 2008-03-27 04:34:34 UTC (rev 855) @@ -0,0 +1,99 @@ +<?php +/* + * Created on February 08, 2008 + */ + + +class upgrade_to_1_2_0_ALPHA3 extends dbAbstract { + + private $logsObj; + + //========================================================================= + public function __construct(cs_phpDB &$db) { + if(!$db->is_connected()) { + throw new exception(__METHOD__ .": database is not connected"); + } + $this->db = $db; + + $this->logsObj = new logsClass($this->db, 'Upgrade'); + + $this->gfObj = new cs_globalFunctions; + $this->gfObj->debugPrintOpt = 1; + }//end __construct() + //========================================================================= + + + + //========================================================================= + public function run_upgrade() { + + $this->update_config_file(); + + return('Upgrade complete'); + }//end run_upgrade() + //========================================================================= + + + + //========================================================================= + public function update_config_file() { + $fs = new cs_fileSystemClass(dirname(__FILE__) .'/../'); + + $configFileContents = $fs->read(CONFIG_FILE_LOCATION); + + /* + * PROBLEM: the config file MUST be readable in the specified location... + * once it is moved, the site config needs to be updated to point at the + * new location... we could throw an error here, explaining that the + * file needs to be moved manually, but if the user upgrades to the NEXT + * version, the system would believe that there's a problem because the + * config file would be MISSING (they'd have to go through setup all over + * again, even though they have an existing WORKING db)... + * + * STEPS THAT NEED TO OCCUR::: + * 1.) move the config file to /rw/config.xml from /lib/config.xml + * 2.) ensure the site_config points to the CURRENT config file + * OPTIONS: + * a.) set "trigger" to look for old config when rw/config.xml + * is missing & do the proper change (must be set prior + * to the upgrade/setup system checks) + * ++ ALPHA3 -> ALPHA4 would work + * -- potentially breaks future upgrades + * -- bypasses upgrade system + * b.) scriptify direct modification of the site_config.php file + * so it points to the new location during this upgrade + * ++ ALPHA3 -> ALPHA4 would work + * ++ doesn't bypass upgrade system + * c.) drop all auto-upgrades prior to this one (ALPHA4), with + * moving the config file being the FIRST step, then run + * ALL other changes; it's an ALPHA, so things are + * expected to possibly be hairy. + * -- developers running pre-ALPHA4 will have problems + * ++ ALPHA3 -> ALPHA4 would work + * ++ doesn't bypass upgrade system + * 3.) systems upgrading from 1.1 must be able to do so automatically. + * + * PROBLEMS: + * 1.) setup MUST know where current config file is: if it is pointing + * to the NEW location and it exists in the OLD, setup will run; if it + * is pointing to the OLD location but it's in the NEW, setup will run. + * a.) if 1.2 (post-ALPHA4) always expects config to be in the new + * location, those caught in the mix can just manually move it + * to the new location + * b.) no reason to believe it would EVER point to the old location + * when there's one in the new location. + * + * + * TODO: remove support for pre-alpha4 installs + * TODO: consolidate pre-alpha4 changes into alpha4 upgrade + * TODO: warn existing developers of changes and how to manually upgrade (update to r{x}, let setup run, update db + VERSION file) + */ + + $this->gfObj->debug_print($this->gfObj->cleanString($updateXml->create_xml_string(), 'htmlentity_plus_brackets')); + $fs->openFile(CONFIG_FILE_LOCATION); + $fs->write($updateXml->create_xml_string()); + }//end update_config_file() + //========================================================================= +} + +?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-03-27 02:50:53
|
Revision: 854 http://cs-project.svn.sourceforge.net/cs-project/?rev=854&view=rev Author: crazedsanity Date: 2008-03-26 19:50:51 -0700 (Wed, 26 Mar 2008) Log Message: ----------- Use new CONFIG_FILE_LOCATION instead of hard-coding the config filename's location. Modified Paths: -------------- trunk/1.2/includes/setup.inc trunk/1.2/templates/content/settings/admin.content.tmpl trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA3.php Modified: trunk/1.2/includes/setup.inc =================================================================== --- trunk/1.2/includes/setup.inc 2008-03-27 02:50:15 UTC (rev 853) +++ trunk/1.2/includes/setup.inc 2008-03-27 02:50:51 UTC (rev 854) @@ -9,7 +9,7 @@ * Repository Location: $HeadURL:https://cs-project.svn.sourceforge.net/svnroot/cs-project/trunk/includes/setup.inc $ * Last Updated:::::::: $Date:2007-11-20 11:04:59 -0600 (Tue, 20 Nov 2007) $ * - * TODO: check for the existence of the /lib/config.xml file + * TODO: check for the existence of the config file (CONFIG_FILE_LOCATION) * TODO: if the config.xml exists, check if the database connection works, and if we can get ANY version data: if so, give fatal message saying it won't work. * TODO: if step 2 is re-run, do something to reset the status/accessibility of the other steps. */ Modified: trunk/1.2/templates/content/settings/admin.content.tmpl =================================================================== --- trunk/1.2/templates/content/settings/admin.content.tmpl 2008-03-27 02:50:15 UTC (rev 853) +++ trunk/1.2/templates/content/settings/admin.content.tmpl 2008-03-27 02:50:51 UTC (rev 854) @@ -12,7 +12,7 @@ <div class="note" style="width:60em"><b>NOTE:</b> You should be <font color="red"><b>absolutely certain</b></font> of the effects of the changes you make here. Changing an item to an incorrect value make render the installation useless. To rectify a broken configuration, you would need to modify the - <b>/lib/config.xml</b> file manually.</div> + <b>{CONFIG_FILE_LOCATION}</b> file manually.</div> </td> </tr> <tr> Modified: trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA3.php =================================================================== --- trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA3.php 2008-03-27 02:50:15 UTC (rev 853) +++ trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA3.php 2008-03-27 02:50:51 UTC (rev 854) @@ -39,14 +39,14 @@ public function update_config_file() { $fs = new cs_fileSystemClass(dirname(__FILE__) .'/../'); $sampleXmlObj = new XMLParser($fs->read('docs/samples/sample_config.xml')); - $siteXmlObj = new XMLParser($fs->read('lib/config.xml')); + $siteXmlObj = new XMLParser($fs->read(CONFIG_FILE_LOCATION)); $updateXml = new xmlCreator(); $updateXml->load_xmlparser_data($siteXmlObj); //BACKUP ORIGINAL XML CONFIG... - $backupFile = 'lib/__BACKUP__'. time() .'__config.xml'; + $backupFile = 'lib/__BACKUP__'. time() .'__'. CONFIG_FILENAME; $fs->create_file($backupFile); $fs->openFile($backupFile); $fs->write($updateXml->create_xml_string()); @@ -77,7 +77,7 @@ } $this->gfObj->debug_print($this->gfObj->cleanString($updateXml->create_xml_string(), 'htmlentity_plus_brackets')); - $fs->openFile('lib/config.xml'); + $fs->openFile(CONFIG_FILE_LOCATION); $fs->write($updateXml->create_xml_string()); }//end update_config_file() //========================================================================= This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-03-27 02:50:19
|
Revision: 853 http://cs-project.svn.sourceforge.net/cs-project/?rev=853&view=rev Author: crazedsanity Date: 2008-03-26 19:50:15 -0700 (Wed, 26 Mar 2008) Log Message: ----------- Use new constant for config file location, better error. Modified Paths: -------------- trunk/1.2/lib/upgradeClass.php Modified: trunk/1.2/lib/upgradeClass.php =================================================================== --- trunk/1.2/lib/upgradeClass.php 2008-03-27 02:49:13 UTC (rev 852) +++ trunk/1.2/lib/upgradeClass.php 2008-03-27 02:50:15 UTC (rev 853) @@ -68,7 +68,7 @@ if($this->upgrade_in_progress()) { throw new exception(__METHOD__ .": upgrade in progress"); } - elseif(!file_exists(dirname(__FILE__) .'/'. CONFIG_FILENAME)) { + elseif(!file_exists(CONFIG_FILE_LOCATION)) { throw new exception(__METHOD__ .": config.xml file missing"); } elseif(!file_exists(dirname(__FILE__) .'/../VERSION')) { @@ -147,7 +147,7 @@ $retval = NULL; if(!is_array($config) || !count($config)) { - throw new exception(__METHOD__ .": constant CONFIG_FILENAME not present, can't locate config xml file"); + throw new exception(__METHOD__ .": no configuration data available (missing config file?)"); } else { //now, let's see if there's a "version_string" index. @@ -203,7 +203,7 @@ $this->gfObj->debug_print(__METHOD__ .": result of setting 'upgrade in progress': (". $lockConfig .")"); //check to see if our config file is writable. - if(!$this->fsObj->is_writable("lib/config.xml")) { + if(!$this->fsObj->is_writable(CONFIG_FILE_LOCATION)) { throw new exception(__METHOD__ .": config file isn't writable!"); } @@ -625,7 +625,7 @@ //========================================================================= private function update_config_file($index, $value) { $gf = new cs_globalFunctions; - $myConfigFile = 'lib/'. CONFIG_FILENAME; + $myConfigFile = CONFIG_FILE_LOCATION; $fs = new cs_fileSystemClass(dirname(__FILE__) .'/../'); $xmlParser = new XMLParser($fs->read($myConfigFile)); $xmlCreator = new XMLCreator; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-03-27 02:49:17
|
Revision: 852 http://cs-project.svn.sourceforge.net/cs-project/?rev=852&view=rev Author: crazedsanity Date: 2008-03-26 19:49:13 -0700 (Wed, 26 Mar 2008) Log Message: ----------- Set some constants to define where the config file is, set template vars for it as well. Modified Paths: -------------- trunk/1.2/lib/site_config.php Modified: trunk/1.2/lib/site_config.php =================================================================== --- trunk/1.2/lib/site_config.php 2008-03-26 20:12:57 UTC (rev 851) +++ trunk/1.2/lib/site_config.php 2008-03-27 02:49:13 UTC (rev 852) @@ -25,10 +25,15 @@ require_once(dirname(__FILE__) .'/config.class.php'); define(CONFIG_FILENAME, 'config.xml'); +define(CONFIG_DIRECTORY, 'rw'); +define(CONFIG_FILE_LOCATION, CONFIG_DIRECTORY .'/'. CONFIG_FILENAME); define(SESSION_SETUP_KEY, '___setup_key___'); set_exception_handler('exception_handler'); +//TODO: turn off if it's not a dev site, but NOT if setup is running (so they can see problems). +ini_set('error_reporting', 'On'); +ini_set('display_errors', 'On'); //########################################################################## function exception_handler($exception) { $exceptionMessage = $exception->getMessage(); @@ -93,7 +98,8 @@ $GLOBALS['templateVars'] = array( "PHP_SELF" => $_SERVER['PHP_SELF'], "cs-content_version" => VERSION_STRING, - "PROJ_NAME" => PROJ_NAME + "PROJ_NAME" => PROJ_NAME, + "CONFIG_FILE_LOCATION" => CONFIG_FILE_LOCATION ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-03-26 20:13:33
|
Revision: 851 http://cs-project.svn.sourceforge.net/cs-project/?rev=851&view=rev Author: crazedsanity Date: 2008-03-26 13:12:57 -0700 (Wed, 26 Mar 2008) Log Message: ----------- A virtual appliance built specifically to run CS-Project. Should help users to develop or taste-test the system before committing to installing anything on a production server. NOTES: * SERVER: Ubuntu JeOS * REQS: -- RAM = 256M -- HD = (>1.1G or <= 2G) Added Paths: ----------- vmware/README.txt vmware/Ubuntu_JeOS.7z Added: vmware/README.txt =================================================================== --- vmware/README.txt (rev 0) +++ vmware/README.txt 2008-03-26 20:12:57 UTC (rev 851) @@ -0,0 +1,23 @@ +PURPOSE: + + This virtual appliance was built to help simplify testing of CS-Project. It +can be run on just about any modern computer that 2G (max) of space and 256M of +RAM. While the appliance is targeted at developers, it can be easily tweaked +to be production-worthy in a virtualized environment. + +--------- + +EXTRACTING THE APPLIANCE: + * Download 7-Zip [http://www.7-zip.org/] + * Install 7-Zip + * Extract the archive + +---------- + +RUNNING THE APPLIANCE: + * Download the VMware player [http://vmware.com/download/player/] + * Install the VMware player + * Select "Open an existing Virtual Machine" + * Browse to the location of the **extracted** appliance + * Once the appliance is opened, it will begin booting (just like a normal OS). + * Click the "Open Browser" button to load CS-Project in your browser. Property changes on: vmware/README.txt ___________________________________________________________________ Name: svn:eol-style + native Added: vmware/Ubuntu_JeOS.7z =================================================================== (Binary files differ) Property changes on: vmware/Ubuntu_JeOS.7z ___________________________________________________________________ Name: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-03-26 15:50:35
|
Revision: 850 http://cs-project.svn.sourceforge.net/cs-project/?rev=850&view=rev Author: crazedsanity Date: 2008-03-26 08:50:30 -0700 (Wed, 26 Mar 2008) Log Message: ----------- Directory for holding VMWare appliances that run cs-project (for developers or production environments that do virtualization). Added Paths: ----------- vmware/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-02-20 23:20:16
|
Revision: 849 http://cs-project.svn.sourceforge.net/cs-project/?rev=849&view=rev Author: crazedsanity Date: 2008-02-20 15:20:09 -0800 (Wed, 20 Feb 2008) Log Message: ----------- Make mainRecord::lastRecordId protected instead of private. Modified Paths: -------------- trunk/1.2/lib/mainRecordClass.php Modified: trunk/1.2/lib/mainRecordClass.php =================================================================== --- trunk/1.2/lib/mainRecordClass.php 2008-02-20 23:19:11 UTC (rev 848) +++ trunk/1.2/lib/mainRecordClass.php 2008-02-20 23:20:09 UTC (rev 849) @@ -22,7 +22,7 @@ protected $cleanStringArr = array(); protected $insertFieldsArr = array(); - private $lastRecordId; + protected $lastRecordId; private $internalRecordId; private $cache = array(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-02-20 23:19:28
|
Revision: 848 http://cs-project.svn.sourceforge.net/cs-project/?rev=848&view=rev Author: crazedsanity Date: 2008-02-20 15:19:11 -0800 (Wed, 20 Feb 2008) Log Message: ----------- Remove wordwrap when sending emails. Modified Paths: -------------- trunk/1.2/lib/globalFunctions.php Modified: trunk/1.2/lib/globalFunctions.php =================================================================== --- trunk/1.2/lib/globalFunctions.php 2008-02-20 22:55:52 UTC (rev 847) +++ trunk/1.2/lib/globalFunctions.php 2008-02-20 23:19:11 UTC (rev 848) @@ -1754,7 +1754,6 @@ $mail->ContentType = "text/html"; $mail->Subject = $subject; $mail->Body = $bbCodeParser->parseString($body); - $mail->WordWrap = 75; $logsObj = new logsClass($db, 'Email'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-02-20 22:55:55
|
Revision: 847 http://cs-project.svn.sourceforge.net/cs-project/?rev=847&view=rev Author: crazedsanity Date: 2008-02-20 14:55:52 -0800 (Wed, 20 Feb 2008) Log Message: ----------- Fix so creating new issues again redirects to the issue or linked project. Modified Paths: -------------- trunk/1.2/includes/content/helpdesk.inc Modified: trunk/1.2/includes/content/helpdesk.inc =================================================================== --- trunk/1.2/includes/content/helpdesk.inc 2008-02-20 19:57:28 UTC (rev 846) +++ trunk/1.2/includes/content/helpdesk.inc 2008-02-20 22:55:52 UTC (rev 847) @@ -180,7 +180,7 @@ $url = $baseUrl; //don't bother redirecting to the "view" page if the ID isn't valid. - if(preg_match('/view/', $urlSection) && !is_numeric($urlExtrasArr['ID'])) { + if(preg_match('/view/', $urlSection) && !is_numeric($urlExtrasArr['ID']) && $byPassUrlExtras === FALSE) { unset($urlSection); } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-02-20 19:58:48
|
Revision: 846 http://cs-project.svn.sourceforge.net/cs-project/?rev=846&view=rev Author: crazedsanity Date: 2008-02-20 11:57:28 -0800 (Wed, 20 Feb 2008) Log Message: ----------- Move stuff into config{} from site_config.php to check for & run upgrades. Modified Paths: -------------- trunk/1.2/lib/config.class.php trunk/1.2/lib/site_config.php Modified: trunk/1.2/lib/config.class.php =================================================================== --- trunk/1.2/lib/config.class.php 2008-02-20 19:46:29 UTC (rev 845) +++ trunk/1.2/lib/config.class.php 2008-02-20 19:57:28 UTC (rev 846) @@ -92,90 +92,62 @@ //------------------------------------------------------------------------- - /** - * Create a page (portion of a page, actually) to set/update config settings. - */ - public function build_update_interface(cs_genericPage &$page) { - - //read the sample config. - $config = new config(dirname(__FILE__) .'/config.xml', FALSE); - $myData = $config->get_config_contents(); - - //parse the sample config for it's attributes, so we can display the page properly. - $sampleConfig = new config(dirname(__FILE__) .'/../docs/samples/sample_config.xml', FALSE); - $systemData = $sampleConfig->get_config_contents(FALSE); - - $mainAttributes = $myData['attributes']; - - unset($myData['type'], $myData['attributes']); - - $parsedRows = ""; - $defaultRowName = 'setting_text'; - foreach($systemData as $indexName=>$defaultValue) { - if(is_array($myData) && isset($myData[$indexName])) { - $value = $myData[$indexName]; + public function do_setup_redirect() { + if(!preg_match('/^setup/', $_SERVER['REQUEST_URI']) && !$_SESSION[SESSION_SETUP_KEY]) { + + //set something in the session so we know. + if(!isset($_SESSION[SESSION_SETUP_KEY])) { + $_SESSION[SESSION_SETUP_KEY]++; } else { - $value = $systemData[$indexName]['value']; + throw new exception(__METHOD__ .": setup key (". SESSION_SETUP_KEY .") found in session already"); } - $attributes = $systemData[$indexName]['attributes']; - $indexName = strtolower($indexName); - //pull the appropriate template row. - $rowName = $defaultRowName; - if(strlen($attributes['TYPE'])) { - $rowName = 'setting_'. $attributes['TYPE']; - - $optionList = NULL; - if($attributes['TYPE'] == 'select' && isset($attributes['OPTIONS'])) { - #debug_print(explode('|', $attributes['OPTIONS'])); - $tmpOptionList = explode('|', $attributes['OPTIONS']); - $optionList = array(); - foreach($tmpOptionList as $optionInfo) { - $x = explode('=', $optionInfo); - $optionList[$x[0]] = $x[1]; - } - $optionList = $page->gfObj->array_as_option_list($optionList, $attributes['DEFAULT']); - } - } - if(!isset($page->templateRows[$rowName])) { - $page->set_block_row('content', $rowName); - if(!isset($page->templateRows[$rowName])) { - throw new exception(__METHOD__ .": failed to retrieve block row named (". $rowName .")"); - } - } + $goHere = '/setup'; - //now parse stuff into the row... - $repArr = array( - 'disabled' => $attributes['disabled'], - 'index' => $indexName, - 'title' => $attributes['TITLE'], - 'description' => $attributes['DESCRIPTION'], - 'value' => $value - ); - if(!is_null($optionList)) { - $repArr['setting_select__normal'] = $optionList; + if(strlen($_SERVER['REQUEST_URI']) > 1) { + $goHere .= '?from='. urlencode($_SERVER['REQUEST_URI']); } - $parsedRows .= $page->mini_parser($page->templateRows[$rowName], $repArr); + $this->gf->conditional_header($goHere); } - #debug_print($parsedRows); - $page->add_template_var($defaultRowName, $parsedRows); - }//end build_update_interface() + }//end do_setup_redirect() //------------------------------------------------------------------------- //------------------------------------------------------------------------- - public function do_setup_redirect() { - if(!preg_match('/^setup/', $_SERVER['REQUEST_URI'])) { - $goHere = '/setup'; - if(strlen($_SERVER['REQUEST_URI']) > 1) { - $goHere .= '?from='. urlencode($_SERVER['REQUEST_URI']); + public function check_site_status() { + if(!defined("PROJECT__INITIALSETUP") || PROJECT__INITIALSETUP !== TRUE) { + $this->do_setup_redirect(); + $config = $this->read_config_file(FALSE); + + if(($config['WORKINGONIT'] != "0" && strlen($config['WORKINGONIT'])) || strlen($config['WORKINGONIT']) > 1) { + //TODO: consider making this look prettier... + $details = "The website/database is under construction... try back in a bit."; + if(preg_match('/upgrade/i', $config['WORKINGONIT'])) { + $details = "<b>Upgrade in progress</b>: ". $config['WORKINGONIT']; + } + elseif(strlen($config['WORKINGONIT']) > 1) { + $details .= "MORE INFORMATION::: ". $config['WORKINGONIT']; + } + throw new exception($details); } - $this->gf->conditional_header($goHere); + else { + //don't panic: we're going to check for upgrades, but this doesn't + // necessarily mean anything will ACTUALLY be upgraded. + $upgrade = new upgrade; + if($upgrade->upgrade_in_progress()) { + throw new exception("Upgrade in progress... reload the page after a few minutes and it should be complete. :) "); + } + else { + $upgrade->check_versions(); + } + $this->read_config_file(TRUE); + } } - }//end do_setup_redirect() + }//end check_site_status() //------------------------------------------------------------------------- + }//end config{} ?> \ No newline at end of file Modified: trunk/1.2/lib/site_config.php =================================================================== --- trunk/1.2/lib/site_config.php 2008-02-20 19:46:29 UTC (rev 845) +++ trunk/1.2/lib/site_config.php 2008-02-20 19:57:28 UTC (rev 846) @@ -25,9 +25,8 @@ require_once(dirname(__FILE__) .'/config.class.php'); define(CONFIG_FILENAME, 'config.xml'); -//Set of functions that should be usefull to everyone +define(SESSION_SETUP_KEY, '___setup_key___'); - set_exception_handler('exception_handler'); //########################################################################## @@ -68,36 +67,11 @@ check_external_lib_versions(); - -if(!defined("PROJECT__INITIALSETUP") || PROJECT__INITIALSETUP !== TRUE) { - $configObj->do_setup_redirect(); - $config = $configObj->read_config_file(FALSE); - - if(($config['WORKINGONIT'] != "0" && strlen($config['WORKINGONIT'])) || strlen($config['WORKINGONIT']) > 1) { - //TODO: consider making this look prettier... - $details = "The website/database is under construction... try back in a bit."; - if(preg_match('/upgrade/i', $config['WORKINGONIT'])) { - $details = "<b>Upgrade in progress</b>: ". $config['WORKINGONIT']; - } - elseif(strlen($config['WORKINGONIT']) > 1) { - $details .= "MORE INFORMATION::: ". $config['WORKINGONIT']; - } - throw new exception($details); - } - else { - //don't panic: we're going to check for upgrades, but this doesn't - // necessarily mean anything will ACTUALLY be upgraded. - $upgrade = new upgrade; - if($upgrade->upgrade_in_progress()) { - throw new exception("Upgrade in progress... reload the page after a few minutes and it should be complete. :) "); - } - else { - $upgrade->check_versions(); - } - $configObj->read_config_file(TRUE); - } -} +//call a method to see if setup should run. +$configObj->check_site_status(); + + if($_SERVER['DOCUMENT_ROOT']) { //it was called from the web... $GLOBALS['SITE_ROOT'] = $_SERVER['DOCUMENT_ROOT']; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-02-20 19:47:17
|
Revision: 845 http://cs-project.svn.sourceforge.net/cs-project/?rev=845&view=rev Author: crazedsanity Date: 2008-02-20 11:46:29 -0800 (Wed, 20 Feb 2008) Log Message: ----------- Tab spacing (looks good in editor, but nowhere else...). Modified Paths: -------------- trunk/1.2/includes/setup/4.inc Modified: trunk/1.2/includes/setup/4.inc =================================================================== --- trunk/1.2/includes/setup/4.inc 2008-02-17 22:44:48 UTC (rev 844) +++ trunk/1.2/includes/setup/4.inc 2008-02-20 19:46:29 UTC (rev 845) @@ -9,15 +9,14 @@ $defaultValues = array( 'isdevsite' => array(1, 'numeric', 0), 'proj_name' => array(10, 'sql', "CS-Project"), - 'project_url' => array(5, 'sql', $_SERVER['HTTP_HOST']), + 'project_url' => array(5, 'sql', $_SERVER['HTTP_HOST']), 'helpdesk_issue_announce_email' => array(7, 'email', "new...@yo..."), - 'max_time' => array(5, 'sql', "18 hours"), - 'max_idle' => array(5, 'sql', "2 hours"), - 'config_session_name' => array(9, 'alpha', "CS_PROJECT_SESSID"), - 'stop_logins_on_global_alert' => array(1, 'numeric', 1), + 'max_time' => array(5, 'sql', "18 hours"), + 'max_idle' => array(5, 'sql', "2 hours"), + 'config_session_name' => array(9, 'alpha', "CS_PROJECT_SESSID"), 'debugprintopt' => array(1, 'numeric', 0), 'debugremovehr' => array(1, 'numeric', 0), - 'workingonit' => array(1, 'numeric', 0) + 'workingonit' => array(1, 'numeric', 0) ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-02-17 22:44:54
|
Revision: 844 http://cs-project.svn.sourceforge.net/cs-project/?rev=844&view=rev Author: crazedsanity Date: 2008-02-17 14:44:48 -0800 (Sun, 17 Feb 2008) Log Message: ----------- Remove "stop_logins_on_global_alert" (unused). Modified Paths: -------------- trunk/1.2/docs/samples/sample_config.xml trunk/1.2/templates/setup/4.content.tmpl Modified: trunk/1.2/docs/samples/sample_config.xml =================================================================== --- trunk/1.2/docs/samples/sample_config.xml 2008-02-17 22:11:12 UTC (rev 843) +++ trunk/1.2/docs/samples/sample_config.xml 2008-02-17 22:44:48 UTC (rev 844) @@ -47,12 +47,6 @@ unless you really know what you're doing." type="locked" disabled="1">1.0.0-ALPHA1</version_string> - <stop_logins_on_global_alert - title="Stop Logins on Global Alert" - description="(<font color=red><b>Currently unimplemented</b></font>) Stop users from logging in if a global alert has been created." - type="select" - options="0=No (0)|1=Yes (1)" - default="0">0</stop_logins_on_global_alert> <debugprintopt title="Debug Printing?" description="Generally, this should only be turned on if you're running a development site for cs-project..." Modified: trunk/1.2/templates/setup/4.content.tmpl =================================================================== --- trunk/1.2/templates/setup/4.content.tmpl 2008-02-17 22:11:12 UTC (rev 843) +++ trunk/1.2/templates/setup/4.content.tmpl 2008-02-17 22:44:48 UTC (rev 844) @@ -68,16 +68,6 @@ <tr> - <th>Stop Logins on Global Alert</th> - <td><SELECT name="fields[stop_logins_on_global_alert]"> - <option value="0" {stop_logins_on_global_alert__0__checked}>0 (off)</option> - <option value="1" {stop_logins_on_global_alert__1__checked}>1 (on)</option> - </SELECT></td> - <td>(<font color="red"><b>Currently unimplemented</b></font>) Stop users from logging in if a global alert has been created.</td> - </tr> - - - <tr> <th>Debug Printing?</th> <td><SELECT name="fields[debugprintopt]"> <option value="0" {debugprintopt__0__checked}>0 (off)</option> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-02-17 22:11:13
|
Revision: 843 http://cs-project.svn.sourceforge.net/cs-project/?rev=843&view=rev Author: crazedsanity Date: 2008-02-17 14:11:12 -0800 (Sun, 17 Feb 2008) Log Message: ----------- Revert last changes (go back to manually building list of options & setting their value/list of values). Modified Paths: -------------- trunk/1.2/includes/setup/4.inc trunk/1.2/templates/setup/4.content.tmpl Modified: trunk/1.2/includes/setup/4.inc =================================================================== --- trunk/1.2/includes/setup/4.inc 2008-02-17 21:57:13 UTC (rev 842) +++ trunk/1.2/includes/setup/4.inc 2008-02-17 22:11:12 UTC (rev 843) @@ -9,15 +9,15 @@ $defaultValues = array( 'isdevsite' => array(1, 'numeric', 0), 'proj_name' => array(10, 'sql', "CS-Project"), - 'project_url' => array(5, 'sql', $_SERVER['HTTP_HOST']), + 'project_url' => array(5, 'sql', $_SERVER['HTTP_HOST']), 'helpdesk_issue_announce_email' => array(7, 'email', "new...@yo..."), - 'max_time' => array(5, 'sql', "18 hours"), - 'max_idle' => array(5, 'sql', "2 hours"), - 'config_session_name' => array(9, 'alpha', "CS_PROJECT_SESSID"), - 'stop_logins_on_global_alert' => array(1, 'numeric', 1), + 'max_time' => array(5, 'sql', "18 hours"), + 'max_idle' => array(5, 'sql', "2 hours"), + 'config_session_name' => array(9, 'alpha', "CS_PROJECT_SESSID"), + 'stop_logins_on_global_alert' => array(1, 'numeric', 1), 'debugprintopt' => array(1, 'numeric', 0), 'debugremovehr' => array(1, 'numeric', 0), - 'workingonit' => array(1, 'numeric', 0) + 'workingonit' => array(1, 'numeric', 0) ); @@ -60,18 +60,15 @@ } } - $configObj = new config(); - $configObj->build_update_interface($page); + foreach($priorSetupData as $index=>$value) { + //check if it's a yes/no type thing. + if(is_numeric($defaultValues[$index])) { + $index .= "__". $value ."__checked"; + $value = "selected"; + } + $page->add_template_var($index, $value); + } - #foreach($priorSetupData as $index=>$value) { - # //check if it's a yes/no type thing. - # if(is_numeric($defaultValues[$index])) { - # $index .= "__". $value ."__checked"; - # $value = "selected"; - # } - # $page->add_template_var($index, $value); - #} - $page->add_template_var("currentUrl", $_SERVER['HTTP_HOST']); } @@ -96,9 +93,6 @@ $retval = __FUNCTION__ .": ". $index ." failed minimum length check after cleaning"; } } - elseif($index == 'workingonit') { - $goodValues++; - } else { $retval = __FUNCTION__ .": ". $index ." contains invalid data"; } Modified: trunk/1.2/templates/setup/4.content.tmpl =================================================================== --- trunk/1.2/templates/setup/4.content.tmpl 2008-02-17 21:57:13 UTC (rev 842) +++ trunk/1.2/templates/setup/4.content.tmpl 2008-02-17 22:11:12 UTC (rev 843) @@ -6,65 +6,110 @@ </p> - - <form method="POST" onSubmit="new Effect.DropOut('submitButton');"> -<a name="config" /> -<table border="1" cellpadding="3" cellspacing="0" width="80%"> -<tr> - <th colspan="2">Config Settings</th> -</tr> -<tr> - <td colspan="2" align="center"> - <div class="note" style="width:60em"><b>NOTE:</b> You should be <font color="red"><b>absolutely certain</b></font> of the - effects of the changes you make here. Changing an item to an incorrect value make render the - installation useless. To rectify a broken configuration, you would need to modify the - <b>/lib/config.xml</b> file manually.</div> - </td> -</tr> -<tr> - <th width="80%">Name/Description</th> - <th width="20%">Value/Select Option</th> -</tr> -<!-- BEGIN setting_text --> +<table border=1 cellpadding=3 cellspacing=0> <tr> + <th>Is Development Site?</th> <td> - <b>%%title%%</b> (%%index%%)<BR> - %%description%% + <SELECT name="fields[isdevsite]"> + <option value="0" {isdevsite__0__checked}>0 (False)</option> + <option value="1" {isdevsite__1__checked}>1 (True)</option> + </SELECT> </td> - - <td><input name="fields[%%index%%]" type="text" value="%%value%%" %%disabled%%></td> + <td>Whether it's a development site for cs-project or not... (TODO: add more info here)</td> </tr> -<!-- END setting_text --> -<!-- BEGIN setting_select --> + <tr> + <th>Project Name</th> + <td><input type="text" name="fields[proj_name]" value="{proj_name}" size="40"></td> + <td>Displayed name of the project (like "CS-Project")</td> + </tr> + + <tr> + <th>Project URL</th> + <td><input type="text" name="fields[project_url]" value="{project_url}" size="40"></td> + <td>Generally it's this website: ( <i>http://{currentUrl}</i> ).</td> + </tr> + + <tr> + <th nowrap>Helpdesk Issue Announce Email</th> + <td><input type="text" name="fields[helpdesk_issue_announce_email]" value="{helpdesk_issue_announce_email}" size="40"></td> + <td>This would be something like "<i>new...@yo...</i>"</td> + </tr> + + <tr> + <th nowrap>Mail Server IP</th> <td> - <b>%%title%%</b> (%%index%%)<BR> - %%description%% + <input type="text" name="fields[phpmailer_host]" value="{phpmailer_host}" size="40"> + <input type="HIDDEN" name="fields[phpmailer_method]" value="IsSMTP"> </td> - - <td> - <select name="fields[%%index%%]" %%disabled%%> - %%setting_select__normal%% - </select> + <td>This should be the IP of your mailserver, like <i>127.0.0.1</i>...</td> + </tr> + + + <tr> + <th>Maximum Session Length</th> + <td><input type="text" name="fields[max_time]" value="{max_time}" size="10"></td> + <td>This is how long any single session can be open before it's automatically removed from the server.</td> + </tr> + + <tr> + <th>Maximum Idleness</th> + <td><input type="text" name="fields[max_idle]" value="{max_idle}" size="10"></td> + <td>How long a session can be idle (no page views/activities) before it is removed.</td> + </tr> + + <tr> + <th>Session Name</th> + <td><input type="text" name="fields[config_session_name]" value="{config_session_name}" size="40"></td> + <td>Name of the session: really, this only matters if you have other websites running under the same + domain using PHP sessions, in which case this should be unique to avoid random annoying issues.</td> + </tr> + + + <tr> + <th>Stop Logins on Global Alert</th> + <td><SELECT name="fields[stop_logins_on_global_alert]"> + <option value="0" {stop_logins_on_global_alert__0__checked}>0 (off)</option> + <option value="1" {stop_logins_on_global_alert__1__checked}>1 (on)</option> + </SELECT></td> + <td>(<font color="red"><b>Currently unimplemented</b></font>) Stop users from logging in if a global alert has been created.</td> + </tr> + + + <tr> + <th>Debug Printing?</th> + <td><SELECT name="fields[debugprintopt]"> + <option value="0" {debugprintopt__0__checked}>0 (off)</option> + <option value="1" {debugprintopt__1__checked}>1 (on)</option> + </SELECT> </td> + <td>Generally, this should only be turned on if you're running a development site for cs-project...</td> </tr> -<!-- END setting_select --> -<!-- BEGIN setting_locked --> + + <tr> - <td> - <b>%%title%%</b> (%%index%%)<BR> - %%description%% + <th>Debug Print: Add "HR" Tag?</th> + <td><SELECT name="fields[debugremovehr]"> + <option value="0" {debugremovehr__0__checked}>0 (no separator)</option> + <option value="1" {debugremovehr__1__checked}>1 (add separator)</option> + </SELECT> </td> - - <td> - <!-- NOTE: should we even have hidden elements in the form? --> - <input type="text" name="fields[%%index%%]" value="%%value%%" disabled> - </td> + <td>This setting affects whether or not there are separators between debug_print()'s (useful to discover if there's a print occurring that is otherwise not visible)</td> </tr> -<!-- END setting_locked --> + + + <tr> + <th>Working On It?</th> + <td>0 (no)<input type="HIDDEN" name="fields[workingonit]" value="0"></td> + <td><font color="red"><b><blink>WARNING!</blink></b></font> Setting this to a non-zero value + will DISABLE all connections to the database, and make your site unuseable. It is provided as + a simple, fast way to stop connections to your database, usually for maintenance purposes. It + is displayed here for reference only.</td> + </tr> + <tr> <td colspan="3" align="center"><input id="submitButton" type="submit" value="Go to next step"><td> </tr> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-02-17 21:57:20
|
Revision: 842 http://cs-project.svn.sourceforge.net/cs-project/?rev=842&view=rev Author: crazedsanity Date: 2008-02-17 13:57:13 -0800 (Sun, 17 Feb 2008) Log Message: ----------- Re-add redirect to setup page if config file doesn't exist. /lib/site_config.php: * if the "PROJECT__INITIALSETUP" constant isn't defined, call config::do_setup_redirect() to redirect to the setup page. /lib/config.class.php: * __construct(): -- remove confusing comment. * do_setup_redirect() [NEW]: -- redirect the the /setup page only if we're not already there. -- only add the "?from=" if there's something useful to put there. Modified Paths: -------------- trunk/1.2/lib/config.class.php trunk/1.2/lib/site_config.php Modified: trunk/1.2/lib/config.class.php =================================================================== --- trunk/1.2/lib/config.class.php 2008-02-14 08:24:34 UTC (rev 841) +++ trunk/1.2/lib/config.class.php 2008-02-17 21:57:13 UTC (rev 842) @@ -21,7 +21,6 @@ $this->fileName = $fileName; } - //Redirect them to the setup page. if(!file_exists($this->fileName)) { $this->fileExists = FALSE; } @@ -164,5 +163,19 @@ $page->add_template_var($defaultRowName, $parsedRows); }//end build_update_interface() //------------------------------------------------------------------------- + + + + //------------------------------------------------------------------------- + public function do_setup_redirect() { + if(!preg_match('/^setup/', $_SERVER['REQUEST_URI'])) { + $goHere = '/setup'; + if(strlen($_SERVER['REQUEST_URI']) > 1) { + $goHere .= '?from='. urlencode($_SERVER['REQUEST_URI']); + } + $this->gf->conditional_header($goHere); + } + }//end do_setup_redirect() + //------------------------------------------------------------------------- }//end config{} ?> \ No newline at end of file Modified: trunk/1.2/lib/site_config.php =================================================================== --- trunk/1.2/lib/site_config.php 2008-02-14 08:24:34 UTC (rev 841) +++ trunk/1.2/lib/site_config.php 2008-02-17 21:57:13 UTC (rev 842) @@ -70,6 +70,7 @@ if(!defined("PROJECT__INITIALSETUP") || PROJECT__INITIALSETUP !== TRUE) { + $configObj->do_setup_redirect(); $config = $configObj->read_config_file(FALSE); if(($config['WORKINGONIT'] != "0" && strlen($config['WORKINGONIT'])) || strlen($config['WORKINGONIT']) > 1) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |