summaryrefslogtreecommitdiff
path: root/forum-merge
diff options
context:
space:
mode:
authorrein mitra <another_drone@yahoo.com>2016-10-09 00:57:04 +0000
committerrein mitra <another_drone@yahoo.com>2016-10-09 00:57:04 +0000
commitc1357137a5cebf877fd325dd0b0c8ba9d18064bd (patch)
tree984e3c785f597beb03d594600dd788505b4df784 /forum-merge
parent5f8bcf5d658f1c6b68feb869046ca1f97828b859 (diff)
downloadevol-tools-c1357137a5cebf877fd325dd0b0c8ba9d18064bd.tar.gz
evol-tools-c1357137a5cebf877fd325dd0b0c8ba9d18064bd.tar.bz2
evol-tools-c1357137a5cebf877fd325dd0b0c8ba9d18064bd.tar.xz
evol-tools-c1357137a5cebf877fd325dd0b0c8ba9d18064bd.zip
Upload new file
Diffstat (limited to 'forum-merge')
-rw-r--r--forum-merge/optional-stored-routine-and-info-regarding-privmsgs84
1 files changed, 84 insertions, 0 deletions
diff --git a/forum-merge/optional-stored-routine-and-info-regarding-privmsgs b/forum-merge/optional-stored-routine-and-info-regarding-privmsgs
new file mode 100644
index 0000000..939fa67
--- /dev/null
+++ b/forum-merge/optional-stored-routine-and-info-regarding-privmsgs
@@ -0,0 +1,84 @@
+
+this segment into the merge script
+
+#---------------------------------privmsgs-----------------------------------------------------------------
+
+print "counting attach_id"
+cursor.execute("SELECT max( msg_id ) FROM phpbb_privmsgs;")
+data = cursor.fetchone()
+maxmsg=data
+print "maxmsg : %s " % maxmsg
+
+#make all user folders to inbox
+cursor.execute("update phpbb_privmsgs_to_2 set folder_id = 0 where folder_id > 0;")
+# remove the auto increment attribute and primary key index
+cursor.execute("ALTER TABLE phpbb_privmsgs_2 CHANGE `msg_id` `msg_id` MEDIUMINT( 8 ) UNSIGNED NOT NULL;")
+cursor.execute("alter table phpbb_privmsgs_2 drop primary key;")
+cursor.execute("update phpbb_privmsgs_2 set msg_id = msg_id + %s;" % maxmsg)
+
+#delete auto increment
+cursor.execute("ALTER TABLE phpbb_privmsgs_to_2 CHANGE `msg_id` `msg_id` MEDIUMINT( 8 ) UNSIGNED NOT NULL;")
+#increase ids
+cursor.execute("update phpbb_privmsgs_to_2 set msg_id = msg_id + %s;" % maxmsg)
+
+cursor.execute("CREATE TABLE phpbb_privmsgs_3 (msg_id MEDIUMINT( 8 ),to_address TEXT,bcc_address TEXT);")
+
+
+
+
+##CALL STORED PROCEEDURE HERE
+
+
+
+
+cursor.execute("update phpbb_privmsgs_2, phpbb_privmsgs_3 set phpbb_privmsgs_2.to_address = phpbb_privmsgs_3.to_address where phpbb_privmsgs_2.msg_id = phpbb_privmsgs_3.msg_id;")
+
+#merge
+cursor.execute("INSERT INTO phpbb_privmsgs (msg_id, root_level, author_id, icon_id, author_ip, message_time, enable_bbcode, enable_smilies, enable_magic_url, enable_sig, message_subject, message_text, message_edit_reason, message_edit_user, message_attachment, bbcode_bitfield, bbcode_uid, message_edit_time, message_edit_count, to_address, bcc_address) select msg_id, root_level, author_id, icon_id, author_ip, message_time, enable_bbcode, enable_smilies, enable_magic_url, enable_sig, message_subject, message_text, message_edit_reason, message_edit_user, message_attachment, bbcode_bitfield, bbcode_uid, message_edit_time, message_edit_count, to_address, bcc_address from phpbb_privmsgs_2;")
+
+cursor.execute("INSERT INTO phpbb_privmsgs_to (msg_id, user_id, author_id, pm_deleted, pm_new, pm_unread, pm_replied, pm_marked, pm_forwarded, folder_id) select msg_id, user_id, author_id, pm_deleted, pm_new, pm_unread, pm_replied, pm_marked, pm_forwarded, folder_id from phpbb_privmsgs_to_2;")
+
+
+
+
+
+
+
+
+this stored proceedure into mysql
+
+replace 133 with maxuser from script
+
+
+
+
+
+
+delimiter ;;
+CREATE PROCEDURE msgto()
+BEGIN
+ DECLARE userid MEDIUMINT(8);
+ DECLARE useridold MEDIUMINT(8);
+ DECLARE done INT DEFAULT 0;
+ DECLARE myid MEDIUMINT(8);
+ DECLARE touser int;
+ DECLARE toadr text;
+ DECLARE bccadr text;
+ declare cur1 cursor for select msg_id, to_address, bcc_address from phpbb_privmsgs_2;
+ open cur1;
+ repeat
+ fetch cur1 into myid, toadr, bccadr;
+ if instr(toadr,':') = 0 and instr(toadr,'u_') = 1 THEN
+ set touser=convert(right(toadr,length(toadr)-2), UNSIGNED);
+ set touser=touser + 133;
+ set useridold=0;
+ select user_id, user_id_old into userid, useridold from phpbb_users_2
+ where user_id_old=touser;
+ if useridold >=1 then
+ set touser=userid;
+ end if;
+ end if;
+ insert into phpbb_privmsgs_3 values (myid, concat('u_', convert(touser, char)), bccadr);
+ UNTIL done END REPEAT;
+ close cur1;
+end;;