[dw-free] Remove meme tracker
[commit: http://hg.dwscoalition.org/dw-free/rev/0d3e89efccea]
http://bugs.dwscoalition.org/show_bug.cgi?id=426
Remove meme tracker.
Patch by
denise.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=426
Remove meme tracker.
Patch by
![[staff profile]](https://www.dreamwidth.org/img/silk/identity/user_staff.png)
Files modified:
- bin/maint/clean_caches.pl
- bin/maint/stats.pl
- bin/upgrading/en.dat
- bin/upgrading/update-db-general.pl
- cgi-bin/crumbs.pl
- cgi-bin/ljlib.pl
- cgi-bin/ljprotocol.pl
- doc/raw/lj.book/install/ljconfig.disabled.xml
- doc/raw/lj.book/intro/why.xml
- htdocs/meme.bml
- htdocs/meme.bml.text
-------------------------------------------------------------------------------- diff -r 6fc6eeced631 -r 0d3e89efccea bin/maint/clean_caches.pl --- a/bin/maint/clean_caches.pl Wed Mar 04 15:36:34 2009 +0000 +++ b/bin/maint/clean_caches.pl Wed Mar 04 16:00:11 2009 +0000 @@ -78,14 +78,6 @@ } } } - - print "-I- Cleaning meme.\n"; - do { - $sth = $dbh->prepare("DELETE FROM meme WHERE ts < DATE_SUB(NOW(), INTERVAL 7 DAY) LIMIT 250"); - $sth->execute; - if ($dbh->err) { print $dbh->errstr; } - print " deleted ", $sth->rows, "\n"; - } while ($sth->rows && ! $sth->err); print "-I- Cleaning old pending comments.\n"; $count = 0; diff -r 6fc6eeced631 -r 0d3e89efccea bin/maint/stats.pl --- a/bin/maint/stats.pl Wed Mar 04 15:36:34 2009 +0000 +++ b/bin/maint/stats.pl Wed Mar 04 16:00:11 2009 +0000 @@ -13,7 +13,7 @@ require "$ENV{'LJHOME'}/cgi-bin/statslib { my @which = @_ || qw(users countries states gender clients - pop_interests meme popfaq + pop_interests popfaq schools); # popular faq items @@ -77,34 +77,6 @@ require "$ENV{'LJHOME'}/cgi-bin/statslib }, }); - - # popular memes - LJ::Stats::register_stat - ({ 'type' => "global", - 'jobname' => "meme", - 'statname' => "popmeme", - 'handler' => - sub { - my $db_getter = shift; - return undef unless ref $db_getter eq 'CODE'; - my $db = $db_getter->(); - return undef unless $db; - - return {} if $LJ::DISABLED{'meme'}; - - my $sth = $db->prepare("SELECT url, count(*) FROM meme " . - "GROUP BY 1 ORDER BY 2 DESC LIMIT 100"); - $sth->execute; - die $db->errstr if $db->err; - - my %ret; - while (my ($url, $count) = $sth->fetchrow_array) { - $ret{$url} = $count; - } - - return \%ret; - }, - }); # clients LJ::Stats::register_stat @@ -542,25 +514,5 @@ require "$ENV{'LJHOME'}/cgi-bin/statslib print "-I- Done.\n"; }; -$maint{'memeclean'} = sub -{ - my $dbh = LJ::get_db_writer(); - - print "-I- Cleaning memes.\n"; - my $sth = $dbh->prepare("SELECT statkey FROM stats WHERE statcat='popmeme'"); - $sth->execute; - die $dbh->errstr if $dbh->err; - - while (my $url = $sth->fetchrow_array) { - my $copy = $url; - LJ::run_hooks("canonicalize_url", \$copy); - unless ($copy) { - my $d = $dbh->quote($url); - $dbh->do("DELETE FROM stats WHERE statcat='popmeme' AND statkey=$d"); - print " deleting: $url\n"; - } - } - print "-I- Done.\n"; -}; 1; diff -r 6fc6eeced631 -r 0d3e89efccea bin/upgrading/en.dat --- a/bin/upgrading/en.dat Wed Mar 04 15:36:34 2009 +0000 +++ b/bin/upgrading/en.dat Wed Mar 04 16:00:11 2009 +0000 @@ -543,8 +543,6 @@ crumb.managecommunity=Community Manageme crumb.managecommunity=Community Management crumb.managelogins=Manage Your Login Sessions - -crumb.meme=Meme Tracker crumb.memories=Memorable Posts diff -r 6fc6eeced631 -r 0d3e89efccea bin/upgrading/update-db-general.pl --- a/bin/upgrading/update-db-general.pl Wed Mar 04 15:36:34 2009 +0000 +++ b/bin/upgrading/update-db-general.pl Wed Mar 04 16:00:11 2009 +0000 @@ -969,6 +969,7 @@ register_tabledrop("themedata"); register_tabledrop("themedata"); register_tabledrop("themelist"); register_tabledrop("style"); +register_tabledrop("meme"); register_tablecreate("portal", <<'EOC'); CREATE TABLE portal ( @@ -1083,18 +1084,6 @@ CREATE TABLE acctcode_request ( timeprocessed INT UNSIGNED, INDEX (userid) -) -EOC - -register_tablecreate("meme", <<'EOC'); -CREATE TABLE meme ( - url VARCHAR(150) NOT NULL, - posterid INT UNSIGNED NOT NULL, - UNIQUE (url, posterid), - ts TIMESTAMP, - itemid INT UNSIGNED NOT NULL, - - INDEX (ts) ) EOC @@ -3330,12 +3319,6 @@ register_alter(sub { "ADD is_public ENUM('1', '0') DEFAULT '1' NOT NULL"); } - # cluster stuff! - if (column_type("meme", "journalid") eq "") { - do_alter("meme", - "ALTER TABLE meme ADD journalid INT UNSIGNED NOT NULL AFTER ts"); - } - if (column_type("memorable", "jitemid") eq "") { do_alter("memorable", "ALTER TABLE memorable ". "DROP INDEX userid, DROP INDEX itemid, ". diff -r 6fc6eeced631 -r 0d3e89efccea cgi-bin/crumbs.pl --- a/cgi-bin/crumbs.pl Wed Mar 04 15:36:34 2009 +0000 +++ b/cgi-bin/crumbs.pl Wed Mar 04 16:00:11 2009 +0000 @@ -56,7 +56,6 @@ use Errno qw(ENOENT); 'managetags' => ['Manage Tags', '/manage/tags.bml', 'manage'], 'managelogins' => ['Manage Your Login Sessions', '/manage/logins.bml', 'manage'], 'manageuserpics' => ['Manage Userpics', '/editpics.bml', 'manage'], - 'meme' => ['Meme Tracker', '/meme.bml', 'home'], 'memories' => ['Memorable Posts', '/tools/memories.bml', 'manage'], 'mobilepost' => ['Mobile Post Settings', '/manage/emailpost.bml', 'manage'], 'moderate' => ['Community Moderation', '/community/moderate.bml', 'community'], diff -r 6fc6eeced631 -r 0d3e89efccea cgi-bin/ljlib.pl --- a/cgi-bin/ljlib.pl Wed Mar 04 15:36:34 2009 +0000 +++ b/cgi-bin/ljlib.pl Wed Mar 04 16:00:11 2009 +0000 @@ -744,34 +744,6 @@ sub get_urls sub get_urls { return ($_[0] =~ m!https?://[^\s\"\'\<\>]+!g); -} - -# <LJFUNC> -# name: LJ::record_meme -# des: Records a URL reference from a journal entry to the [dbtable[meme]] table. -# args: dbarg?, url, posterid, itemid, journalid? -# des-url: URL to log -# des-posterid: Userid of person posting -# des-itemid: Itemid URL appears in. This is the display itemid, -# which is the jitemid*256+anum from the [dbtable[log2]] table. -# des-journalid: Optional, journal id of item, if item is clustered. Otherwise -# this should be zero or undef. -# </LJFUNC> -sub record_meme -{ - my ($url, $posterid, $itemid, $jid) = @_; - return if $LJ::DISABLED{'meme'}; - - $url =~ s!/$!!; # strip / at end - LJ::run_hooks("canonicalize_url", \$url); - - # canonicalize_url hook might just erase it, so - # we don't want to record it. - return unless $url; - - my $dbh = LJ::get_db_writer(); - $dbh->do("REPLACE DELAYED INTO meme (url, posterid, journalid, itemid) " . - "VALUES (?, ?, ?, ?)", undef, $url, $posterid, $jid, $itemid); } # <LJFUNC> diff -r 6fc6eeced631 -r 0d3e89efccea cgi-bin/ljprotocol.pl --- a/cgi-bin/ljprotocol.pl Wed Mar 04 15:36:34 2009 +0000 +++ b/cgi-bin/ljprotocol.pl Wed Mar 04 16:00:11 2009 +0000 @@ -1422,15 +1422,6 @@ sub postevent } } #### /embedding - - ### extract links for meme tracking - unless ($req->{'security'} eq "usemask" || - $req->{'security'} eq "private") - { - foreach my $url (LJ::get_urls($event)) { - LJ::record_meme($url, $posterid, $ditemid, $ownerid); - } - } # record journal's disk usage my $bytes = length($event) + length($req->{'subject'}); diff -r 6fc6eeced631 -r 0d3e89efccea doc/raw/lj.book/install/ljconfig.disabled.xml --- a/doc/raw/lj.book/install/ljconfig.disabled.xml Wed Mar 04 15:36:34 2009 +0000 +++ b/doc/raw/lj.book/install/ljconfig.disabled.xml Wed Mar 04 16:00:11 2009 +0000 @@ -76,10 +76,6 @@ <varlistentry> <term>ljmaint_tasks</term> <listitem><simpara>Enable running of maintenance tasks by <filename>ljmaint.pl</filename>.</simpara></listitem> - </varlistentry> - <varlistentry> - <term>meme</term> - <listitem><simpara>Enable the meme-tracking feature for users to view a list of &url;s referenced in journal entries.</simpara></listitem> </varlistentry> <varlistentry> <term>portal</term> diff -r 6fc6eeced631 -r 0d3e89efccea doc/raw/lj.book/intro/why.xml --- a/doc/raw/lj.book/intro/why.xml Wed Mar 04 15:36:34 2009 +0000 +++ b/doc/raw/lj.book/intro/why.xml Wed Mar 04 16:00:11 2009 +0000 @@ -300,13 +300,6 @@ <listitem><simpara>The Schools Directory lets a user search for users and communities associated with a specific school from around the world.</simpara></listitem> </varlistentry> - <varlistentry> - <term>meme tracking</term> - <listitem><simpara>Users can view a list of &url;s that have been most - referenced in journal entries site-wide. Users can also check to see where - those &url;s are being referenced. (By some slight alteration, users can - also see if anyone on your installation is linking to a specific &url;, and where.)</simpara></listitem> - </varlistentry> <varlistentry> <term>Random feature</term> <listitem><simpara>Users can view a random journal from a subset of users who diff -r 6fc6eeced631 -r 0d3e89efccea htdocs/meme.bml --- a/htdocs/meme.bml Wed Mar 04 15:36:34 2009 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +0,0 @@ -<?_code - - $title = "Meme Tracker"; - $body = ""; - - LJ::set_active_crumb('meme'); - - if ($LJ::DISABLED{'meme'}) { - $body .= $ML{'.meme.disabled'}; - return; - } - - my $dbr = LJ::get_db_reader(); - my $sth; - - if ($GET{'url'}) { - my $url = $GET{'url'}; - my $skip = $GET{'skip'}; - my $qskip = $skip+0; - my $qurl = $dbr->quote($url); - my $eurl = LJ::ehtml($url); - my $uurl = LJ::eurl($url); - - $body .= "<?h1 Who linked this? h1?><?p The following journal entries link to:<blockquote><a href='$eurl'><b>$eurl</b></a></blockquote>p?>"; - - $body .= "<table>"; - $body .= "<tr align='left'><td width='100'><b>User</b></td><td><b>Post Link</b></td></tr>\n"; - - $sth = $dbr->prepare("SELECT u.user, m.itemid FROM meme m LEFT JOIN useridmap u ON m.journalid=u.userid WHERE m.url=$qurl LIMIT $qskip,500"); - $sth->execute; - my $count = 0; - while (my ($journal, $itemid) = $sth->fetchrow_array) - { - $body .= "<tr align='left'><td>"; - $body .= "<?ljuser $journal ljuser?>" if $journal; - $body .= "</td>"; - my $jarg = $journal ? "journal=$journal&" : ""; - $body .= "<td><a href='$LJ::SITEROOT/talkread.bml?${jarg}itemid=$itemid'>post</a></td>"; - $body .= "</tr>"; - $count++; - } - - $body .= "</table>"; - - my @pagers; - if ($skip > 0) { - my $newskip = $skip - 500; - push @pagers, "<< <a href='meme.bml?url=$uurl&skip=$newskip'>Previous 500</a>"; - } - if ($count == 500) { - my $newskip = 500; - if ($skip) { $newskip = $skip + 500; } - push @pagers, "<a href='meme.bml?url=$uurl&skip=$newskip'>Next 500</a> >>"; - } - if (@pagers) { - $body .= "<p>[ " . join(" | ", @pagers) . " ]</p>"; - } - - $body .= "<?hr?><< <a href='meme.bml'>Back to Meme Listing</a>"; - return; - } - - $body .= "<?h1 Top 40 $LJ::SITENAME Memes h1?>\n"; - $body .= "<?p From this page you can see the most popular URLs referenced recently. p?><?hr?>"; - - $sth = $dbr->prepare("SELECT statkey, statval FROM stats WHERE statcat='popmeme' ORDER BY 2 DESC LIMIT 100"); - $sth->execute; - - $body .= "<table>\n"; - $body .= "<tr align='left'><td width='50' align='left'><b>Count</b></td><td><b>URL</b></td></tr>\n"; - while (my ($url, $ct) = $sth->fetchrow_array) { - my $eurl = LJ::ehtml($url); - my $uurl = LJ::eurl($url); - $body .= "<tr align='left'><td><b><a href='meme.bml?url=$uurl'><nobr>$ct links</nobr></a></b></td>"; - $body .= "<td><a href='$eurl'>$eurl</a></td></tr>\n"; - } - $body .= "</table>"; - $body .= "<?h2 Disclaimer h2?>"; - $body .= "<?p Many of the links on this page lead to external sites that are not controlled by $LJ::SITENAME. $LJ::SITENAME can not be held responsible for the content of these external sites. p?>"; - $sth->finish; - return; - - -_code?><?page -title=><?_code return $title; _code?> -body=><?_code return $body; _code?> -page?><?_c <LJDEP> -link: htdocs/talkread.bml, htdocs/meme.bml -lib: cgi-bin/cleanhtml.pl -</LJDEP> _c?> diff -r 6fc6eeced631 -r 0d3e89efccea htdocs/meme.bml.text --- a/htdocs/meme.bml.text Wed Mar 04 15:36:34 2009 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -;; -*- coding: utf-8 -*- -.meme.disabled=The site administrator has disabled this feature. - --------------------------------------------------------------------------------