http://www.mediawiki.org/wiki/Special:Code/MediaWiki/88191
Revision: 88191
Author: btongminh
Date: 2011-05-15 14:57:10 +0000 (Sun, 15 May 2011)
Log Message:
-----------
Kill the error suppression operator in the Api
Modified Paths:
--------------
trunk/phase3/includes/api/ApiParse.php
trunk/phase3/includes/api/ApiQuery.php
trunk/phase3/includes/api/ApiQueryBacklinks.php
trunk/phase3/includes/api/ApiQueryExternalLinks.php
Modified: trunk/phase3/includes/api/ApiParse.php
===================================================================
--- trunk/phase3/includes/api/ApiParse.php 2011-05-15 14:51:01 UTC (rev
88190)
+++ trunk/phase3/includes/api/ApiParse.php 2011-05-15 14:57:10 UTC (rev
88191)
@@ -134,7 +134,8 @@
$main = new ApiMain( $req );
$main->execute();
$data = $main->getResultData();
- $redirValues =
@$data['query']['redirects'];
+ $redirValues = isset(
$data['query']['redirects'] )
+ ?
$data['query']['redirects'] : array();
$to = $page;
foreach ( (array)$redirValues
as $r ) {
$to = $r['to'];
Modified: trunk/phase3/includes/api/ApiQuery.php
===================================================================
--- trunk/phase3/includes/api/ApiQuery.php 2011-05-15 14:51:01 UTC (rev
88190)
+++ trunk/phase3/includes/api/ApiQuery.php 2011-05-15 14:57:10 UTC (rev
88191)
@@ -316,9 +316,8 @@
* @param $moduleList Array array(modulename => classname)
*/
private function instantiateModules( &$modules, $param, $moduleList ) {
- $list = @$this->params[$param];
- if ( !is_null ( $list ) ) {
- foreach ( $list as $moduleName ) {
+ if ( isset( $this->params[$param] ) ) {
+ foreach ( $this->params[$param] as $moduleName ) {
$modules[] = new $moduleList[$moduleName] (
$this, $moduleName );
}
}
Modified: trunk/phase3/includes/api/ApiQueryBacklinks.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryBacklinks.php 2011-05-15 14:51:01 UTC
(rev 88190)
+++ trunk/phase3/includes/api/ApiQueryBacklinks.php 2011-05-15 14:57:10 UTC
(rev 88191)
@@ -305,7 +305,8 @@
}
$hasRedirs = false;
- foreach ( (array)@$arr['redirlinks'] as
$key => $redir ) {
+ $redirLinks = isset( $arr['redirlinks']
) ? $arr['redirlinks'] : array();
+ foreach ( (array)$redirLinks as $key =>
$redir ) {
$fit =
$this->getResult()->addValue(
array( 'query',
$this->getModuleName(), $pageID, 'redirlinks' ),
$key, $redir );
Modified: trunk/phase3/includes/api/ApiQueryExternalLinks.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryExternalLinks.php 2011-05-15 14:51:01 UTC
(rev 88190)
+++ trunk/phase3/includes/api/ApiQueryExternalLinks.php 2011-05-15 14:57:10 UTC
(rev 88191)
@@ -70,7 +70,8 @@
}
$this->addOption( 'LIMIT', $params['limit'] + 1 );
- if ( !is_null( $params['offset'] ) ) {
+ $offset = isset( $params['offset'] ) ? $params['offset'] : 0;
+ if ( $offset ) {
$this->addOption( 'OFFSET', $params['offset'] );
}
@@ -81,14 +82,14 @@
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',
$offset + $params['limit'] );
break;
}
$entry = array();
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',
$offset + $count - 1 );
break;
}
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs