Merge "tooltip-ca-edit: Simplify wording to align with others"
[lhc/web/wiklou.git] / includes / specials / SpecialProtectedtitles.php
index b84540c..85ce78f 100644 (file)
@@ -38,11 +38,6 @@ class SpecialProtectedtitles extends SpecialPage {
                $this->setHeaders();
                $this->outputHeader();
 
-               // Purge expired entries on one in every 10 queries
-               if ( !mt_rand( 0, 10 ) ) {
-                       Title::purgeExpiredRestrictions();
-               }
-
                $request = $this->getRequest();
                $type = $request->getVal( $this->IdType );
                $level = $request->getVal( $this->IdLevel );
@@ -50,7 +45,7 @@ class SpecialProtectedtitles extends SpecialPage {
                $size = $request->getIntOrNull( 'size' );
                $NS = $request->getIntOrNull( 'namespace' );
 
-               $pager = new ProtectedTitlesPager( $this->getContext(), array(), $type, $level, $NS, $sizetype, $size );
+               $pager = new ProtectedTitlesPager( $this, array(), $type, $level, $NS, $sizetype, $size );
 
                $this->getOutput()->addHTML( $this->showOptions( $NS, $type, $level ) );
 
@@ -72,18 +67,8 @@ class SpecialProtectedtitles extends SpecialPage {
         * @return string
         */
        function formatRow( $row ) {
-               wfProfileIn( __METHOD__ );
-
-               static $infinity = null;
-
-               if ( is_null( $infinity ) ) {
-                       $infinity = wfGetDB( DB_SLAVE )->getInfinity();
-               }
-
                $title = Title::makeTitleSafe( $row->pt_namespace, $row->pt_title );
                if ( !$title ) {
-                       wfProfileOut( __METHOD__ );
-
                        return Html::rawElement(
                                'li',
                                array(),
@@ -107,9 +92,9 @@ class SpecialProtectedtitles extends SpecialPage {
                $lang = $this->getLanguage();
                $expiry = strlen( $row->pt_expiry ) ?
                        $lang->formatExpiry( $row->pt_expiry, TS_MW ) :
-                       $infinity;
+                       'infinity';
 
-               if ( $expiry != $infinity ) {
+               if ( $expiry !== 'infinity' ) {
                        $user = $this->getUser();
                        $description_items[] = $this->msg(
                                'protect-expiring-local',
@@ -119,8 +104,6 @@ class SpecialProtectedtitles extends SpecialPage {
                        )->escaped();
                }
 
-               wfProfileOut( __METHOD__ );
-
                // @todo i18n: This should use a comma separator instead of a hard coded comma, right?
                return '<li>' . $lang->specialList( $link, implode( $description_items, ', ' ) ) . "</li>\n";
        }
@@ -227,7 +210,6 @@ class ProtectedTitlesPager extends AlphabeticPager {
        }
 
        function getStartBody() {
-               wfProfileIn( __METHOD__ );
                # Do a link batch query
                $this->mResult->seek( 0 );
                $lb = new LinkBatch;
@@ -237,7 +219,6 @@ class ProtectedTitlesPager extends AlphabeticPager {
                }
 
                $lb->execute();
-               wfProfileOut( __METHOD__ );
 
                return '';
        }
@@ -258,7 +239,8 @@ class ProtectedTitlesPager extends AlphabeticPager {
         */
        function getQueryInfo() {
                $conds = $this->mConds;
-               $conds[] = 'pt_expiry>' . $this->mDb->addQuotes( $this->mDb->timestamp() );
+               $conds[] = 'pt_expiry > ' . $this->mDb->addQuotes( $this->mDb->timestamp() ) .
+                       ' OR pt_expiry IS NULL';
                if ( $this->level ) {
                        $conds['pt_create_perm'] = $this->level;
                }