Remove unused legacy userpic/userpicmap tables.

        Patch by kareila. 

diffs (115 lines):

diff -r e07e5004e51e -r dfc1947a7c78 bin/upgrading/base-data.sql
--- a/bin/upgrading/base-data.sql       Wed Oct 21 18:00:15 2009 +0000
+++ b/bin/upgrading/base-data.sql       Wed Oct 21 18:02:28 2009 +0000
@@ -873,7 +873,6 @@ REPLACE INTO schematables (des, public_b
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Global. Stores data for mapping a userid to an external 
identity and its type.\n\r\nThis focuses on OpenID consumer support, and was 
introduced so infrastructure was in place to make it completely identity-system 
neutral rather than OpenID-specific.\r\n\r\nIn theory, eventually, this will 
allow people to log in with TypeKey, LID, etc.', '0', 'off', NULL, 
'identitymap');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Global. Stores data for mapping pollid <=> journalid.', 
'0', 'off', NULL, 'pollowner');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Global. Stores data for mapping userid <=> user(name).', 
'0', 'off', NULL, 'useridmap');
-REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Global. Stores data for mapping userpic [dbtable[keywords]] 
to [dbtable[userpic]]s. Please see also the clustered [dbtable[userpicmap2]] 
table, used from data version 7.', '0', 'off', NULL, 'userpicmap');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Global. Stores data for mapping value of unique cookie <=> 
userid.', '0', 'off', NULL, 'uniqmap');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Global. Stores data for site pages tagged using the 
htdocs/admin/navtag.bml tool. Site administrators can tag any URL.\n\r\nThe tag 
itself is lowercase UTF-8. Some are recognized as special (FAQs, user profile 
pages, etc.), and users can then search by tag.', '0', 'off', NULL, 'navtag');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Global. Stores data for the Question of the Day 
(\"Writer\'s Block\") widget.', '0', 'off', NULL, 'qotd');
@@ -917,7 +916,6 @@ REPLACE INTO schematables (des, public_b
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Global. Stores user e-mail addresses, which were 
historically stored in the [dbtable[user]] table.', '0', 'off', NULL, 'email');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Global. Stores user login passwords, which were 
historically stored in the [dbtable[user]] table.', '0', 'off', NULL, 
'password');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Global. Stores user-owned domain names, and which journals 
they map to when pointed at the LiveJournal installation\'s IP address.', '0', 
'off', NULL, 'domains');
-REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Global. Stores userpic metadata. For sites using data 
version 7 or greater, the clustered [dbtable[userpic2]] table is used. Please 
see also [dbtable[userpicmap]] and [dbtable[keywords]].', '0', 'off', NULL, 
'userpic');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Global. Stores worker(s) result storage status.', '0', 
'off', NULL, 'jobstatus');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Global. Table required by DBI::Role for procnotify - the 
function used to pass a message to all web processes on all clusters.', '0', 
'off', NULL, 'procnotify');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Global. Used by the move user cluster script. Both before 
and after updating a user\'s read-only flag we add the user to this table, 
which is just an index onto users who - might - be in read-only.\n\r\nA 
maintenance task will periodically clean those and make sure nobody is stranded 
in read-only, without resorting to a full tablescan of the [dbtable[user]] 
table, by checking if users are still locked, removing those that are not from 
this table, querying the job server (if up) for users that are still locked and 
unlocking those that can be unlocked.', '0', 'off', NULL, 'readonly_user');
diff -r e07e5004e51e -r dfc1947a7c78 bin/upgrading/update-db-general.pl
--- a/bin/upgrading/update-db-general.pl        Wed Oct 21 18:00:15 2009 +0000
+++ b/bin/upgrading/update-db-general.pl        Wed Oct 21 18:02:28 2009 +0000
@@ -524,23 +524,6 @@ CREATE TABLE userinterests (
 )
 EOC
 
-register_tablecreate("userpic", <<'EOC');
-CREATE TABLE userpic (
-    picid int(10) unsigned NOT NULL auto_increment,
-    userid int(10) unsigned NOT NULL default '0',
-    contenttype char(25) default NULL,
-    width smallint(6) NOT NULL default '0',
-    height smallint(6) NOT NULL default '0',
-    state char(1) NOT NULL default 'N',
-    picdate datetime default NULL,
-    md5base64 char(22) NOT NULL default '',
-
-    PRIMARY KEY  (picid),
-    KEY (userid),
-    KEY (state)
-)
-EOC
-
 register_tablecreate("userpicblob2", <<'EOC');
 CREATE TABLE userpicblob2 (
     userid int unsigned not null,
@@ -549,16 +532,6 @@ CREATE TABLE userpicblob2 (
 
     PRIMARY KEY (userid, picid)
 ) max_rows=10000000
-EOC
-
-register_tablecreate("userpicmap", <<'EOC');
-CREATE TABLE userpicmap (
-    userid int(10) unsigned NOT NULL default '0',
-    kwid int(10) unsigned NOT NULL default '0',
-    picid int(10) unsigned NOT NULL default '0',
-
-    PRIMARY KEY  (userid,kwid)
-)
 EOC
 
 register_tablecreate("userpicmap2", <<'EOC');
@@ -892,6 +865,8 @@ register_tabledrop("memorable");
 register_tabledrop("memorable");
 register_tabledrop("s2source");
 register_tabledrop("s2stylelayers");
+register_tabledrop("userpic");
+register_tabledrop("userpicmap");
 
 register_tablecreate("infohistory", <<'EOC');
 CREATE TABLE infohistory (
diff -r e07e5004e51e -r dfc1947a7c78 cgi-bin/ljlib.pl
--- a/cgi-bin/ljlib.pl  Wed Oct 21 18:00:15 2009 +0000
+++ b/cgi-bin/ljlib.pl  Wed Oct 21 18:02:28 2009 +0000
@@ -2048,7 +2048,12 @@ sub alloc_global_counter
     if ($dom eq "S") {
         confess 'Tried to allocate S1 counter.';
     } elsif ($dom eq "P") {
-        $newmax = $dbh->selectrow_array("SELECT MAX(picid) FROM userpic");
+        $newmax = 0;
+        foreach my $cid ( @LJ::CLUSTERS ) {
+            my $dbcm = LJ::get_cluster_master( $cid ) or return undef;
+            my $max = $dbcm->selectrow_array( 'SELECT MAX(picid) FROM 
userpic2' ) + 0;
+            $newmax = $max if $max > $newmax;
+        }
     } elsif ($dom eq "C") {
         $newmax = $dbh->selectrow_array("SELECT MAX(capid) FROM captchas");
     } elsif ($dom eq "E" || $dom eq "M") {
diff -r e07e5004e51e -r dfc1947a7c78 cgi-bin/ljuserpics.pl
--- a/cgi-bin/ljuserpics.pl     Wed Oct 21 18:00:15 2009 +0000
+++ b/cgi-bin/ljuserpics.pl     Wed Oct 21 18:02:28 2009 +0000
@@ -15,22 +15,6 @@ sub load_userpics
     my ($upics, $idlist) = @_;
 
     return undef unless ref $idlist eq 'ARRAY' && $idlist->[0];
-
-    # deal with the old calling convention, just an array ref of picids eg. 
[7, 4, 6, 2]
-    if (! ref $idlist->[0] && $idlist->[0]) { # assume we have an old style 
caller
-        my $in = join(',', map { $_+0 } @$idlist);
-        my $dbr = LJ::get_db_reader();
-        my $sth = $dbr->prepare("SELECT userid, picid, width, height " .
-                                "FROM userpic WHERE picid IN ($in)");
-
-        $sth->execute;
-        while ($_ = $sth->fetchrow_hashref) {
-            my $id = $_->{'picid'};
-            undef $_->{'picid'};
-            $upics->{$id} = $_;
-        }
-        return;
-    }
 
     # $idlist needs to be an arrayref of arrayrefs,
     # HOWEVER, there's a special case where it can be
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog

Reply via email to