Merge "Change name of main page in Sardinian (sc)"
[lhc/web/wiklou.git] / includes / page / WikiPage.php
index 072c3c6..4b0e503 100644 (file)
@@ -50,13 +50,23 @@ class WikiPage implements Page, IDBAccessObject {
         */
        public $mTitle = null;
 
-       /**@{{
+       /**
+        * @var bool
+        * @protected
+        */
+       public $mDataLoaded = false;
+
+       /**
+        * @var bool
         * @protected
         */
-       public $mDataLoaded = false;         // !< Boolean
-       public $mIsRedirect = false;         // !< Boolean
-       public $mLatest = false;             // !< Integer (false means "not loaded")
-       /**@}}*/
+       public $mIsRedirect = false;
+
+       /**
+        * @var int|false False means "not loaded"
+        * @protected
+        */
+       public $mLatest = false;
 
        /** @var PreparedEdit Map of cache fields (text, parser output, ect) for a proposed/new edit */
        public $mPreparedEdit = false;
@@ -637,7 +647,7 @@ class WikiPage implements Page, IDBAccessObject {
         */
        public function getContentModel() {
                if ( $this->exists() ) {
-                       $cache = ObjectCache::getMainWANInstance();
+                       $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
 
                        return $cache->getWithSetCallback(
                                $cache->makeKey( 'page-content-model', $this->getLatest() ),
@@ -895,7 +905,8 @@ class WikiPage implements Page, IDBAccessObject {
         *   Revision::RAW              get the text regardless of permissions
         * @param User|null $user User object to check for, only if FOR_THIS_USER is passed
         *   to the $audience parameter
-        * @return string Comment stored for the last article revision
+        * @return string|null Comment stored for the last article revision, or null if the specified
+        *  audience does not have access to the comment.
         */
        public function getComment( $audience = Revision::FOR_PUBLIC, User $user = null ) {
                $this->loadLastEdit();
@@ -2625,7 +2636,9 @@ class WikiPage implements Page, IDBAccessObject {
                // Avoid PHP 7.1 warning of passing $this by reference
                $wikiPage = $this;
 
-               $deleter = is_null( $deleter ) ? $wgUser : $deleter;
+               if ( !$deleter ) {
+                       $deleter = $wgUser;
+               }
                if ( !Hooks::run( 'ArticleDelete',
                        [ &$wikiPage, &$deleter, &$reason, &$error, &$status, $suppress ]
                ) ) {