Merge "watchlist: fix nonsensical timestamp/boolean comparisons in EnhancedRecentChanges"
[lhc/web/wiklou.git] / includes / actions / InfoAction.php
index d014503..bfba59a 100644 (file)
@@ -174,7 +174,7 @@ class InfoAction extends FormlessAction {
         * @param string $table The table that will be added to the content
         * @param string $name The name of the row
         * @param string $value The value of the row
-        * @param string $id The ID to use for the 'tr' element
+        * @param string|null $id The ID to use for the 'tr' element
         * @return string The table with the row added
         */
        protected function addRow( $table, $name, $value, $id ) {
@@ -264,6 +264,12 @@ class InfoAction extends FormlessAction {
                        $this->msg( 'pageinfo-length' ), $lang->formatNum( $title->getLength() )
                ];
 
+               // Page namespace
+               $pageNamespace = $title->getNsText();
+               if ( $pageNamespace ) {
+                       $pageInfo['header-basic'][] = [ $this->msg( 'pageinfo-namespace' ), $pageNamespace ];
+               }
+
                // Page ID (number not localised, as it's a database ID)
                $pageInfo['header-basic'][] = [ $this->msg( 'pageinfo-article-id' ), $id ];
 
@@ -393,7 +399,7 @@ class InfoAction extends FormlessAction {
                }
 
                // Subpages of this page, if subpages are enabled for the current NS
-               if ( MWNamespace::hasSubpages( $title->getNamespace() ) ) {
+               if ( $services->getNamespaceInfo()->hasSubpages( $title->getNamespace() ) ) {
                        $prefixIndex = SpecialPage::getTitleFor(
                                'Prefixindex', $title->getPrefixedText() . '/' );
                        $pageInfo['header-basic'][] = [
@@ -724,12 +730,13 @@ class InfoAction extends FormlessAction {
        protected function pageCounts( Page $page ) {
                $fname = __METHOD__;
                $config = $this->context->getConfig();
-               $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
+               $services = MediaWikiServices::getInstance();
+               $cache = $services->getMainWANObjectCache();
 
                return $cache->getWithSetCallback(
                        self::getCacheKey( $cache, $page->getTitle(), $page->getLatest() ),
                        WANObjectCache::TTL_WEEK,
-                       function ( $oldValue, &$ttl, &$setOpts ) use ( $page, $config, $fname ) {
+                       function ( $oldValue, &$ttl, &$setOpts ) use ( $page, $config, $fname, $services ) {
                                global $wgActorTableSchemaMigrationStage;
 
                                $title = $page->getTitle();
@@ -753,7 +760,7 @@ class InfoAction extends FormlessAction {
                                        $joins = [];
                                }
 
-                               $watchedItemStore = MediaWikiServices::getInstance()->getWatchedItemStore();
+                               $watchedItemStore = $services->getWatchedItemStore();
 
                                $result = [];
                                $result['watchers'] = $watchedItemStore->countWatchers( $title );
@@ -818,7 +825,7 @@ class InfoAction extends FormlessAction {
                                );
 
                                // Subpages (if enabled)
-                               if ( MWNamespace::hasSubpages( $title->getNamespace() ) ) {
+                               if ( $services->getNamespaceInfo()->hasSubpages( $title->getNamespace() ) ) {
                                        $conds = [ 'page_namespace' => $title->getNamespace() ];
                                        $conds[] = 'page_title ' .
                                                $dbr->buildLike( $title->getDBkey() . '/', $dbr->anyString() );