Merge "(bug 47070) check content model namespace on import."
[lhc/web/wiklou.git] / includes / actions / InfoAction.php
index 7fc9033..918fc9e 100644 (file)
@@ -153,6 +153,7 @@ class InfoAction extends FormlessAction {
         */
        protected function makeHeader( $header ) {
                $spanAttribs = array( 'class' => 'mw-headline', 'id' => Sanitizer::escapeId( $header ) );
+
                return Html::rawElement( 'h2', array(), Html::element( 'span', $spanAttribs, $header ) );
        }
 
@@ -192,7 +193,7 @@ class InfoAction extends FormlessAction {
         * @return array
         */
        protected function pageInfo() {
-               global $wgContLang, $wgRCMaxAge, $wgMemc,
+               global $wgContLang, $wgRCMaxAge, $wgMemc, $wgMiserMode,
                        $wgUnwatchedPageThreshold, $wgPageInfoTransclusionLimit;
 
                $user = $this->getUser();
@@ -277,6 +278,12 @@ class InfoAction extends FormlessAction {
                        Language::fetchLanguageName( $pageLang, $lang->getCode() )
                        . ' ' . $this->msg( 'parentheses', $pageLang ) );
 
+               // Content model of the page
+               $pageInfo['header-basic'][] = array(
+                       $this->msg( 'pageinfo-content-model' ),
+                       ContentHandler::getLocalizedName( $title->getContentModel() )
+               );
+
                // Search engine status
                $pOutput = new ParserOutput();
                if ( isset( $pageProperties['noindex'] ) ) {
@@ -300,7 +307,7 @@ class InfoAction extends FormlessAction {
                if (
                        $user->isAllowed( 'unwatchedpages' ) ||
                        ( $wgUnwatchedPageThreshold !== false &&
-                         $pageCounts['watchers'] >= $wgUnwatchedPageThreshold )
+                               $pageCounts['watchers'] >= $wgUnwatchedPageThreshold )
                ) {
                        // Number of page watchers
                        $pageInfo['header-basic'][] = array(
@@ -533,7 +540,11 @@ class InfoAction extends FormlessAction {
                ) {
                        $options = array( 'LIMIT' => $wgPageInfoTransclusionLimit );
                        $transcludedTemplates = $title->getTemplateLinksFrom( $options );
-                       $transcludedTargets = $title->getTemplateLinksTo( $options );
+                       if ( $wgMiserMode ) {
+                               $transcludedTargets = array();
+                       } else {
+                               $transcludedTargets = $title->getTemplateLinksTo( $options );
+                       }
 
                        // Page properties
                        $pageInfo['header-properties'] = array();
@@ -574,7 +585,7 @@ class InfoAction extends FormlessAction {
                                );
                        }
 
-                       if ( $pageCounts['transclusion']['to'] > 0 ) {
+                       if ( !$wgMiserMode && $pageCounts['transclusion']['to'] > 0 ) {
                                if ( $pageCounts['transclusion']['to'] > count( $transcludedTargets ) ) {
                                        $more = Linker::link(
                                                $whatLinksHere,
@@ -608,7 +619,7 @@ class InfoAction extends FormlessAction {
         * @return array
         */
        protected static function pageCounts( Title $title ) {
-               global $wgRCMaxAge, $wgDisableCounters;
+               global $wgRCMaxAge, $wgDisableCounters, $wgMiserMode;
 
                wfProfileIn( __METHOD__ );
                $id = $title->getArticleID();
@@ -712,15 +723,19 @@ class InfoAction extends FormlessAction {
                }
 
                // Counts for the number of transclusion links (to/from)
-               $result['transclusion']['to'] = (int)$dbr->selectField(
-                       'templatelinks',
-                       'COUNT(tl_from)',
-                       array(
-                               'tl_namespace' => $title->getNamespace(),
-                               'tl_title' => $title->getDBkey()
-                       ),
-                       __METHOD__
-               );
+               if ( $wgMiserMode ) {
+                       $result['transclusion']['to'] = 0;
+               } else {
+                       $result['transclusion']['to'] = (int)$dbr->selectField(
+                               'templatelinks',
+                               'COUNT(tl_from)',
+                               array(
+                                       'tl_namespace' => $title->getNamespace(),
+                                       'tl_title' => $title->getDBkey()
+                               ),
+                               __METHOD__
+                       );
+               }
 
                $result['transclusion']['from'] = (int)$dbr->selectField(
                        'templatelinks',
@@ -730,6 +745,7 @@ class InfoAction extends FormlessAction {
                );
 
                wfProfileOut( __METHOD__ );
+
                return $result;
        }
 
@@ -755,6 +771,7 @@ class InfoAction extends FormlessAction {
                $anon_ips = array();
 
                # Sift for real versus user names
+               /** @var $user User */
                foreach ( $contributors as $user ) {
                        $page = $user->isAnon()
                                ? SpecialPage::getTitleFor( 'Contributions', $user->getName() )
@@ -797,6 +814,7 @@ class InfoAction extends FormlessAction {
                }
 
                $count = count( $fulllist );
+
                # "Based on work by ..."
                return $count
                        ? $this->msg( 'othercontribs' )->rawParams(