+ /**
+ * Returns the page language code saved in the database, if $wgPageLanguageUseDB is set
+ * to true in LocalSettings.php, otherwise returns false. If there is no language saved in
+ * the db, it will return NULL.
+ *
+ * @return string|null|boolean
+ */
+ private function getDbPageLanguageCode() {
+ global $wgPageLanguageUseDB;
+
+ // check, if the page language could be saved in the database, and if so and
+ // the value is not requested already, lookup the page language using LinkCache
+ if ( $wgPageLanguageUseDB && $this->mDbPageLanguage === false ) {
+ $linkCache = LinkCache::singleton();
+ $linkCache->addLinkObj( $this );
+ $this->mDbPageLanguage = $linkCache->getGoodLinkFieldObj( $this, 'lang' );
+ }
+
+ return $this->mDbPageLanguage;
+ }
+