[pLog-svn] r5008 - in plog/branches/lifetype-1.2: . tools

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Tue Mar 6 12:38:58 EST 2007


Author: jondaley
Date: 2007-03-06 12:38:58 -0500 (Tue, 06 Mar 2007)
New Revision: 5008

Added:
   plog/branches/lifetype-1.2/tools/updatedbschema.php
Removed:
   plog/branches/lifetype-1.2/updatedbschema.php
Log:
hide this in the tools directory, so people don't run it remotely

Copied: plog/branches/lifetype-1.2/tools/updatedbschema.php (from rev 5007, plog/branches/lifetype-1.2/updatedbschema.php)
===================================================================
--- plog/branches/lifetype-1.2/tools/updatedbschema.php	                        (rev 0)
+++ plog/branches/lifetype-1.2/tools/updatedbschema.php	2007-03-06 17:38:58 UTC (rev 5008)
@@ -0,0 +1,63 @@
+<?php
+
+/**
+ * Quick and dirty script to update a database schema to the most recent version of the schema
+ * as defined by file install/dbschemas.properties.php
+ */
+
+if (!defined( "PLOG_CLASS_PATH" )) {
+    define( "PLOG_CLASS_PATH", dirname(__FILE__)."/");
+}
+
+lt_include( PLOG_CLASS_PATH."class/database/db.class.php" );
+lt_include( PLOG_CLASS_PATH."class/config/configfilestorage.class.php" );
+lt_include( PLOG_CLASS_PATH."install/dbschemas.properties.php" );
+
+$config = new ConfigFileStorage();
+// open a connection to the database
+$db = PDb::getDriver('mysql');
+
+if( !$db->Connect($config->getValue( "db_host" ), $config->getValue( "db_username" ), $config->getValue( "db_password" ), $config->getValue( "db_database" ), $config->getValue( "db_character_set" ))) {
+	die( "could not connect to database!" );
+}
+
+$prefix = $config->getValue( "db_prefix" );
+
+$dict = NewPDbDataDictionary( $db );            
+$errors = false;
+$message = "";
+foreach( $Tables as $name => $table ) {
+    $errorMessage = "";
+    $table_errors = false;
+	$upperName = $dict->upperName;
+	$tableSchema = $table["schema"];
+	if ( isset( $table["options"] ) )
+	{
+		$tableOptions = $table["options"];
+		$options = array ( $upperName => $tableOptions );
+	} else {
+		$options = array ();
+    }
+   
+    // generate the code with the changes for the table
+    $sqlarray = $dict->ChangeTableSQL( $prefix.$name, $tableSchema, $options );
+    
+    foreach( $sqlarray as $sql ) {
+        // and run the query
+        if( !$db->Execute( $sql )) {
+            $table_errors = true;
+            $errors = true;
+            $errorMessage .= $db->ErrorMsg()."<br/>";
+        }
+    }
+
+    if( !$table_errors )
+        $message .= "Changes to table <strong>$name</strong> executed successfully.<br/>";
+    else {
+        $message .= "Error modifying table $name: ".$errorMessage;
+    }
+}
+
+print($message);
+
+?>
\ No newline at end of file

Deleted: plog/branches/lifetype-1.2/updatedbschema.php
===================================================================
--- plog/branches/lifetype-1.2/updatedbschema.php	2007-03-06 17:31:21 UTC (rev 5007)
+++ plog/branches/lifetype-1.2/updatedbschema.php	2007-03-06 17:38:58 UTC (rev 5008)
@@ -1,63 +0,0 @@
-<?php
-
-/**
- * Quick and dirty script to update a database schema to the most recent version of the schema
- * as defined by file install/dbschemas.properties.php
- */
-
-if (!defined( "PLOG_CLASS_PATH" )) {
-    define( "PLOG_CLASS_PATH", dirname(__FILE__)."/");
-}
-
-lt_include( PLOG_CLASS_PATH."class/database/db.class.php" );
-lt_include( PLOG_CLASS_PATH."class/config/configfilestorage.class.php" );
-lt_include( PLOG_CLASS_PATH."install/dbschemas.properties.php" );
-
-$config = new ConfigFileStorage();
-// open a connection to the database
-$db = PDb::getDriver('mysql');
-
-if( !$db->Connect($config->getValue( "db_host" ), $config->getValue( "db_username" ), $config->getValue( "db_password" ), $config->getValue( "db_database" ), $config->getValue( "db_character_set" ))) {
-	die( "could not connect to database!" );
-}
-
-$prefix = $config->getValue( "db_prefix" );
-
-$dict = NewPDbDataDictionary( $db );            
-$errors = false;
-$message = "";
-foreach( $Tables as $name => $table ) {
-    $errorMessage = "";
-    $table_errors = false;
-	$upperName = $dict->upperName;
-	$tableSchema = $table["schema"];
-	if ( isset( $table["options"] ) )
-	{
-		$tableOptions = $table["options"];
-		$options = array ( $upperName => $tableOptions );
-	} else {
-		$options = array ();
-    }
-   
-    // generate the code with the changes for the table
-    $sqlarray = $dict->ChangeTableSQL( $prefix.$name, $tableSchema, $options );
-    
-    foreach( $sqlarray as $sql ) {
-        // and run the query
-        if( !$db->Execute( $sql )) {
-            $table_errors = true;
-            $errors = true;
-            $errorMessage .= $db->ErrorMsg()."<br/>";
-        }
-    }
-
-    if( !$table_errors )
-        $message .= "Changes to table <strong>$name</strong> executed successfully.<br/>";
-    else {
-        $message .= "Error modifying table $name: ".$errorMessage;
-    }
-}
-
-print($message);
-
-?>
\ No newline at end of file



More information about the pLog-svn mailing list