[Cs-webdbupgrade-commits] SF.net SVN: cs-webdbupgrade:[26] trunk/0.1/cs_webdbupgrade.class.php
Status: Inactive
Brought to you by:
crazedsanity
|
From: <cra...@us...> - 2009-08-04 20:33:44
|
Revision: 26
http://cs-webdbupgrade.svn.sourceforge.net/cs-webdbupgrade/?rev=26&view=rev
Author: crazedsanity
Date: 2009-08-04 20:33:29 +0000 (Tue, 04 Aug 2009)
Log Message:
-----------
Better logging, internal upgrades "work", removed debugging.
/cs_webdbupgrade.class.php:
* __construct():
-- connect the logger AFTER calling check_internal_upgrades()
-- call connect_logger(): this switches the category.
* check_internal_upgrades():
-- connects logger with "Internal Upgrades" category
-- removed a debug_print().
-- call check_versions(true) without errors!
* load_initial_version():
-- removed a debug_print()
* connect_db_logger() [NEW]:
-- creates the internal cs_webdblogger{} object with the given
category (basically, this is called to switch logged category).
Modified Paths:
--------------
trunk/0.1/cs_webdbupgrade.class.php
Modified: trunk/0.1/cs_webdbupgrade.class.php
===================================================================
--- trunk/0.1/cs_webdbupgrade.class.php 2009-08-04 18:59:26 UTC (rev 25)
+++ trunk/0.1/cs_webdbupgrade.class.php 2009-08-04 20:33:29 UTC (rev 26)
@@ -133,13 +133,8 @@
$this->db = new cs_phpDB(constant('DBTYPE'));
try {
$this->db->connect($this->config['DBPARAMS']);
-
- $loggerDb = new cs_phpDB(constant('DBTYPE'));
- $loggerDb->connect($this->config['DBPARAMS'], true);
- $this->logsObj = new cs_webdblogger($loggerDb, "Upgrade");
}
catch(exception $e) {
- $this->gfObj->debug_print($this->config,1);
throw new exception(__METHOD__ .": failed to connect to database or logger error: ". $e->getMessage());
}
@@ -149,6 +144,12 @@
}
$this->check_internal_upgrades();
+ try {
+ $this->connect_logger("Upgrade");
+ }
+ catch(exception $e) {
+ throw new exception(__METHOD__ .": failed to create logger::: ". $e->getMessage());
+ }
$this->check_versions(false);
}//end __construct()
@@ -165,12 +166,20 @@
$oldUpgradeConfigFile = $this->config['UPGRADE_CONFIG_FILE'];
$this->config['UPGRADE_CONFIG_FILE'] = dirname(__FILE__) .'/upgrades/upgrade.xml';
+
+ //connect the logger...
+ try {
+ $this->connect_logger("Internal Upgrade");
+ }
+ catch(exception $e) {
+ $this->error_handler($e->getMessage());
+ }
+
+
//do stuff here...
$this->versionFileLocation = dirname(__FILE__) .'/VERSION';
$this->read_version_file();
- $this->gfObj->debug_print($this->parse_version_string($this->versionFileVersion),1);
-
//if there is an error, then... uh... yeah.
try {
$this->get_database_version();
@@ -182,6 +191,12 @@
$this->load_initial_version();
}
+ //do upgrades here...
+ $this->check_versions(true);
+
+
+
+
//reset internal vars.
$this->versionFileLocation = $oldVersionFileLocation;
$this->config['UPGRADE_CONFIG_FILE'] = $oldUpgradeConfigFile;
@@ -1039,7 +1054,6 @@
$sql = 'INSERT INTO '. $this->config['DB_TABLE'] . $this->gfObj->string_from_array($insertData, 'insert');
- $this->gfObj->debug_print(__METHOD__ .": SQL::: ". $sql,1);
if($this->db->run_insert($sql, $this->sequenceName)) {
$loadRes = true;
$this->logsObj->log_by_class("Created data for '". $this->projectName ."' with version '". $insertData['version_string'] ."'", 'initialize');
@@ -1053,6 +1067,16 @@
//=========================================================================
+
+ //=========================================================================
+ private function connect_logger($logCategory) {
+ $loggerDb = new cs_phpDB(constant('DBTYPE'));
+ $loggerDb->connect($this->config['DBPARAMS'], true);
+ $this->logsObj = new cs_webdblogger($loggerDb, $logCategory);
+ }//end connect_logger()
+ //=========================================================================
+
+
}//end upgrade{}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|