Enforce new mood theme URL limit of 200 characters.
Patch by yvi.
diffs (37 lines):
diff -r 896d4a9b6a82 -r dc52fa288638 bin/upgrading/update-db-general.pl
--- a/bin/upgrading/update-db-general.pl Tue Jul 28 15:16:20 2009 +0000
+++ b/bin/upgrading/update-db-general.pl Tue Jul 28 18:48:15 2009 -0500
@@ -248,7 +248,7 @@ CREATE TABLE moodthemedata (
CREATE TABLE moodthemedata (
moodthemeid int(10) unsigned NOT NULL default '0',
moodid int(10) unsigned NOT NULL default '0',
- picurl varchar(100) default NULL,
+ picurl varchar(200) default NULL,
width tinyint(3) unsigned NOT NULL default '0',
height tinyint(3) unsigned NOT NULL default '0',
@@ -3456,6 +3456,12 @@ register_alter(sub {
"MODIFY keyword VARCHAR(80) BINARY NOT NULL");
}
+ #allow longer moodtheme pic URLs
+ if (column_type("moodthemedata", "picurl") eq "varchar(100)") {
+ do_alter("moodthemedata",
+ "ALTER TABLE moodthemedata MODIFY picurl VARCHAR(200)");
+ }
+
# change interest.interest key to being unique, if it's not already
{
my $sth = $dbh->prepare("SHOW INDEX FROM interests");
diff -r 896d4a9b6a82 -r dc52fa288638
cgi-bin/LJ/Console/Command/MoodthemeSetpic.pm
--- a/cgi-bin/LJ/Console/Command/MoodthemeSetpic.pm Tue Jul 28 15:16:20
2009 +0000
+++ b/cgi-bin/LJ/Console/Command/MoodthemeSetpic.pm Tue Jul 28 18:48:15
2009 -0500
@@ -45,6 +45,8 @@ sub execute {
if (!$picurl || $width == 0 || $height == 0) {
$dbh->do("DELETE FROM moodthemedata WHERE moodthemeid = ? AND moodid=
?", undef, $themeid, $moodid);
$self->print("Data deleted for theme #$themeid, mood #$moodid.");
+ } elsif ( length($picurl) > 200 ) {
+ $self->error("Moodpic URLs cannot exceed 200 characters.");
} else {
$dbh->do("REPLACE INTO moodthemedata (moodthemeid, moodid, picurl,
width, height) VALUES (?, ?, ?, ?, ?)",
undef, $themeid, $moodid, $picurl, $width, $height);
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog