public static function getInstance($conexao, $tabela=NULL){ // Verifica se existe uma instância da classe if(!isset(self::$migrate)): try { self::$migrate = new Migration($conexao, $tabela); } catch (Exception $e) { echo "Erro " . $e->getMessage(); } endif; return self::$migrate; }
$new_dbname = $dbconfig['db_name']; $new_mysql_username = $dbconfig['db_username']; $new_mysql_password = $dbconfig['db_password']; $conn = new PearDatabase("mysql", $new_host_name, $new_dbname, $new_mysql_username, $new_mysql_password); $conn->connect(); $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); $temp_new_host_name = $new_host[0]; $new_mysql_port = $new_host[1]; $obj->setNewDatabaseParams($new_host[0], $new_host[1], $new_mysql_username, $new_mysql_password, $new_dbname); $obj->migrate(0, 'dumpsource', $old_dump_filename); } } } elseif ($_REQUEST['migration_option'] == 'alter_db_details') { //old database values $old_host_name = $_REQUEST['alter_old_host_name']; $old_mysql_port = $_REQUEST['alter_old_port_no']; $old_mysql_username = $_REQUEST['alter_old_mysql_username']; $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 password = "******"old db name = " . $old_dbname); //make a connection with the old database
public function migrate() { $migration = new Migration(); $migration->migrate(); }