[dw-free] update cgi-bin/LJ/ConfCheck/General.pm
[commit: http://hg.dwscoalition.org/dw-free/rev/116bf9136f18]
http://bugs.dwscoalition.org/show_bug.cgi?id=2229
Remove talk_max_urls & related table commenturls
Patch by
kareila.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=2229
Remove talk_max_urls & related table commenturls
Patch by
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Files modified:
- bin/maint/clean_caches.pl
- bin/upgrading/base-data.sql
- bin/upgrading/update-db-general.pl
- cgi-bin/LJ/ConfCheck/General.pm
- cgi-bin/LJ/Talk.pm
- doc/raw/build/ljconfig/ljconfig2db.pl
-------------------------------------------------------------------------------- diff -r a8d460b97735 -r 116bf9136f18 bin/maint/clean_caches.pl --- a/bin/maint/clean_caches.pl Thu Apr 29 00:14:59 2010 -0700 +++ b/bin/maint/clean_caches.pl Thu Apr 29 01:15:28 2010 -0700 @@ -28,9 +28,6 @@ print "-I- Cleaning duplock.\n"; $dbh->do("DELETE FROM duplock WHERE instime < DATE_SUB(NOW(), INTERVAL 1 HOUR)"); - - print "-I- Cleaning commenturl.\n"; - $dbh->do("DELETE FROM commenturls WHERE timecreate < UNIX_TIMESTAMP() - 86400*30 LIMIT 50000"); print "-I- Cleaning underage uniqs.\n"; $dbh->do("DELETE FROM underage WHERE timeof < (UNIX_TIMESTAMP() - 86400*90) LIMIT 2000"); diff -r a8d460b97735 -r 116bf9136f18 bin/upgrading/base-data.sql --- a/bin/upgrading/base-data.sql Thu Apr 29 00:14:59 2010 -0700 +++ b/bin/upgrading/base-data.sql Thu Apr 29 01:15:28 2010 -0700 @@ -853,7 +853,6 @@ REPLACE INTO schematables (des, public_b REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, tablename) VALUES ('Global. Stores \'sysban\' data - the mechanism for banning users from portions of the site based on certain criteria.', '0', 'off', NULL, 'sysban'); REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, tablename) VALUES ('Global. Stores a count of generic actions. A nightly maintenance task (clean_caches) summarizes the clustered [dbtable[recentactions]] tables data here.', '0', 'off', NULL, 'actionhistory'); REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, tablename) VALUES ('Global. Stores a history log of certain types of changes (like user e-mail changes), so the old values can be looked at by administrators or automatically retrieved. Please see also [dbtable[statushistory]].', '0', 'off', NULL, 'infohistory'); -REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, tablename) VALUES ('Global. Stores a log of a given number of URLs from new comments here, when the $LJ::TALK_MAX_URLS site variable is set.', '0', 'off', NULL, 'commenturls'); REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, tablename) VALUES ('Global. Stores a log of when a user is expunged (\'purged\'), by the moveucluster script, so they can be queried later by time or username.', '0', 'off', NULL, 'expunged_users'); REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, tablename) VALUES ('Global. Stores a record of clients that access the protocol.\n\r\nWhenever the protocol encounters a new client, a new row (and thus a new clientid) is generated.', '0', 'off', NULL, 'clients'); REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, tablename) VALUES ('Global. Stores a record that an action has been done, so it doesn\'t get done a second time later by a user accidentally double-clicking a single-click button in their browser.\n\r\nThe idea is that the application should grab a write lock for both the table it\'s inserting into, and the duplock table. Then, check the duplock table for a duplicate. If it\'s already in there, unlock the tables and remember the dupid to tell the user (app should pretend it was the first time... don\'t show an error message!), or if it\'s not in there, put it in the table, and then put the resulting uniqueid from the table handler into the duplock table (as dupid).\r\n\r\nThis table is purged every hour or so of all locks older than an hour.', '0', 'off', NULL, 'duplock'); diff -r a8d460b97735 -r 116bf9136f18 bin/upgrading/update-db-general.pl --- a/bin/upgrading/update-db-general.pl Thu Apr 29 00:14:59 2010 -0700 +++ b/bin/upgrading/update-db-general.pl Thu Apr 29 01:15:28 2010 -0700 @@ -882,6 +882,7 @@ register_tabledrop("schools_pending"); register_tabledrop("schools_pending"); register_tabledrop("user_schools"); register_tabledrop("userblobcache"); +register_tabledrop("commenturls"); register_tablecreate("infohistory", <<'EOC'); CREATE TABLE infohistory ( @@ -1491,19 +1492,6 @@ CREATE TABLE supportprop ( value varchar(255) NOT NULL, PRIMARY KEY (spid, prop) -) -EOC - -# comment urls -register_tablecreate("commenturls", <<'EOC'); # global -CREATE TABLE commenturls ( - posterid int unsigned NOT NULL, - journalid int unsigned NOT NULL, - jtalkid mediumint unsigned NOT NULL, - timecreate int unsigned NOT NULL, - url varchar(255) NOT NULL, - - INDEX (timecreate) ) EOC @@ -3366,13 +3354,6 @@ register_alter(sub { "AFTER posterid"); } - if (column_type("commenturls", "ip") eq '') { - do_alter("commenturls", - "ALTER TABLE commenturls " . - "ADD ip VARCHAR(15) DEFAULT NULL " . - "AFTER journalid"); - } - if (column_type("sessions", "exptype") !~ /once/) { do_alter("sessions", "ALTER TABLE sessions CHANGE COLUMN exptype ". diff -r a8d460b97735 -r 116bf9136f18 cgi-bin/LJ/ConfCheck/General.pm --- a/cgi-bin/LJ/ConfCheck/General.pm Thu Apr 29 00:14:59 2010 -0700 +++ b/cgi-bin/LJ/ConfCheck/General.pm Thu Apr 29 01:15:28 2010 -0700 @@ -433,10 +433,6 @@ add_conf('$TALK_ABORT_REGEXP', type => 'regexp', des => "Regular expression which, when matched on incoming comment bodies, kills the comment."); -add_conf('$TALK_MAX_URLS', - type => 'int', - des => "If set, up to this many URLs will be extracted from comments and stored for analysis."); - add_conf('$TOOLS_RECENT_COMMENTS_MAX', type => 'int', des => "Number of recent comments to show on /tools/recent_comments.bml"); diff -r a8d460b97735 -r 116bf9136f18 cgi-bin/LJ/Talk.pm --- a/cgi-bin/LJ/Talk.pm Thu Apr 29 00:14:59 2010 -0700 +++ b/cgi-bin/LJ/Talk.pm Thu Apr 29 01:15:28 2010 -0700 @@ -2682,28 +2682,6 @@ sub enter_comment { LJ::MemCache::set([$journalu->{'userid'}, "talkprop:$journalu->{'userid'}:$jtalkid"], $hash); } - # record up to 25 (or $LJ::TALK_MAX_URLS) urls from a comment - my (%urls, $dbh); - if ($LJ::TALK_MAX_URLS && - ( %urls = map { $_ => 1 } LJ::get_urls($comment->{body}) ) && - ( $dbh = LJ::get_db_writer() )) # don't log if no db available - { - my (@bind, @vals); - my $ip = LJ::get_remote_ip(); - while (my ($url, undef) = each %urls) { - push @bind, '(?,?,?,?,UNIX_TIMESTAMP(),?)'; - push @vals, $posterid, $journalu->{userid}, $ip, $jtalkid, $url; - last if @bind >= $LJ::TALK_MAX_URLS; - } - my $bind = join(',', @bind); - my $sql = qq{ - INSERT INTO commenturls - (posterid, journalid, ip, jtalkid, timecreate, url) - VALUES $bind - }; - $dbh->do($sql, undef, @vals); - } - # update the "replycount" summary field of the log table if ($comment->{state} eq 'A') { LJ::replycount_do($journalu, $itemid, "incr"); diff -r a8d460b97735 -r 116bf9136f18 doc/raw/build/ljconfig/ljconfig2db.pl --- a/doc/raw/build/ljconfig/ljconfig2db.pl Thu Apr 29 00:14:59 2010 -0700 +++ b/doc/raw/build/ljconfig/ljconfig2db.pl Thu Apr 29 01:15:28 2010 -0700 @@ -76,10 +76,6 @@ my %ljconfig = 'talk_abort_regexp' => { 'desc' => "Regular expression which, when matched on incoming comment bodies, kills the comment.", # How is this different from @talkspam? - }, - 'talk_max_urls' => { - 'desc' => "If set, up to this many &url;s will be extracted from comments and stored (in the [dbtable[commenturls]] table) for analysis.", - 'example' => "500;", }, 'talkspam' => { 'desc' => "Filter comments for spam using this list of regular expressions.", --------------------------------------------------------------------------------