diff -r ac0ca51809b1 -r 47dd15d8bb8c migrator.php-pa --- a/migrator.php-pa Wed Apr 18 22:48:49 2007 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,129 +0,0 @@ - trancer nl> | -// | Sjeemz sjeemz nl> | -// +--------------------------------------------------------------------+ -// -// File: migrator.php -// Description: Migrates PowerAdmin 1.1.2 to the new 1.2 format - -if(!@include_once("inc/config.inc.php")) -{ - error("You have to create a config.inc.php!"); -} -require_once("inc/database.inc.php"); - -PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'error'); -function error($msg) -{ - // General function for printing critical errors. - include_once("inc/header.inc.php"); - ?> -

Oops! An error occured!

-
- - code) - { - case -19: - echo "

It seems you already have your PowerAdmin migrated because the tables cant be - altered. Another problem can be that you dont ALTER right on your database, - check this if you think your database doesnt have the proper format yet!

"; - break; - case -18: - echo "

One of the tables required doesnt exist, please run - test_setup.php.

PEAR::DB Error: " . $msg->getDebugInfo(); - break; - default: - echo "Unknown error, sorry: PEAR::DB Returned: " . $msg->getDebugInfo(); - break; - } - } - else - { - echo $msg; - } - ?> - -

<< back

- -

Success!

-
- -

- -

-
-

- << back -

-

- getCol("select id from zones"); - -foreach($zoneresult as $zr) -{ - // Look up the domain_id - $zonename = $db->getOne("select name from zones where zones.id=" . $zr); - // do a count, if the record already exists in the domains table, dont insert it - $dom_count = $db->query("select id from domains where name='$zonename'"); - if($dom_count->numRows() == 0) - { - $dom_id = $db->nextID("domains"); - $db->query("INSERT INTO domains(id, name, type) VALUES('$dom_id', '$zonename', 'NATIVE')"); - $db->query("UPDATE records SET domain_id=$dom_id where domain_id=$zr"); - $db->query("UPDATE zones SET name=$dom_id where id=$zr"); - } - else - { - $row = $dom_count->fetchRow(); - - $db->query('UPDATE records SET domain_id=' . $row["id"] . " where domain_id=$zr"); - $db->query('UPDATE zones SET name=' . $row['id'] . " where id=$zr"); - } -} - -if(!DB::isError($zoneresult)) -{ - $db->query("ALTER TABLE zones CHANGE name domain_id INT(11) NOT NULL"); - - message("Done updating your tables, enjoy your new PowerAdmin! - Please remove this file from your webdirectory!"); -} -else -{ - error("You seem to have no information in the table zones"); -} -?>