Escaping once is enough.
[lhc/web/wiklou.git] / includes / LogEventsList.php
index f81abec..264096a 100644 (file)
@@ -24,9 +24,9 @@ class LogEventsList {
        private $out;
        public $flags;
 
-       function __construct( &$skin, &$out, $flags = 0 ) {
-               $this->skin =& $skin;
-               $this->out =& $out;
+       function __construct( $skin, $out, $flags = 0 ) {
+               $this->skin = $skin;
+               $this->out = $out;
                $this->flags = $flags;
                $this->preCacheMessages();
        }
@@ -38,8 +38,8 @@ class LogEventsList {
        private function preCacheMessages() {
                // Precache various messages
                if( !isset( $this->message ) ) {
-                       $messages = 'revertmerge protect_change unblocklink revertmove undeletelink revdel-restore rev-delundel';
-                       foreach( explode(' ', $messages ) as $msg ) {
+                       $messages = 'revertmerge protect_change unblocklink revertmove undeletelink revdel-restore rev-delundel hist';
+                       foreach( explode( ' ', $messages ) as $msg ) {
                                $this->message[$msg] = wfMsgExt( $msg, array( 'escape') );
                        }
                }
@@ -47,7 +47,7 @@ class LogEventsList {
 
        /**
         * Set page title and show header for this log type
-        * @param strin $type
+        * @param string $type
         */
        public function showHeader( $type ) {
                if( LogPage::isLogType( $type ) ) {
@@ -62,10 +62,13 @@ class LogEventsList {
         * @param string $user,
         * @param string $page,
         * @param string $pattern
-        * @param int $year
-        * @parm int $month
+        * @param int $year year
+        * @param int $month month
+        * @param bool $filter
         */
-       public function showOptions( $type='', $user='', $page='', $pattern='', $year='', $month='' ) {
+       public function showOptions( $type = '', $user = '', $page = '', $pattern = '', $year = '', 
+                       $month = '', $filter = null ) 
+       {
                global $wgScript, $wgMiserMode;
                $action = htmlspecialchars( $wgScript );
                $title = SpecialPage::getTitleFor( 'Log' );
@@ -79,8 +82,41 @@ class LogEventsList {
                        $this->getTitleInput( $page ) . "\n" .
                        ( !$wgMiserMode ? ($this->getTitlePattern( $pattern )."\n") : "" ) .
                        "<p>" . $this->getDateMenu( $year, $month ) . "\n" .
+                       ( $filter ? "</p><p>".$this->getFilterLinks( $type, $filter )."\n" : "" ) .
                        Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . "</p>\n" .
-                       "</fieldset></form>" );
+                       "</fieldset></form>"
+               );
+       }
+       
+       private function getFilterLinks( $logType, $filter ) {
+               global $wgTitle;
+               // show/hide links
+               $messages = array( wfMsgHtml( 'show' ), wfMsgHtml( 'hide' ) );
+               // Option value -> message mapping
+               $links = array();
+               foreach( $filter as $type => $val ) {
+                       $hideVal = 1 - intval($val);
+                       $link = $this->skin->makeKnownLinkObj( $wgTitle, $messages[$hideVal],
+                               wfArrayToCGI( array( "hide_{$type}_log" => $hideVal ), $this->getDefaultQuery() )
+                       );
+                       $links[$type] = wfMsgHtml( "log-show-hide-{$type}", $link );
+               }
+               // Build links
+               return implode( ' | ', $links );
+       }
+       
+       private function getDefaultQuery() {
+               if ( !isset( $this->mDefaultQuery ) ) {
+                       $this->mDefaultQuery = $_GET;
+                       unset( $this->mDefaultQuery['title'] );
+                       unset( $this->mDefaultQuery['dir'] );
+                       unset( $this->mDefaultQuery['offset'] );
+                       unset( $this->mDefaultQuery['limit'] );
+                       unset( $this->mDefaultQuery['order'] );
+                       unset( $this->mDefaultQuery['month'] );
+                       unset( $this->mDefaultQuery['year'] );
+               }
+               return $this->mDefaultQuery;
        }
 
        /**
@@ -93,19 +129,19 @@ class LogEventsList {
                $html = "<select name='type'>\n";
 
                $validTypes = LogPage::validTypes();
-               $m = array(); // Temporary array
+               $typesByName = array(); // Temporary array
 
                // First pass to load the log names
                foreach( $validTypes as $type ) {
                        $text = LogPage::logName( $type );
-                       $m[$text] = $type;
+                       $typesByName[$text] = $type;
                }
 
                // Second pass to sort by name
-               ksort($m);
+               ksort($typesByName);
 
                // Third pass generates sorted XHTML content
-               foreach( $m as $text => $type ) {
+               foreach( $typesByName as $text => $type ) {
                        $selected = ($type == $queryType);
                        // Restricted types
                        if ( isset($wgLogRestrictions[$type]) ) {
@@ -213,80 +249,88 @@ class LogEventsList {
                $revert = $del = '';
                // Some user can hide log items and have review links
                if( $wgUser->isAllowed( 'deleterevision' ) ) {
-                       $del = $this->showhideLinks( $row ) . ' ';
+                       $del = $this->getShowHideLinks( $row ) . ' ';
                }
                // Add review links and such...
-               if( !($this->flags & self::NO_ACTION_LINK) && !($row->log_deleted & LogPage::DELETED_ACTION) ) {
-                       if( self::typeAction($row,'move','move') && isset( $paramArray[0] ) && $wgUser->isAllowed( 'move' ) ) {
-                               $destTitle = Title::newFromText( $paramArray[0] );
-                               if( $destTitle ) {
-                                       $revert = '(' . $this->skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Movepage' ),
-                                               $this->message['revertmove'],
-                                               'wpOldTitle=' . urlencode( $destTitle->getPrefixedDBkey() ) .
-                                               '&wpNewTitle=' . urlencode( $title->getPrefixedDBkey() ) .
-                                               '&wpReason=' . urlencode( wfMsgForContent( 'revertmove' ) ) .
-                                               '&wpMovetalk=0' ) . ')';
-                               }
-                       // Show undelete link
-                       } else if( self::typeAction($row,'delete','delete') && $wgUser->isAllowed( 'delete' ) ) {
-                               $revert = '(' . $this->skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Undelete' ),
-                                       $this->message['undeletelink'], 'target='. urlencode( $title->getPrefixedDBkey() ) ) . ')';
-                       // Show unblock link
-                       } else if( self::typeAction($row,'block','block') && $wgUser->isAllowed( 'block' ) ) {
-                               $revert = '(' .  $this->skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Ipblocklist' ),
-                                       $this->message['unblocklink'],
-                                       'action=unblock&ip=' . urlencode( $row->log_title ) ) . ')';
-                       // Show change protection link
-                       } else if( self::typeAction($row,'protect','modify') && $wgUser->isAllowed( 'protect' ) ) {
-                               $revert = '(' .  $this->skin->makeKnownLinkObj( $title, $this->message['protect_change'], 'action=unprotect' ) . ')';
-                       // Show unmerge link
-                       } else if ( self::typeAction($row,'merge','merge') ) {
-                               $merge = SpecialPage::getTitleFor( 'Mergehistory' );
-                               $revert = '(' .  $this->skin->makeKnownLinkObj( $merge, $this->message['revertmerge'],
-                                       wfArrayToCGI(
-                                               array('target' => $paramArray[0], 'dest' => $title->getPrefixedText(), 'mergepoint' => $paramArray[1] )
-                                       )
-                               ) . ')';
-                       // If an edit was hidden from a page give a review link to the history
-                       } else if( self::typeAction($row,'delete','revision') && $wgUser->isAllowed( 'deleterevision' ) && isset($paramArray[2]) ) {
+               if( ($this->flags & self::NO_ACTION_LINK) || ($row->log_deleted & LogPage::DELETED_ACTION) ) {
+                       // Action text is suppressed...
+               } else if( self::typeAction($row,'move','move') && !empty($paramArray[0]) && $wgUser->isAllowed( 'move' ) ) {
+                       $destTitle = Title::newFromText( $paramArray[0] );
+                       if( $destTitle ) {
+                               $revert = '(' . $this->skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Movepage' ),
+                                       $this->message['revertmove'],
+                                       'wpOldTitle=' . urlencode( $destTitle->getPrefixedDBkey() ) .
+                                       '&wpNewTitle=' . urlencode( $title->getPrefixedDBkey() ) .
+                                       '&wpReason=' . urlencode( wfMsgForContent( 'revertmove' ) ) .
+                                       '&wpMovetalk=0' ) . ')';
+                       }
+               // Show undelete link
+               } else if( self::typeAction($row,array('delete','suppress'),'delete') && $wgUser->isAllowed( 'delete' ) ) {
+                       $revert = '(' . $this->skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Undelete' ),
+                               $this->message['undeletelink'], 'target='. urlencode( $title->getPrefixedDBkey() ) ) . ')';
+               // Show unblock link
+               } else if( self::typeAction($row,array('block','suppress'),'block') && $wgUser->isAllowed( 'block' ) ) {
+                       $revert = '(' .  $this->skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Ipblocklist' ),
+                               $this->message['unblocklink'],
+                               'action=unblock&ip=' . urlencode( $row->log_title ) ) . ')';
+               // Show change protection link
+               } else if( self::typeAction($row,'protect',array('modify','protect','unprotect')) ) {
+                       $revert .= ' (' .  $this->skin->makeKnownLinkObj( $title, $this->message['hist'], 
+                               'action=history&offset=' . urlencode($row->log_timestamp) ) . ')';
+                       if( $wgUser->isAllowed('protect') && $row->log_action != 'unprotect' ) {
+                               $revert .= ' (' .  $this->skin->makeKnownLinkObj( $title, $this->message['protect_change'], 
+                                       'action=unprotect' ) . ')';
+                       }
+               // Show unmerge link
+               } else if ( self::typeAction($row,'merge','merge') ) {
+                       $merge = SpecialPage::getTitleFor( 'Mergehistory' );
+                       $revert = '(' .  $this->skin->makeKnownLinkObj( $merge, $this->message['revertmerge'],
+                               wfArrayToCGI( array('target' => $paramArray[0], 'dest' => $title->getPrefixedDBkey(), 
+                                       'mergepoint' => $paramArray[1] ) ) ) . ')';
+               // If an edit was hidden from a page give a review link to the history
+               } else if( self::typeAction($row,array('delete','suppress'),'revision') && $wgUser->isAllowed( 'deleterevision' ) ) {
+                       if( count($paramArray) == 2 ) {
                                $revdel = SpecialPage::getTitleFor( 'Revisiondelete' );
                                // Different revision types use different URL params...
-                               $subtype = isset($paramArray[2]) ? $paramArray[1] : '';
-                               // Link to each hidden object ID, $paramArray[1] is the url param. List if several...
-                               $Ids = explode( ',', $paramArray[2] );
-                               if( count($Ids) == 1 ) {
-                                       $revert = $this->skin->makeKnownLinkObj( $revdel, $this->message['revdel-restore'],
-                                               wfArrayToCGI( array('target' => $paramArray[0], $paramArray[1] => $Ids[0] ) ) );
-                               } else {
-                                       $revert .= $this->message['revdel-restore'].':';
-                                       foreach( $Ids as $n => $id ) {
-                                               $revert .= ' '.$this->skin->makeKnownLinkObj( $revdel, '#'.($n+1),
-                                                       wfArrayToCGI( array('target' => $paramArray[0], $paramArray[1] => $id ) ) );
-                                       }
+                               $key = $paramArray[0];
+                               // Link to each hidden object ID, $paramArray[1] is the url param
+                               $Ids = explode( ',', $paramArray[1] );
+                               $revParams = '';
+                               foreach( $Ids as $n => $id ) {
+                                       $revParams .= '&' . urlencode($key) . '[]=' . urlencode($id);
                                }
-                               $revert = "($revert)";
-                       // Hidden log items, give review link
-                       } else if( self::typeAction($row,'delete','event') && $wgUser->isAllowed( 'deleterevision' ) && isset($paramArray[0]) ) {
+                               $revert = '(' . $this->skin->makeKnownLinkObj( $revdel, $this->message['revdel-restore'], 
+                                       'target=' . $title->getPrefixedUrl() . $revParams ) . ')';
+                       }
+               // Hidden log items, give review link
+               } else if( self::typeAction($row,array('delete','suppress'),'event') && $wgUser->isAllowed( 'deleterevision' ) ) {
+                       if( count($paramArray) == 1 ) {
                                $revdel = SpecialPage::getTitleFor( 'Revisiondelete' );
-                               $revert .= $this->message['revdel-restore'];
                                $Ids = explode( ',', $paramArray[0] );
-                               // Link to each hidden object ID, $paramArray[1] is the url param. List if several...
-                               if( count($Ids) == 1 ) {
-                                       $revert = $this->skin->makeKnownLinkObj( $revdel, $this->message['revdel-restore'],
-                                               wfArrayToCGI( array('logid' => $Ids[0] ) ) );
-                               } else {
-                                       foreach( $Ids as $n => $id ) {
-                                               $revert .= $this->skin->makeKnownLinkObj( $revdel, '#'.($n+1),
-                                                       wfArrayToCGI( array('logid' => $id ) ) );
-                                       }
+                               // Link to each hidden object ID, $paramArray[1] is the url param
+                               $logParams = '';
+                               foreach( $Ids as $n => $id ) {
+                                       $logParams .= '&logid[]=' . intval($id);
                                }
-                               $revert = "($revert)";
+                               $revert = '(' . $this->skin->makeKnownLinkObj( $revdel, $this->message['revdel-restore'], 
+                                       'target=' . $title->getPrefixedUrl() . $logParams ) . ')';
+                       }
+               // Self-created users
+               } else if( self::typeAction($row,'newusers','create2') ) {
+                       if( isset( $paramArray[0] ) ) {
+                               $revert = $this->skin->userToolLinks( $paramArray[0], $title->getDBkey(), true );
                        } else {
-                               wfRunHooks( 'LogLine', array( $row->log_type, $row->log_action, $title, $paramArray,
-                                       &$comment, &$revert, $row->log_timestamp ) );
-                               // wfDebug( "Invoked LogLine hook for " $row->log_type . ", " . $row->log_action . "\n" );
-                               // Do nothing. The implementation is handled by the hook modifiying the passed-by-ref parameters.
+                               # Fall back to a blue contributions link
+                               $revert = $this->skin->userToolLinks( 1, $title->getDBkey() );
+                       }
+                       if( $time < '20080129000000' ) {
+                               # Suppress $comment from old entries (before 2008-01-29), not needed and can contain incorrect links
+                               $comment = '';
                        }
+               // Do nothing. The implementation is handled by the hook modifiying the passed-by-ref parameters.
+               } else {
+                       wfRunHooks( 'LogLine', array( $row->log_type, $row->log_action, $title, $paramArray,
+                               &$comment, &$revert, $row->log_timestamp ) );
                }
                // Event description
                if( self::isDeleted($row,LogPage::DELETED_ACTION) ) {
@@ -302,12 +346,7 @@ class LogEventsList {
         * @param Row $row
         * @return string
         */
-       private function showhideLinks( $row ) {
-               global $wgAllowLogDeletion;
-
-               if( !$wgAllowLogDeletion )
-                       return "";
-
+       private function getShowHideLinks( $row ) {
                $revdel = SpecialPage::getTitleFor( 'Revisiondelete' );
                // If event was hidden from sysops
                if( !self::userCan( $row, LogPage::DELETED_RESTRICTED ) ) {
@@ -316,7 +355,9 @@ class LogEventsList {
                        // No one should be hiding from the oversight log
                        $del = $this->message['rev-delundel'];
                } else {
-                       $del = $this->skin->makeKnownLinkObj( $revdel, $this->message['rev-delundel'], 'logid='.$row->log_id );
+                       $target = SpecialPage::getTitleFor( 'Log', $row->log_type );
+                       $del = $this->skin->makeKnownLinkObj( $revdel, $this->message['rev-delundel'],
+                               'target=' . $target->getPrefixedUrl() . '&logid='.$row->log_id );
                        // Bolden oversighted content
                        if( self::isDeleted( $row, LogPage::DELETED_RESTRICTED ) )
                                $del = "<strong>$del</strong>";
@@ -326,12 +367,16 @@ class LogEventsList {
 
        /**
         * @param Row $row
-        * @param string $type
-        * @param string $action
+        * @param mixed $type (string/array)
+        * @param mixed $action (string/array)
         * @return bool
         */
        public static function typeAction( $row, $type, $action ) {
-               return ( $row->log_type == $type && $row->log_action == $action );
+               $match = is_array($type) ? in_array($row->log_type,$type) : $row->log_type == $type;
+               if( $match ) {
+                       $match = is_array($action) ? in_array($row->log_action,$action) : $row->log_action == $action;
+               }
+               return $match;
        }
 
        /**
@@ -345,7 +390,7 @@ class LogEventsList {
                if( ( $row->log_deleted & $field ) == $field ) {
                        global $wgUser;
                        $permission = ( $row->log_deleted & LogPage::DELETED_RESTRICTED ) == LogPage::DELETED_RESTRICTED
-                               ? 'hiderevision'
+                               ? 'suppressrevision'
                                : 'deleterevision';
                        wfDebug( "Checking for $permission due to $field match on $row->log_deleted\n" );
                        return $wgUser->isAllowed( $permission );
@@ -369,12 +414,15 @@ class LogEventsList {
         * @param string $type
         * @param string $page
         * @param string $user
+        * @param int $lim
+        * @param array $conds
         */
-        public static function showLogExtract( $out, $type='', $page='', $user='' ) {
+       public static function showLogExtract( $out, $type='', $page='', $user='', $lim=0, $conds=array() ) {
                global $wgUser;
                # Insert list of top 50 or so items
                $loglist = new LogEventsList( $wgUser->getSkin(), $out, 0 );
-               $pager = new LogPager( $loglist, $type, $user, $page, '' );
+               $pager = new LogPager( $loglist, $type, $user, $page, '', $conds );
+               if( $lim > 0 ) $pager->mLimit = $lim;
                $logBody = $pager->getBody();
                if( $logBody ) {
                        $out->addHTML(
@@ -385,7 +433,8 @@ class LogEventsList {
                } else {
                        $out->addWikiMsg( 'logempty' );
                }
-        }
+               return $pager->getNumRows();
+       }
 
         /**
         * SQL clause to skip forbidden log types for this user
@@ -397,15 +446,15 @@ class LogEventsList {
                // Reset the array, clears extra "where" clauses when $par is used
                $hiddenLogs = array();
                // Don't show private logs to unprivileged users
-               foreach( $wgLogRestrictions as $logtype => $right ) {
+               foreach( $wgLogRestrictions as $logType => $right ) {
                        if( !$wgUser->isAllowed($right) ) {
-                               $safetype = $db->strencode( $logtype );
-                               $hiddenLogs[] = $safetype;
+                               $safeType = $db->strencode( $logType );
+                               $hiddenLogs[] = $safeType;
                        }
                }
                if( count($hiddenLogs) == 1 ) {
                        return 'log_type != ' . $db->addQuotes( $hiddenLogs[0] );
-               } elseif( !empty( $hiddenLogs ) ) {
+               } elseif( $hiddenLogs ) {
                        return 'log_type NOT IN (' . $db->makeList($hiddenLogs) . ')';
                }
                return false;
@@ -413,10 +462,10 @@ class LogEventsList {
 }
 
 /**
- * @addtogroup Pager
+ * @ingroup Pager
  */
 class LogPager extends ReverseChronologicalPager {
-       private $type = '', $user = '', $title = '', $pattern = '', $year = '', $month = '';
+       private $type = '', $user = '', $title = '', $pattern = '';
        public $mLogEventsList;
        /**
        * constructor
@@ -427,7 +476,9 @@ class LogPager extends ReverseChronologicalPager {
        * @param string $pattern
        * @param array $conds
        */
-       function __construct( $list, $type='', $user='', $title='', $pattern='', $conds=array(), $y=false, $m=false ) {
+       function __construct( $list, $type = '', $user = '', $title = '', $pattern = '', 
+                       $conds = array(), $year = false, $month = false ) 
+       {
                parent::__construct();
                $this->mConds = $conds;
 
@@ -436,17 +487,35 @@ class LogPager extends ReverseChronologicalPager {
                $this->limitType( $type );
                $this->limitUser( $user );
                $this->limitTitle( $title, $pattern );
-               $this->limitDate( $y, $m );
+               $this->getDateCond( $year, $month );
        }
 
-       function getDefaultQuery() {
+       public function getDefaultQuery() {
                $query = parent::getDefaultQuery();
                $query['type'] = $this->type;
-               $query['month'] = $this->month;
-               $query['year'] = $this->year;
+               $query['month'] = $this->mMonth;
+               $query['year'] = $this->mYear;
                return $query;
        }
 
+       public function getFilterParams() {
+               global $wgFilterLogTypes, $wgUser, $wgRequest;
+               $filters = array();
+               if( $this->type ) {
+                       return $filters;
+               }
+               foreach( $wgFilterLogTypes as $type => $default ) {
+                       // Avoid silly filtering
+                       if( $type !== 'patrol' || $wgUser->useNPPatrol() ) {
+                               $hide = $wgRequest->getInt( "hide_{$type}_log", $default );
+                               $filters[$type] = $hide;
+                               if( $hide )
+                                       $this->mConds[] = 'log_type != ' . $this->mDb->addQuotes( $type );
+                       }
+               }
+               return $filters;
+       }
+
        /**
         * Set the log reader to return only entries of the given type.
         * Type restrictions enforced here
@@ -464,7 +533,7 @@ class LogPager extends ReverseChronologicalPager {
                if( $hideLogs !== false ) {
                        $this->mConds[] = $hideLogs;
                }
-               if( empty($type) ) {
+               if( !$type ) {
                        return false;
                }
                $this->type = $type;
@@ -476,7 +545,7 @@ class LogPager extends ReverseChronologicalPager {
         * @param string $name (In)valid user name
         * @private
         */
-       function limitUser( $name ) {
+       private function limitUser( $name ) {
                if( $name == '' ) {
                        return false;
                }
@@ -502,7 +571,7 @@ class LogPager extends ReverseChronologicalPager {
         * @param string $page Title name as text
         * @private
         */
-       function limitTitle( $page, $pattern ) {
+       private function limitTitle( $page, $pattern ) {
                global $wgMiserMode;
 
                $title = Title::newFromText( $page );
@@ -511,6 +580,17 @@ class LogPager extends ReverseChronologicalPager {
 
                $this->title = $title->getPrefixedText();
                $ns = $title->getNamespace();
+               # Using the (log_namespace, log_title, log_timestamp) index with a
+               # range scan (LIKE) on the first two parts, instead of simple equality,
+               # makes it unusable for sorting.  Sorted retrieval using another index
+               # would be possible, but then we might have to scan arbitrarily many
+               # nodes of that index. Therefore, we need to avoid this if $wgMiserMode
+               # is on.
+               #
+               # This is not a problem with simple title matches, because then we can
+               # use the page_time index.  That should have no more than a few hundred
+               # log entries for even the busiest pages, so it can be safely scanned
+               # in full to satisfy an impossible condition on user or similar.
                if( $pattern && !$wgMiserMode ) {
                        # use escapeLike to avoid expensive search patterns like 't%st%'
                        $safetitle = $this->mDb->escapeLike( $title->getDBkey() );
@@ -523,50 +603,8 @@ class LogPager extends ReverseChronologicalPager {
                }
        }
 
-       /**
-        * Set the log reader to return only entries from given date.
-        * @param int $year
-        * @param int $month
-        * @private
-        */
-       function limitDate( $year, $month ) {
-               $year = intval($year);
-               $month = intval($month);
-
-               $this->year = ($year > 0 && $year < 10000) ? $year : '';
-               $this->month = ($month > 0 && $month < 13) ? $month : '';
-
-               if( $this->year || $this->month ) {
-                       // Assume this year if only a month is given
-                       if( $this->year ) {
-                               $year_start = $this->year;
-                       } else {
-                               $year_start = substr( wfTimestampNow(), 0, 4 );
-                               $thisMonth = gmdate( 'n' );
-                               if( $this->month > $thisMonth ) {
-                                       // Future contributions aren't supposed to happen. :)
-                                       $year_start--;
-                               }
-                       }
-
-                       if( $this->month ) {
-                               $month_end = str_pad($this->month + 1, 2, '0', STR_PAD_LEFT);
-                               $year_end = $year_start;
-                       } else {
-                               $month_end = 0;
-                               $year_end = $year_start + 1;
-                       }
-                       $ts_end = str_pad($year_end . $month_end, 14, '0' );
-
-                       $this->mOffset = $ts_end;
-               }
-       }
-
-       function getQueryInfo() {
+       public function getQueryInfo() {
                $this->mConds[] = 'user_id = log_user';
-               # Hack this until live
-               global $wgAllowLogDeletion;
-               $log_id = $wgAllowLogDeletion ? 'log_id' : '0 AS log_id';
                # Don't use the wrong logging index
                if( $this->title || $this->pattern || $this->user ) {
                        $index = array( 'USE INDEX' => array( 'logging' => array('page_time','user_time') ) );
@@ -578,7 +616,7 @@ class LogPager extends ReverseChronologicalPager {
                return array(
                        'tables' => array( 'logging', 'user' ),
                        'fields' => array( 'log_type', 'log_action', 'log_user', 'log_namespace', 'log_title', 'log_params',
-                               'log_comment', $log_id, 'log_deleted', 'log_timestamp', 'user_name', 'user_editcount' ),
+                               'log_comment', 'log_id', 'log_deleted', 'log_timestamp', 'user_name', 'user_editcount' ),
                        'conds' => $this->mConds,
                        'options' => $index
                );
@@ -588,7 +626,7 @@ class LogPager extends ReverseChronologicalPager {
                return 'log_timestamp';
        }
 
-       function getStartBody() {
+       public function getStartBody() {
                wfProfileIn( __METHOD__ );
                # Do a link batch query
                if( $this->getNumRows() > 0 ) {
@@ -605,7 +643,7 @@ class LogPager extends ReverseChronologicalPager {
                return '';
        }
 
-       function formatRow( $row ) {
+       public function formatRow( $row ) {
                return $this->mLogEventsList->logLine( $row );
        }
 
@@ -626,17 +664,17 @@ class LogPager extends ReverseChronologicalPager {
        }
 
        public function getYear() {
-               return $this->year;
+               return $this->mYear;
        }
 
        public function getMonth() {
-               return $this->month;
+               return $this->mMonth;
        }
 }
 
 /**
- * @Deprecated
- * @addtogroup SpecialPage
+ * @deprecated
+ * @ingroup SpecialPage
  */
 class LogReader {
        var $pager;
@@ -650,17 +688,17 @@ class LogReader {
                $user = $request->getText( 'user' );
                $title = $request->getText( 'page' );
                $pattern = $request->getBool( 'pattern' );
-               $y = $request->getIntOrNull( 'year' );
-               $m = $request->getIntOrNull( 'month' );
+               $year = $request->getIntOrNull( 'year' );
+               $month = $request->getIntOrNull( 'month' );
                # Don't let the user get stuck with a certain date
                $skip = $request->getText( 'offset' ) || $request->getText( 'dir' ) == 'prev';
                if( $skip ) {
-                       $y = '';
-                       $m = '';
+                       $year = '';
+                       $month = '';
                }
                # Use new list class to output results
                $loglist = new LogEventsList( $wgUser->getSkin(), $wgOut, 0 );
-               $this->pager = new LogPager( $loglist, $type, $user, $title, $pattern, $y, $m );
+               $this->pager = new LogPager( $loglist, $type, $user, $title, $pattern, $year, $month );
        }
 
        /**
@@ -673,8 +711,8 @@ class LogReader {
 }
 
 /**
- * @Deprecated
- * @addtogroup SpecialPage
+ * @deprecated
+ * @ingroup SpecialPage
  */
 class LogViewer {
        const NO_ACTION_LINK = 1;