-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmysql-migrate.php
More file actions
51 lines (46 loc) · 1.12 KB
/
mysql-migrate.php
File metadata and controls
51 lines (46 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
require("ii-functions.php");
$oldtransport=new TextBase("echo/", "msg/");
/*
require_once("old-mysql-transport.php");
$oldmysqldata=array(
"host" => "localhost",
"db" => "test",
"user" => "root",
"pass" => "",
"table" => "old-table"
);
$oldtransport=new OldMysqlBase($oldmysqldata, "echo/");
*/
$db=new MysqlBase($mysqldata);
$creation=$db->executeQuery("
CREATE TABLE IF NOT EXISTS `$db->tablename`
(
`number` bigint NOT NULL auto_increment,
`id` varchar(20) NOT NULL,
`tags` text,
`echoarea` text NOT NULL,
`date` varchar(30) NOT NULL default '0',
`msgfrom` text,
`addr` text,
`msgto` text,
`subj` text not NULL,
`msg` text not NULL,
primary key(number, id)
) ENGINE InnoDB default charset='utf8';
");
echo $creation;
echo $db->db->error;
$echos=$oldtransport->fullEchoList();
foreach($echos as $echo) {
$msgids=$oldtransport->getMsgList($echo);
echo "trying to save echo ".$echo."\n";
foreach($msgids as $msgid) {
$message=$oldtransport->getMessage($msgid);
$db->saveMessage($msgid, $echo, $message, $raw=false);
if(substr($db->db->error, 0, 9)!="Duplicate") {
echo $db->db->error;
}
}
}
?>