[Cs-project-svn_notify] SF.net SVN: cs-project: [651] trunk/upgrade
Brought to you by:
crazedsanity
From: <cra...@us...> - 2007-11-21 16:45:48
|
Revision: 651 http://cs-project.svn.sourceforge.net/cs-project/?rev=651&view=rev Author: crazedsanity Date: 2007-11-21 08:45:44 -0800 (Wed, 21 Nov 2007) Log Message: ----------- Set special tag modifiers (if present), add upgrade script to xml file. Modified Paths: -------------- trunk/upgrade/upgrade.xml trunk/upgrade/upgradeTo1.1.0-BETA14.php Modified: trunk/upgrade/upgrade.xml =================================================================== --- trunk/upgrade/upgrade.xml 2007-11-21 16:44:46 UTC (rev 650) +++ trunk/upgrade/upgrade.xml 2007-11-21 16:45:44 UTC (rev 651) @@ -64,5 +64,11 @@ <class_name>upgrade_to_1_1_0_BETA13</class_name> <call_method>run_upgrade</call_method> </v1.1.0-BETA12> + <v1.1.0-BETA13> + <target_version>1.1.0-BETA14</target_version> + <script_name>upgradeTo1.1.0-BETA14.php</script_name> + <class_name>upgrade_to_1_1_0_BETA14</class_name> + <call_method>run_upgrade</call_method> + </v1.1.0-BETA13> </matching> </upgrade> Modified: trunk/upgrade/upgradeTo1.1.0-BETA14.php =================================================================== --- trunk/upgrade/upgradeTo1.1.0-BETA14.php 2007-11-21 16:44:46 UTC (rev 650) +++ trunk/upgrade/upgradeTo1.1.0-BETA14.php 2007-11-21 16:45:44 UTC (rev 651) @@ -33,7 +33,6 @@ $this->run_schema_changes(); $this->update_tag_modifiers(); - $this->db->commitTrans(__METHOD__); }//end run_upgrade() @@ -52,6 +51,61 @@ $this->logsObj->log_by_class($details, 'system'); }//end run_schema_changes() //========================================================================= + + + + //========================================================================= + private function update_tag_modifiers() { + + $sql = "SELECT tag_name_id, name FROM tag_name_table ORDER BY tag_name_id"; + if($this->run_sql($sql) && $this->lastNumrows > 1) { + $allTags = $this->db->farray_nvp('tag_name_id', 'name'); + + $specialModifiers = array( + 'critical' => -5, + 'exception' => -2, + 'invalid data' => -2, + 'authentication' => -1, + 'bug' => -1, + 'cannot fix' => -1, + 'data cleaning' => -1, + 'feature request' => -1, + 'email' => 0, + 'formatting' => 0, + 'has dependencies' => 0, + 'information' => 0, + 'network related' => 0, + 'session' => 0, + 'upgrade' => 1, + 'duplicate' => 2, + 'cannot reproduce' => 3, + ); + + $updates = 0; + foreach($allTags as $id=>$name) { + if(is_numeric($specialModifiers[$name])) { + //change the modifier accordingly... + $sql = "UPDATE tag_name_table SET modifier=". $specialModifiers[$name] ." WHERE tag_name_id=". $id; + if($this->run_sql($sql) && $this->lastNumrows == 1) { + $updates++; + } + else { + throw new exception(__METHOD__ .": failed to update tag (". $name .") with special " . + "modifier (". $specialModifiers[$name] .")"); + } + + // + $details = "Changed modifier of [tag_name_id=". $id ."] to (". $specialModifiers[$name] .")"; + $this->logsObj->log_by_class($details, 'update'); + } + } + } + else { + throw new exception(__METHOD__ .": failed to retrieve tag names"); + } + + }//end update_tag_modifiers() + //========================================================================= } ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |