[Vtigercrm-commits] [vtiger-commits] r9143 - in /vtigercrm/trunk: log4php.properties log4php_1.properties modules/Migration/Migration.php modules/Migration/MigrationCheck.php modules/Migration/ModifyDatabase/42P2_to_50.php modules/Migration/ModifyDatabase/rename_tables.php

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Mon Aug 28 08:09:59 EDT 2006


Author: saraj
Date: Mon Aug 28 06:09:50 2006
New Revision: 9143

Log:
* Modified to handle the migration logs seperately

Modified:
    vtigercrm/trunk/log4php.properties
    vtigercrm/trunk/log4php_1.properties
    vtigercrm/trunk/modules/Migration/Migration.php
    vtigercrm/trunk/modules/Migration/MigrationCheck.php
    vtigercrm/trunk/modules/Migration/ModifyDatabase/42P2_to_50.php
    vtigercrm/trunk/modules/Migration/ModifyDatabase/rename_tables.php

Modified: vtigercrm/trunk/log4php.properties
==============================================================================
--- vtigercrm/trunk/log4php.properties (original)
+++ vtigercrm/trunk/log4php.properties Mon Aug 28 06:09:50 2006
@@ -24,3 +24,12 @@
 log4php.appender.A1.layout.ContextPrinting="true"
 log4php.appender.A1.layout.DateFormat="%c"
 log4php.appender.A1.File=logs/vtigercrm.log
+
+log4php.logger.MIGRATION=DEBUG,A4
+log4php.appender.A4=LoggerAppenderRollingFile
+log4php.appender.A4.MaxFileSize=3MB
+log4php.appender.A4.MaxBackupIndex=10
+log4php.appender.A4.layout=LoggerLayoutTTCC
+log4php.appender.A4.layout.ContextPrinting="true"
+log4php.appender.A4.layout.DateFormat="%c"
+log4php.appender.A4.File=logs/migration.log

Modified: vtigercrm/trunk/log4php_1.properties
==============================================================================
Binary files - no diff available.

Modified: vtigercrm/trunk/modules/Migration/Migration.php
==============================================================================
--- vtigercrm/trunk/modules/Migration/Migration.php (original)
+++ vtigercrm/trunk/modules/Migration/Migration.php Mon Aug 28 06:09:50 2006
@@ -40,9 +40,12 @@
 	 */
 	function Migration($old='',$new='')
 	{
+		global $migrationlog;
+		$migrationlog->debug("Inside the constructor Migration.");
+		
 		$this->oldconn = $old;
 		$this->conn = $new;
-		$this->conn->println("Database Object has been created.");
+		$migrationlog->debug("Database Object has been created.");
 	}
 
 	/**	function used to set the Old database parameters in the migration object properties
@@ -55,12 +58,16 @@
 	 */
 	function setOldDatabaseParams($hostname,$mysql_port,$mysql_username,$mysql_password,$dbname)
 	{
+		global $migrationlog;
+		$migrationlog->debug("Inside the function setOldDatabaseParams($hostname,$mysql_port,$mysql_username,$mysql_password,$dbname)");
+		
 		$this->old_hostname = $hostname;
 		$this->old_mysql_port = $mysql_port;
 		$this->old_mysql_username = $mysql_username;
 		$this->old_mysql_password = $mysql_password;
 		$this->old_dbname = $dbname;
-		$this->conn->println("Old Database Parameters has been set.");
+		
+		$migrationlog->debug("Old Database Parameters has been set.");
 	}
 
 	/**	function used to set the Current ie., new 5.0 database parameters in the migration object properties
@@ -73,12 +80,16 @@
 	 */
 	function setNewDatabaseParams($hostname,$mysql_port,$mysql_username,$mysql_password,$dbname)
 	{
+		global $migrationlog;
+		$migrationlog->debug("Inside the function setNewDatabaseParams($hostname,$mysql_port,$mysql_username,$mysql_password,$dbname)");
+		
 		$this->new_hostname = $hostname;
 		$this->new_mysql_port = $mysql_port;
 		$this->new_mysql_username = $mysql_username;
 		$this->new_mysql_password = $mysql_password;
 		$this->new_dbname = $dbname;
-		$this->conn->println("New Database Parameters has been set.");
+		
+		$migrationlog->debug("New Database Parameters has been set.");
 	}
 
 	/**	function used to take the database dump
@@ -91,7 +102,9 @@
 	 */
 	function takeDatabaseDump($host_name,$mysql_port,$mysql_username,$mysql_password,$dbname)
 	{
-		$this->conn->println("Inside the function takeDatabaseDump. Going to take the specified database dump...");
+		global $migrationlog;
+		$migrationlog->debug("Inside the function takeDatabaseDump($host_name,$mysql_port,$mysql_username,$mysql_password,$dbname). Going to take the specified database dump...");
+
 		$dump_filename = 'dump_'.$dbname.'.txt';
 
 		if($mysql_password != '')
@@ -110,7 +123,8 @@
 			$server_mysql_path = $_SESSION['set_server_mysql_path'];
 
 			$dump_str = "mysqldump -u".$mysql_username.$password_str." -h ".$host_name." --port=".$mysql_port." ".$dbname." >> ".$dump_filename;
-
+			$migrationlog->debug("Server path set. Dump string to execute ==> $dump_str");
+			
 			chdir ($server_mysql_path);
 
 			exec("echo 'set FOREIGN_KEY_CHECKS = 0;' > ".$dump_filename);
@@ -122,12 +136,15 @@
 		}
 		else
 		{
+			$migrationlog->debug("Dump string to execute ==> mysqldump -u".$mysql_username." -h ".$host_name.$password_str." --port=".$mysql_port." ".$dbname." >> ".$dump_filename);
+
 			exec("echo 'set FOREIGN_KEY_CHECKS = 0;' > ".$dump_filename);
 			exec("mysqldump -u".$mysql_username." -h ".$host_name.$password_str." --port=".$mysql_port." ".$dbname." >> ".$dump_filename);
 			exec("echo 'set FOREIGN_KEY_CHECKS = 1;' >> ".$dump_filename);
 		}
 
 		$_SESSION['migration_log'] .= '<br> <b>'.$dbname.'</b> Database Dump has been taken and the file is ==> '.$dump_filename;
+		$migrationlog->debug("<br> <b> $dbname </b> Database Dump has been taken and the file is ==> $dump_filename");
 
 		return $dump_filename;
 	}
@@ -139,10 +156,12 @@
 	 */
 	function dropDatabase($conn,$dbname)
 	{
-		$this->conn->println("Inside the function dropDatabase. Going to drop the new database...");
+		global $migrationlog;
+		$migrationlog->debug("Inside the function dropDatabase($conn,$dbname). Going to drop the database - $dbname");
 		$sql = "drop database ".$dbname;
 		$conn->query($sql);
 
+		$migrationlog->debug("Database ($dbname) has been dropped.");
 		$_SESSION['migration_log'] .= '<br> <b>'.$dbname.'</b> Database has been dropped.';
 	}
 
@@ -153,12 +172,15 @@
 	 */
 	function createDatabase($conn,$dbname)
 	{
-		$this->conn->println("Inside the function createDatabase. Going to create the new database...");
+		global $migrationlog;
+		$migrationlog->debug("Inside the function createDatabase($conn, $dbname). Going to create the database - $dbname");
+		
 		$sql = "create database ".$dbname;
 		$conn->query($sql);
 
 		$_SESSION['migration_log'] .= '<br> <b>'.$dbname.'</b> Database has been created.';
-
+		$migrationlog->debug("Database ($dbname) has been dropped.");
+		
 		//Added to avoid the No Database Selected error when execute the queries
 		$conn->connect();
 	}
@@ -174,8 +196,9 @@
 	 */
 	function applyDumpData($host_name,$mysql_port,$mysql_username,$mysql_password,$dbname,$dumpfile)
 	{
-		$this->conn->println("Inside the function applyDumpData.");
-		$this->conn->println("hostname=$host_name&port=$mysql_port&username=$mysql_username&password=$mysql_password& dump file = $dumpfile");
+		global $migrationlog;
+		$migrationlog->debug("Inside the function applyDumpData($host_name,$mysql_port,$mysql_username,$mysql_password,$dbname,$dumpfile).");
+
 		if($mysql_password != '')
 		{
 			$password_str = " --password=".$mysql_password;
@@ -190,8 +213,9 @@
 		{
 			$current_working_dir = getcwd();
 			$server_mysql_path = $_SESSION['set_server_mysql_path'];
-			
+
 			$dump_str = "mysql --user=".$mysql_username.$password_str." -h ".$host_name." --force --port=".$mysql_port." ".$dbname." < ".$dumpfile;
+			$migrationlog->debug("MySQL server path set. Dump string to apply ==> $dump_str");
 
 			//exec("path = $server_mysql_path");
 			chdir ($server_mysql_path);
@@ -203,9 +227,11 @@
 		else
 		{
 			exec("mysql --user=".$mysql_username." -h ".$host_name." --force --port=".$mysql_port.$password_str." ".$dbname." < ".$dumpfile);
+			$migrationlog->debug("Dump string to apply ==> mysql --user=$mysql_username -h $host_name --force --port=$mysql_port $password_str $dbname < $dumpfile");
 		}
 
 		$_SESSION['migration_log'] .= '<br> Database Dump has been applied to the <b>'.$dbname.'</b> Database from <b>'.$dumpfile.'</b>';
+		$migrationlog->debug("<br> Database Dump has been applied to the <b> $dbname </b> database from <b> $dumpfile </b>");
 	}
 
 
@@ -229,11 +255,12 @@
 	 */
 	function getTablesCountInNewDatabase()
 	{
-		$this->conn->println("Inside the function getTablesCountInNewDatabase");
+		global $migrationlog;
+		$migrationlog->debug("Inside the function getTablesCountInNewDatabase()");
 		$newconn = @mysql_connect($this->new_hostname.':'.$this->new_mysql_port,$this->new_mysql_username,$this->new_mysql_password);
 		$tables = @mysql_num_rows(mysql_list_tables($this->new_dbname,$newconn));
 
-		$this->conn->println("Number of Tables in New Database = ".$tables);
+		$migrationlog->debug("Number of Tables in New Database = $tables");
 		return $tables;
 	}
 
@@ -242,11 +269,12 @@
 	 */
 	function getTablesCountInOldDatabase()
 	{
-		$this->conn->println("Inside the function getTablesCountInOldDatabase");
+		global $migrationlog;
+		$migrationlog->debug("Inside the function getTablesCountInOldDatabase()");
 		$oldconn = @mysql_connect($this->old_hostname.':'.$this->old_mysql_port,$this->old_mysql_username,$this->old_mysql_password);
 		$tables = @mysql_num_rows(mysql_list_tables($this->old_dbname,$oldconn));
 
-		$this->conn->println("Number of Tables in Old Database = ".$tables);
+		$migrationlog->debug("Number of Tables in Old Database = $tables");
 		return $tables;
 	}
 
@@ -256,8 +284,9 @@
 	 */
 	function modifyDatabase($conn)
 	{
-		$this->conn->println("Inside the function modifyDatabase");
-		$conn->println("\n\n\nMickie ---- Starts");
+		global $migrationlog;
+		$migrationlog->debug("Inside the function modifyDatabase($conn)");
+		$migrationlog->debug("\n\n\nMickie ---- Starts");
 
 		$_SESSION['migration_log'] .= "<br>The current database is going to be modified by executing the following queries...<br>";
 		
@@ -273,7 +302,7 @@
 		//Handle Here -- Mickie
 		include("modules/Migration/ModifyDatabase/MigrationInfo.php");
 
-		$conn->println("Mickie ---- Ends\n\n\n");
+		$migrationlog->debug("Mickie ---- Ends\n\n\n");
 	}
 
 	/**	function used to run the migration process based on the option selected and values given
@@ -297,10 +326,10 @@
 		//Step : 3 => Put the dump into the New Database
 		//Step : 4 => Modify the new database with the new changes
 
-
+		global $migrationlog;
 		global $conn;
-		$this->conn->println("Database Migration from Old Database to the Current Database Starts.");
-		$this->conn->println("Migration Option = $option");
+		$migrationlog->debug("Database Migration from Old Database to the Current Database Starts.");
+		$migrationlog->debug("Migration Option = $option");
 
 		//Set the old database parameters
 		$old_host_name = $this->old_hostname;
@@ -320,7 +349,7 @@
 		if($option == 'dbsource')
 		{
 			//Take the dump of the old Database
-			$this->conn->println("Going to take the old Database Dump.");
+			$migrationlog->debug("Going to take the old Database Dump.");
 			$dump_file = $this->takeDatabaseDump($old_host_name,$old_mysql_port,$old_mysql_username,$old_mysql_password,$old_dbname);
 
 			//check the file size is greater than 10000 bytes (~app) and if yes then continue else goto step1
@@ -344,7 +373,7 @@
 		if($old_dbname != $new_dbname)
 		{
 			//This is to take dump of the new database for backup purpose
-			$this->conn->println("Going to take the current Database Dump.");
+			$migrationlog->debug("Going to take the current Database Dump.");
 			$new_dump_file = $this->takeDatabaseDump($new_host_name,$new_mysql_port,$new_mysql_username,$new_mysql_password,$new_dbname);
 
 			//check the file size is greater than 10000 bytes (~app) and if yes then continue else goto step1
@@ -371,15 +400,15 @@
 		{
 			$_SESSION['migration_log'] .= '<br> Databases are different. So drop the Current Database and create. Also apply the dump of Old Database';
 			//Drop the current(latest) Database
-			$this->conn->println("Going to Drop the current Database");
+			$migrationlog->debug("Going to Drop the current Database");
 			$this->dropDatabase($conn,$new_dbname);
 
 			//Create the new current(latest) Database
-			$this->conn->println("Going to Create the current Database");
+			$migrationlog->debug("Going to Create the current Database");
 			$this->createDatabase($conn,$new_dbname);
 
 			//Apply the dump of the old database to the current database
-			$this->conn->println("Going to apply the old database dump to the new database.");
+			$migrationlog->debug("Going to apply the old database dump to the new database.");
 			$this->applyDumpData($new_host_name,$new_mysql_port,$new_mysql_username,$new_mysql_password,$new_dbname,$dump_file);
 
 			//get the number of tables in new database 
@@ -391,7 +420,7 @@
 			//if tables are missing after apply the dump, then alert the user and quit
 			if(($new_tables_count != $old_tables_count && $option == 'dbsource') || ($new_tables_count < 180 && $option == 'dumpsource'))
 			{
-				$this->conn->println("New Database tables not equal to Old Database tables count. Reload the current database again and quit.");
+				$migrationlog->debug("New Database tables not equal to Old Database tables count. Reload the current database again and quit.");
 				
 				$continue_process = 0;
 				$msg = "The dump may not be applied correctly. Tables exist in 4.2.3 database : $old_tables_count. Tables exist in current database after apply the dump : $new_tables_count";
@@ -406,25 +435,25 @@
 		if($continue_process == 1)
 		{
 			//Modify the database which is now as old database setup
-			$this->conn->println("Going to modify the current database which is now as old database setup");
+			$migrationlog->debug("Going to modify the current database which is now as old database setup");
 			$this->modifyDatabase($conn);
 		
-			$this->conn->println("Database Modifications Ends......");
-			$this->conn->println("Database Migration from Old Database to the Current Database has been Finished.");
+			$migrationlog->debug("Database Modifications Ends......");
+			$migrationlog->debug("Database Migration from Old Database to the Current Database has been Finished.");
 		}
 		else
 		{
 			//Drop the current(latest) Database
-			$this->conn->println("Going to Restore the current Database");
-			$this->conn->println("Going to Drop the current Database");
+			$migrationlog->debug("Problem in migration. so going to Restore the current Database");
+			$migrationlog->debug("Going to Drop the current Database");
 			$this->dropDatabase($conn,$new_dbname);
 
 			//Create the new current(latest) Database
-			$this->conn->println("Going to Create the current Database");
+			$migrationlog->debug("Going to Create the current Database");
 			$this->createDatabase($conn,$new_dbname);
 
 			//Reload the new db dump and quit
-			$this->conn->println("Going to apply the new backup db dump");
+			$migrationlog->debug("Going to apply the new backup db dump");
 			$this->applyDumpData($new_host_name,$new_mysql_port,$new_mysql_username,$new_mysql_password,$new_dbname,$new_dump_file);
 
 			//Return to Step1

Modified: vtigercrm/trunk/modules/Migration/MigrationCheck.php
==============================================================================
--- vtigercrm/trunk/modules/Migration/MigrationCheck.php (original)
+++ vtigercrm/trunk/modules/Migration/MigrationCheck.php Mon Aug 28 06:09:50 2006
@@ -13,6 +13,9 @@
 include("config.inc.php");
 $migration_log = '';
 
+//Added for Migration Log
+$migrationlog =& LoggerManager::getLogger('MIGRATION');
+
 //new database values get from the current vtigerCRM's config.php
 global $dbconfig;
 $new_host_name = $dbconfig['db_hostname'];
@@ -56,8 +59,11 @@
 		exit;
 	}
 }
+$migrationlog->debug("$migration_log");
 //echo '<br>Proceed with migration';
 
+
+$migrationlog->debug("Migration Option - ".$_REQUEST['migration_option']);
 include("modules/Migration/Migration.php");
 if($_REQUEST['migration_option'] == 'db_details')
 {
@@ -69,6 +75,12 @@
 	$old_mysql_password = $_REQUEST['old_mysql_password'];
 	$old_dbname = $_REQUEST['old_dbname'];
 
+	$migrationlog->debug("old host name = ".$old_host_name);
+	$migrationlog->debug("old MySQL port = ".$old_mysql_port);
+	$migrationlog->debug("old MySQL username = ".$old_mysql_username);
+	$migrationlog->debug("old MySQL password = ".$old_mysql_password);
+	$migrationlog->debug("old db name = ".$old_dbname);
+
 	//make a connection with the old database
 	$oldconn = @mysql_connect($old_host_name.":".$old_mysql_port,$old_mysql_username,$old_mysql_password);
 
@@ -88,6 +100,7 @@
 	else
 	{
 		$migration_log .= ' Database Servers can be connected. Can proceed with migration';
+		$migrationlog->debug("Database Servers can be connected. continue1 = 1");
 		$continue1 = 1;
 	}
 
@@ -109,6 +122,7 @@
 		else
 		{
 			$migration_log .= '<br> Required databases exist';
+			$migrationlog->debug("Required databases exist. continue2 = 1");
 			$continue2 = 1;
 		}
 	}
@@ -133,6 +147,7 @@
 		else
 		{
 			$migration_log .= '<br> Tables exist in both the Databases';
+			$migrationlog->debug("Tables exist in the database. continue3 = 1");
 			$continue3 = 1;
 		}
 	}
@@ -162,17 +177,21 @@
 
 	if($continue1 == 1 && $continue2 == 1 && $continue3 == 1 && $continue4 == 1)
 	{
+		$migrationlog->debug("Going to migrate...");
+
 		$new_host = explode(":",$new_host_name);
 
 		$conn = new PearDatabase("mysql",$new_host_name,$new_dbname,$new_mysql_username,$new_mysql_password);
 		$conn->connect();
 
-		$conn->println("MICKIE ==> Option = DB details. From the given DB details we will migrate.");
+		$migrationlog->debug("MICKIE ==> Option = DB details. From the given DB details we will migrate.");
 		
 		@session_unregister('migration_log');
 		$_SESSION['migration_log'] = $migration_log;
 		if($conn)
 		{
+			$migrationlog->debug("Pear Database object created. Going to create migration object.");
+
 			$obj = new Migration('',$conn);
 			$obj->setOldDatabaseParams($old_host_name,$old_mysql_port,$old_mysql_username,$old_mysql_password,$old_dbname);
 			$obj->setNewDatabaseParams($new_host[0],$new_host[1],$new_mysql_username,$new_mysql_password,$new_dbname);
@@ -196,7 +215,8 @@
 {
 	$old_dump_details = $_FILES['old_dump_filename'];
 	$old_dump_filename = $old_dump_details['name'];
-	
+	$migrationlog->debug("Dump file name ==> $old_dump_filename");
+
 	//MySQL Dump file details has given
 	if($old_dump_details['size'] != 0 && is_file($old_dump_details['tmp_name']))
 	{
@@ -217,6 +237,7 @@
 			$invalid_dump = 1;
 			$errormessage = "Please enter a valid Dump file.";
 		}
+		$migrationlog->debug("Dump file error no = ".$old_dump_details['error']);
 	}
 
 	if($gotostep1 == 1)
@@ -249,12 +270,14 @@
 		$conn = new PearDatabase("mysql",$new_host_name,$new_dbname,$new_mysql_username,$new_mysql_password);
 		$conn->connect();
 
-		$conn->println("MICKIE ==> Option = Dump File. Selected Dump File will be applied to the new database");
+		$migrationlog->debug("MICKIE ==> Option = Dump File. Selected Dump File will be applied to the new database");
 		
 		@session_unregister('migration_log');
 		$_SESSION['migration_log'] = $migration_log;
 		if($conn)
 		{
+			$migrationlog->debug("Pear Database object created. Going to create migration object.");
+
 			$obj = new Migration('',$conn);
 
 			$new_host = explode(":",$new_host_name);
@@ -276,6 +299,12 @@
 	$old_mysql_password = $_REQUEST['alter_old_mysql_password'];
 	$old_dbname = $_REQUEST['alter_old_dbname'];
 
+	$migrationlog->debug("old host name = ".$old_host_name);
+	$migrationlog->debug("old MySQL port = ".$old_mysql_port);
+	$migrationlog->debug("old MySQL username = ".$old_mysql_username);
+	$migrationlog->debug("old MySQL password = ".$old_mysql_password);
+	$migrationlog->debug("old db name = ".$old_dbname);
+
 	//make a connection with the old database
 	$oldconn = @mysql_connect($old_host_name.":".$old_mysql_port,$old_mysql_username,$old_mysql_password);
 
@@ -287,6 +316,7 @@
 	else
 	{
 		$migration_log .= ' Database Server can be connected. Can proceed with migration';
+		$migrationlog->debug("Database server connected. continue1 = 1");
 		$continue1 = 1;
 	}
 
@@ -303,6 +333,7 @@
 		else
 		{
 			$migration_log .= '<br> Required database exist';
+			$migrationlog->debug("Database exist. continue2 = 1");
 			$continue2 = 1;
 		}
 	}
@@ -320,6 +351,7 @@
 		else
 		{
 			$migration_log .= '<br> Tables exist in the Database';
+			$migrationlog->debug("Tables exist. continue3 = 1");
 			$continue3 = 1;
 		}
 	}
@@ -334,12 +366,14 @@
 		$conn = new PearDatabase("mysql",$old_host_name.":".$old_mysql_port,$old_dbname,$old_mysql_username,$old_mysql_password);
 		$conn->connect();
 
-		$conn->println("MICKIE ==> Option = Alter DB details. From the given DB details we will migrate.");
+		$migrationlog->debug("MICKIE ==> Option = Alter DB details. From the given DB details we will migrate.");
 
 		@session_unregister('migration_log');
 		$_SESSION['migration_log'] = $migration_log;
 		if($conn)
 		{
+			$migrationlog->debug("Database object created. Going to create Migration object");
+
 			$obj = new Migration('',$conn);
 			$obj->setOldDatabaseParams($old_host_name,$old_mysql_port,$old_mysql_username,$old_mysql_password,$old_dbname);
 			//$obj->migrate($same_databases,'dbsource');

Modified: vtigercrm/trunk/modules/Migration/ModifyDatabase/42P2_to_50.php
==============================================================================
--- vtigercrm/trunk/modules/Migration/ModifyDatabase/42P2_to_50.php (original)
+++ vtigercrm/trunk/modules/Migration/ModifyDatabase/42P2_to_50.php Mon Aug 28 06:09:50 2006
@@ -13,20 +13,21 @@
 
 
 global $conn;
+global $migrationlog;
 global $query_count, $success_query_count, $failure_query_count;
 global $success_query_array, $failure_query_array;
 
 //Added to put prefix vtiger_ in some of the columns in tables which are used for CV and Reports and field -- 23-06-06
-$conn->println("Going to rename the table names with prefix vtiger_");
+$migrationlog->debug("Going to rename the table names with prefix vtiger_");
 include("modules/Migration/ModifyDatabase/rename_tables.php");
-$conn->println("Renaming the table names with prefix vtiger_ has been finished");
-
-
-
-
-
-
-$conn->println("Database Modifications for 4.2 Patch2 ==> 5.0(Alpha) Dev 3 Starts here.");
+$migrationlog->debug("Renaming the table names with prefix vtiger_ has been finished");
+
+
+
+
+
+
+$migrationlog->debug("Database Modifications for 4.2 Patch2 ==> 5.0(Alpha) Dev 3 Starts here.");
 
 
 
@@ -841,7 +842,7 @@
 
 
 
-$conn->println("Database Modifications for 5.0(Alpha) Dev 3 ==> 5.0 Alpha starts here.");
+$migrationlog->debug("Database Modifications for 5.0(Alpha) Dev 3 ==> 5.0 Alpha starts here.");
 //echo "<br><br><b>Database Modifications for 5.0(Alpha) Dev3 ==> 5.0 Alpha starts here.....</b><br>";
 $alter_query_array6 = Array(
 				"ALTER TABLE vtiger_users ADD column activity_view VARCHAR(25) DEFAULT 'Today' AFTER homeorder",
@@ -2650,11 +2651,11 @@
 	}
 }
 
-$conn->println("Database Modifications for 5.0(Alpha) Dev 3 ==> 5.0 Alpha (5) ends here.");
+$migrationlog->debug("Database Modifications for 5.0(Alpha) Dev 3 ==> 5.0 Alpha (5) ends here.");
 
 
 /************************* The following changes have been made after 5.0 Alpha 5 *************************/
-$conn->println("Database Modifications after 5.0(Alpha 5) starts here.");
+$migrationlog->debug("Database Modifications after 5.0(Alpha 5) starts here.");
 
 
 //Added on 22-04-06 - to add the Notify Owner vtiger_field in Contacts and Accounts
@@ -2783,7 +2784,7 @@
 		mkdir($filepath."$year/$month/$week");
 
 	$filepath = $filepath.$year."/".$month."/".$week."/";
-	$conn->println("File Path = $filepath");
+	$migrationlog->debug("File Path = $filepath");
 	//upto this added to set the file path based on attachment created time
 
 	//In this file name (attachmentid_filename) the file will be stored in the harddisk
@@ -3676,8 +3677,10 @@
 function Execute($query)
 {
 	global $conn, $query_count, $success_query_count, $failure_query_count, $success_query_array, $failure_query_array;
-
+	global $migrationlog;
+	
 	$status = $conn->query($query);
+	
 	$query_count++;
 	if(is_object($status))
 	{
@@ -3688,6 +3691,7 @@
 				<td width="70%">'.$query.'</td>
 			</tr>';
 		$success_query_array[$success_query_count++] = $query;
+		$migrationlog->debug("Query Success ==> $query");
 	}
 	else
 	{
@@ -3698,11 +3702,13 @@
 				<td width="70%">'.$query.'</td>
 			</tr>';
 		$failure_query_array[$failure_query_count++] = $query;
+		$migrationlog->debug("Query Failed ==> $query");
+		//$migrationlog->debug("Error is ==> ".$conn->ErrorMsg());
 	}
 }
 
 //Added on 23-12-2005 which is used to populate the vtiger_profile2field and vtiger_def_org_field table entries for the field per tab
-//if we enter a vtiger_field in vtiger_field table then we must populate that vtiger_field in these table for security access
+//if we enter a field in vtiger_field table then we must populate that field in these table for security access
 function populateFieldForSecurity($tabid,$fieldid)
 {
 	global $conn;

Modified: vtigercrm/trunk/modules/Migration/ModifyDatabase/rename_tables.php
==============================================================================
--- vtigercrm/trunk/modules/Migration/ModifyDatabase/rename_tables.php (original)
+++ vtigercrm/trunk/modules/Migration/ModifyDatabase/rename_tables.php Mon Aug 28 06:09:50 2006
@@ -10,9 +10,10 @@
  ********************************************************************************/
 
 global $conn;
+global $migrationlog;
 $prefix = "vtiger_";
 
-$conn->println("Inside the file rename_tables.php to rename the table names with prefix vtiger_");
+$migrationlog->debug("Inside the file rename_tables.php to rename the table names with prefix vtiger_");
 
 //Rename all the tables with prefix vtiger_
 $tables_list = $conn->get_tables();
@@ -66,5 +67,5 @@
 }
 
 
-$conn->println("End of file rename_tables.php. The table names renamed with prefix vtiger_");
+$migrationlog->debug("End of file rename_tables.php. The table names renamed with prefix vtiger_");
 ?>





More information about the vtigercrm-commits mailing list