X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiQueryInfo.php;h=43b8c0ceaceeb9319aa484109a66fbb404a9d23d;hb=74756a24091d3b875a2fbf8759d8688609727586;hp=017684edd321db35566fc7e5223071e1e4569495;hpb=b8f9b16b84155ac4b764816d82f11a0476065c73;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiQueryInfo.php b/includes/api/ApiQueryInfo.php index 017684edd3..43b8c0ceac 100644 --- a/includes/api/ApiQueryInfo.php +++ b/includes/api/ApiQueryInfo.php @@ -42,7 +42,8 @@ class ApiQueryInfo extends ApiQueryBase { private $pageRestrictions, $pageIsRedir, $pageIsNew, $pageTouched, $pageLatest, $pageLength; - private $protections, $watched, $watchers, $notificationtimestamps, $talkids, $subjectids, $displaytitles; + private $protections, $watched, $watchers, $notificationtimestamps, + $talkids, $subjectids, $displaytitles; private $showZeroWatchers = false; private $tokenFunctions; @@ -104,10 +105,11 @@ class ApiQueryInfo extends ApiQueryBase { 'watch' => array( 'ApiQueryInfo', 'getWatchToken' ), ); wfRunHooks( 'APIQueryInfoTokens', array( &$this->tokenFunctions ) ); + return $this->tokenFunctions; } - static $cachedTokens = array(); + static protected $cachedTokens = array(); public static function resetTokenCache() { ApiQueryInfo::$cachedTokens = array(); @@ -333,8 +335,8 @@ class ApiQueryInfo extends ApiQueryBase { ), $pageid, $pageInfo ); if ( !$fit ) { $this->setContinueEnumParameter( 'continue', - $title->getNamespace() . '|' . - $title->getText() ); + $title->getNamespace() . '|' . + $title->getText() ); break; } } @@ -348,7 +350,8 @@ class ApiQueryInfo extends ApiQueryBase { */ private function extractPageInfo( $pageid, $title ) { $pageInfo = array(); - $titleExists = $pageid > 0; //$title->exists() needs pageid, which is not set for all title objects + // $title->exists() needs pageid, which is not set for all title objects + $titleExists = $pageid > 0; $ns = $title->getNamespace(); $dbkey = $title->getDBkey(); @@ -410,7 +413,8 @@ class ApiQueryInfo extends ApiQueryBase { if ( $this->fld_notificationtimestamp ) { $pageInfo['notificationtimestamp'] = ''; if ( isset( $this->notificationtimestamps[$ns][$dbkey] ) ) { - $pageInfo['notificationtimestamp'] = wfTimestamp( TS_ISO_8601, $this->notificationtimestamps[$ns][$dbkey] ); + $pageInfo['notificationtimestamp'] = + wfTimestamp( TS_ISO_8601, $this->notificationtimestamps[$ns][$dbkey] ); } } @@ -465,7 +469,7 @@ class ApiQueryInfo extends ApiQueryBase { $this->resetQueryParams(); $this->addTables( 'page_restrictions' ); $this->addFields( array( 'pr_page', 'pr_type', 'pr_level', - 'pr_expiry', 'pr_cascade' ) ); + 'pr_expiry', 'pr_cascade' ) ); $this->addWhereFld( 'pr_page', array_keys( $this->titles ) ); $res = $this->select( __METHOD__ ); @@ -556,8 +560,8 @@ class ApiQueryInfo extends ApiQueryBase { $this->resetQueryParams(); $this->addTables( array( 'page_restrictions', 'page', 'templatelinks' ) ); $this->addFields( array( 'pr_type', 'pr_level', 'pr_expiry', - 'page_title', 'page_namespace', - 'tl_title', 'tl_namespace' ) ); + 'page_title', 'page_namespace', + 'tl_title', 'tl_namespace' ) ); $this->addWhere( $lb->constructSet( 'tl', $db ) ); $this->addWhere( 'pr_page = page_id' ); $this->addWhere( 'pr_page = tl_from' ); @@ -580,7 +584,7 @@ class ApiQueryInfo extends ApiQueryBase { $this->resetQueryParams(); $this->addTables( array( 'page_restrictions', 'page', 'imagelinks' ) ); $this->addFields( array( 'pr_type', 'pr_level', 'pr_expiry', - 'page_title', 'page_namespace', 'il_to' ) ); + 'page_title', 'page_namespace', 'il_to' ) ); $this->addWhere( 'pr_page = page_id' ); $this->addWhere( 'pr_page = il_from' ); $this->addWhereFld( 'pr_cascade', 1 ); @@ -633,10 +637,10 @@ class ApiQueryInfo extends ApiQueryBase { foreach ( $res as $row ) { if ( MWNamespace::isTalk( $row->page_namespace ) ) { $this->talkids[MWNamespace::getSubject( $row->page_namespace )][$row->page_title] = - intval( $row->page_id ); + intval( $row->page_id ); } else { $this->subjectids[MWNamespace::getTalk( $row->page_namespace )][$row->page_title] = - intval( $row->page_id ); + intval( $row->page_id ); } } } @@ -697,7 +701,8 @@ class ApiQueryInfo extends ApiQueryBase { $this->watched[$row->wl_namespace][$row->wl_title] = true; } if ( $this->fld_notificationtimestamp ) { - $this->notificationtimestamps[$row->wl_namespace][$row->wl_title] = $row->wl_notificationtimestamp; + $this->notificationtimestamps[$row->wl_namespace][$row->wl_title] = + $row->wl_notificationtimestamp; } } } @@ -761,6 +766,7 @@ class ApiQueryInfo extends ApiQueryBase { if ( !is_null( $params['token'] ) ) { return 'private'; } + return 'public'; }