summaryrefslogtreecommitdiff
path: root/includes/api/ApiQueryExternalLinks.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2010-07-28 11:52:48 +0200
committerPierre Schmitz <pierre@archlinux.de>2010-07-28 11:52:48 +0200
commit222b01f5169f1c7e69762e0e8904c24f78f71882 (patch)
tree8e932e12546bb991357ec48eb1638d1770be7a35 /includes/api/ApiQueryExternalLinks.php
parent00ab76a6b686e98a914afc1975812d2b1aaa7016 (diff)
update to MediaWiki 1.16.0
Diffstat (limited to 'includes/api/ApiQueryExternalLinks.php')
-rw-r--r--includes/api/ApiQueryExternalLinks.php50
1 files changed, 26 insertions, 24 deletions
diff --git a/includes/api/ApiQueryExternalLinks.php b/includes/api/ApiQueryExternalLinks.php
index 0bddd6df..a748e036 100644
--- a/includes/api/ApiQueryExternalLinks.php
+++ b/includes/api/ApiQueryExternalLinks.php
@@ -23,9 +23,9 @@
* http://www.gnu.org/copyleft/gpl.html
*/
-if (!defined('MEDIAWIKI')) {
+if ( !defined( 'MEDIAWIKI' ) ) {
// Eclipse helper - will be ignored in production
- require_once ("ApiQueryBase.php");
+ require_once ( "ApiQueryBase.php" );
}
/**
@@ -35,8 +35,8 @@ if (!defined('MEDIAWIKI')) {
*/
class ApiQueryExternalLinks extends ApiQueryBase {
- public function __construct($query, $moduleName) {
- parent :: __construct($query, $moduleName, 'el');
+ public function __construct( $query, $moduleName ) {
+ parent :: __construct( $query, $moduleName, 'el' );
}
public function execute() {
@@ -44,41 +44,43 @@ class ApiQueryExternalLinks extends ApiQueryBase {
return;
$params = $this->extractRequestParams();
- $this->addFields(array (
+ $this->addFields( array (
'el_from',
'el_to'
- ));
+ ) );
- $this->addTables('externallinks');
- $this->addWhereFld('el_from', array_keys($this->getPageSet()->getGoodTitles()));
- # Don't order by el_from if it's constant in the WHERE clause
- if(count($this->getPageSet()->getGoodTitles()) != 1)
- $this->addOption('ORDER BY', 'el_from');
- $this->addOption('LIMIT', $params['limit'] + 1);
- if(!is_null($params['offset']))
- $this->addOption('OFFSET', $params['offset']);
+ $this->addTables( 'externallinks' );
+ $this->addWhereFld( 'el_from', array_keys( $this->getPageSet()->getGoodTitles() ) );
+
+ // Don't order by el_from if it's constant in the WHERE clause
+ if ( count( $this->getPageSet()->getGoodTitles() ) != 1 )
+ $this->addOption( 'ORDER BY', 'el_from' );
+
+ $this->addOption( 'LIMIT', $params['limit'] + 1 );
+ if ( !is_null( $params['offset'] ) )
+ $this->addOption( 'OFFSET', $params['offset'] );
$db = $this->getDB();
- $res = $this->select(__METHOD__);
+ $res = $this->select( __METHOD__ );
$count = 0;
- while ($row = $db->fetchObject($res)) {
- if (++$count > $params['limit']) {
+ while ( $row = $db->fetchObject( $res ) ) {
+ if ( ++$count > $params['limit'] ) {
// We've reached the one extra which shows that
// there are additional pages to be had. Stop here...
- $this->setContinueEnumParameter('offset', @$params['offset'] + $params['limit']);
+ $this->setContinueEnumParameter( 'offset', @$params['offset'] + $params['limit'] );
break;
}
$entry = array();
- ApiResult :: setContent($entry, $row->el_to);
- $fit = $this->addPageSubItem($row->el_from, $entry);
- if(!$fit)
+ ApiResult :: setContent( $entry, $row->el_to );
+ $fit = $this->addPageSubItem( $row->el_from, $entry );
+ if ( !$fit )
{
- $this->setContinueEnumParameter('offset', @$params['offset'] + $count - 1);
+ $this->setContinueEnumParameter( 'offset', @$params['offset'] + $count - 1 );
break;
}
}
- $db->freeResult($res);
+ $db->freeResult( $res );
}
public function getCacheMode( $params ) {
@@ -117,6 +119,6 @@ class ApiQueryExternalLinks extends ApiQueryBase {
}
public function getVersion() {
- return __CLASS__ . ': $Id: ApiQueryExternalLinks.php 69986 2010-07-27 03:57:39Z tstarling $';
+ return __CLASS__ . ': $Id: ApiQueryExternalLinks.php 69932 2010-07-26 08:03:21Z tstarling $';
}
}