Merge "Fix wrong @return type hints in Language::tsTo… methods"
[lhc/web/wiklou.git] / includes / changes / RecentChange.php
index 9f68338..159cfd9 100644 (file)
@@ -720,11 +720,12 @@ class RecentChange {
         * @param int $newId
         * @param string $actionCommentIRC
         * @param int $revId Id of associated revision, if any
+        * @param bool $isPatrollable Whether this log entry is patrollable
         * @return RecentChange
         */
        public static function newLogEntry( $timestamp, &$title, &$user, $actionComment, $ip,
                $type, $action, $target, $logComment, $params, $newId = 0, $actionCommentIRC = '',
-               $revId = 0 ) {
+               $revId = 0, $isPatrollable = false ) {
                global $wgRequest;
 
                # # Get pageStatus for email notification
@@ -748,9 +749,8 @@ class RecentChange {
                                break;
                }
 
-               // Allow unpatrolled status when an associated rev id is passed
-               // May be used in core by moves and uploads
-               $markPatrolled = ( $revId > 0 ) ? $user->isAllowed( 'autopatrol' ) : true;
+               // Allow unpatrolled status for patrollable log entries
+               $markPatrolled = $isPatrollable ? $user->isAllowed( 'autopatrol' ) : true;
 
                $rc = new RecentChange;
                $rc->mTitle = $target;
@@ -851,7 +851,9 @@ class RecentChange {
                        'rc_logid' => 0,
                        'rc_log_type' => null,
                        'rc_log_action' => '',
-                       'rc_params' => ''
+                       'rc_params' =>  serialize( [
+                               'hidden-cat' => WikiCategoryPage::factory( $categoryTitle )->isHidden()
+                       ] )
                ];
 
                $rc->mExtra = [
@@ -865,6 +867,19 @@ class RecentChange {
                return $rc;
        }
 
+       /**
+        * Get a parameter value
+        *
+        * @since 1.27
+        *
+        * @param string $name parameter name
+        * @return mixed
+        */
+       public function getParam( $name ) {
+               $params = $this->parseParams();
+               return isset( $params[$name] ) ? $params[$name] : null;
+       }
+
        /**
         * Initialises the members of this object from a mysql row object
         *
@@ -973,7 +988,7 @@ class RecentChange {
         *
         * @since 1.26
         *
-        * @return array|null
+        * @return mixed|bool false on failed unserialization
         */
        public function parseParams() {
                $rcParams = $this->getAttribute( 'rc_params' );