Add 'logid' parameter to Special:Log
[lhc/web/wiklou.git] / includes / logging / LogPager.php
index 24fdfb0..c047e96 100644 (file)
@@ -65,10 +65,11 @@ class LogPager extends ReverseChronologicalPager {
         * @param int|bool $month The month to start from. Default: false
         * @param string $tagFilter Tag
         * @param string $action Specific action (subtype) requested
+        * @param int $logId Log entry ID, to limit to a single log entry.
         */
        public function __construct( $list, $types = [], $performer = '', $title = '',
                $pattern = '', $conds = [], $year = false, $month = false, $tagFilter = '',
-               $action = ''
+               $action = '', $logId = false
        ) {
                parent::__construct( $list->getContext() );
                $this->mConds = $conds;
@@ -81,6 +82,7 @@ class LogPager extends ReverseChronologicalPager {
                $this->limitAction( $action );
                $this->getDateCond( $year, $month );
                $this->mTagFilter = $tagFilter;
+               $this->limitLogId( $logId );
 
                $this->mDb = wfGetDB( DB_REPLICA, 'logpager' );
        }
@@ -278,6 +280,17 @@ class LogPager extends ReverseChronologicalPager {
                }
        }
 
+       /**
+        * Limit to the (single) specified log ID.
+        * @param int $logId The log entry ID.
+        */
+       protected function limitLogId( $logId ) {
+               if ( !$logId ) {
+                       return;
+               }
+               $this->mConds['log_id'] = $logId;
+       }
+
        /**
         * Constructs the most part of the query. Extra conditions are sprinkled in
         * all over this class.