Bug 160112 - clean up quip table conversion code

r=joel x2
parent 7891f2ea
...@@ -658,7 +658,6 @@ unless (-d 'data' && -e 'data/nomail') { ...@@ -658,7 +658,6 @@ unless (-d 'data' && -e 'data/nomail') {
# permissions for non-webservergroup are fixed later on # permissions for non-webservergroup are fixed later on
mkdir 'data', 0770; mkdir 'data', 0770;
mkdir 'data/mimedump-tmp', 01777; mkdir 'data/mimedump-tmp', 01777;
open FILE, '>>data/comments'; close FILE;
open FILE, '>>data/nomail'; close FILE; open FILE, '>>data/nomail'; close FILE;
open FILE, '>>data/mail'; close FILE; open FILE, '>>data/mail'; close FILE;
} }
...@@ -3044,29 +3043,20 @@ if (!GetFieldDef("bugs", "alias")) { ...@@ -3044,29 +3043,20 @@ if (!GetFieldDef("bugs", "alias")) {
# 2002-07-15 davef@tetsubo.com - bug 67950 # 2002-07-15 davef@tetsubo.com - bug 67950
# Move quips to the db. # Move quips to the db.
my $renamed_comments_file = 0; if (-r 'data/comments' && -s 'data/comments'
if (GetFieldDef("quips", "quipid")) { && open (COMMENTS, "<data/comments")) {
if (-e 'data/comments' && open (COMMENTS, "<data/comments")) { print "Populating quips table from data/comments...\n\n";
print "Populating quips table from data/comments...\n"; while (<COMMENTS>) {
while (<COMMENTS>) { chomp;
chomp; $dbh->do("INSERT INTO quips (quip) VALUES ("
$dbh->do("INSERT INTO quips (quip) VALUES (" . $dbh->quote($_) . ")");
. $dbh->quote($_) . ")");
}
print "The data/comments file (used to store quips) has been
copied into the database, and the data/comments file
moved to data/comments.bak - you can delete this file
once you're satisfied the migration worked correctly.\n\n";
close COMMENTS;
rename("data/comments", "data/comments.bak") or next;
$renamed_comments_file = 1;
} }
} print "The data/comments file (used to store quips) has been copied into\n" .
"the database, and the data/comments file moved to data/comments.bak - \n" .
# Warn if data/comments.bak exists, as it should be deleted. "you can delete this fileonce you're satisfied the migration worked\n" .
if (-e 'data/comments.bak' && !$renamed_comments_file) { "correctly.\n\n";
print "The data/comments.bak file can be removed, as it's no longer close COMMENTS;
used.\n\n"; rename("data/comments", "data/comments.bak");
} }
# 2002-07-31 bbaetz@student.usyd.edu.au bug 158236 # 2002-07-31 bbaetz@student.usyd.edu.au bug 158236
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment