r90050 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r90049‎ | r90050 | r90051 >
Date:14:50, 14 June 2011
Author:janpaul123
Status:ok (Comments)
Tags:
Comment:
Actually fills the database with registration and edit count data now. Removed the recent edit count as I don't see a way to efficiently include that right now.
Modified paths:
  • /trunk/extensions/WikiLove/WikiLove.api.php (modified) (history)
  • /trunk/extensions/WikiLove/patches/WikiLoveLog.sql (modified) (history)

Diff [purge]

Index: trunk/extensions/WikiLove/WikiLove.api.php
@@ -56,15 +56,26 @@
5757 private function saveInDb( $talk, $subject, $message, $type, $email ) {
5858 global $wgUser;
5959 $dbw = wfGetDB( DB_MASTER );
 60+ $receiver = User::newFromName( $talk->getSubjectPage()->getBaseText() );
 61+ if ( $receiver->isAnon() ) {
 62+ $this->setWarning( 'Not logging anonymous recipients' );
 63+ return;
 64+ }
 65+
6066 $values = array(
6167 'wll_timestamp' => $dbw->timestamp(),
6268 'wll_sender' => $wgUser->getId(),
63 - 'wll_receiver' => User::newFromName( $talk->getSubjectPage()->getBaseText() )->getId(),
 69+ 'wll_sender_editcount' => $wgUser->getEditCount(),
 70+ 'wll_sender_registration' => $wgUser->getRegistration(),
 71+ 'wll_receiver' => $receiver->getId(),
 72+ 'wll_receiver_editcount' => $receiver->getEditCount(),
 73+ 'wll_receiver_registration' => $receiver->getRegistration(),
6474 'wll_type' => $type,
6575 'wll_subject' => $subject,
6676 'wll_message' => $message,
6777 'wll_email' => $email,
6878 );
 79+
6980 try{
7081 $dbw->insert( 'wikilove_log', $values, __METHOD__ );
7182 } catch( DBQueryError $dbqe ) {
Index: trunk/extensions/WikiLove/patches/WikiLoveLog.sql
@@ -8,13 +8,11 @@
99 wll_id int NOT NULL PRIMARY KEY auto_increment, -- unique id
1010 wll_timestamp binary(14) NOT NULL, -- timestamp
1111 wll_sender int(11) NOT NULL, -- user id of the sender
12 - wll_sender_registration varchar(16) default NULL, -- registration date of the sender
13 - wll_sender_totaledits mediumint(8) default NULL, -- total number of edits for the sender
14 - wll_sender_recentedits smallint(6) default NULL, -- number of recent edits for the sender
 12+ wll_sender_registration binary(14) default NULL, -- registration date of the sender
 13+ wll_sender_editcount int(11) default NULL, -- total number of edits for the sender
1514 wll_receiver int(11) NOT NULL, -- user id of the receiver
16 - wll_receiver_registration varchar(16) default NULL, -- registration date of the receiver
17 - wll_receiver_totaledits mediumint(8) default NULL, -- total number of edits for the receiver
18 - wll_receiver_recentedits smallint(6) default NULL, -- number of recent edits for the receiver
 15+ wll_receiver_registration binary(14) default NULL, -- registration date of the receiver
 16+ wll_receiver_editcount int(11) default NULL, -- total number of edits for the receiver
1917 wll_type varchar(64) NOT NULL, -- type (and subtype) of message
2018 wll_subject varchar(255) NOT NULL, -- subject line
2119 wll_message blob NOT NULL, -- actual message

Comments

#Comment by Kaldari (talk | contribs)   21:01, 15 June 2011

Does SQLite support the binary datatype?

#Comment by Platonides (talk | contribs)   21:05, 15 June 2011

I think it would get numeric affinity... [1]

#Comment by Kaldari (talk | contribs)   22:11, 15 June 2011

Ah, that's interesting. Works for me.

Status & tagging log