Reedy has uploaded a new change for review.
https://gerrit.wikimedia.org/r/64622
Change subject: Few bits of documentation related cleanup
......................................................................
Few bits of documentation related cleanup
Remove unused globals
Fixup returns
Change-Id: I959643c51529f93f2fb753f2506d43627ff9f96d
---
M ApiQueryProofread.php
M ProofreadPage.body.php
M SpecialProofreadPages.php
M includes/ProofreadPageInit.php
M includes/index/EditProofreadIndexPage.php
M includes/index/ProofreadIndexEntry.php
M includes/index/ProofreadIndexValue.php
M includes/index/oai/ProofreadIndexOaiRecord.php
M includes/index/oai/SpecialProofreadIndexOai.php
9 files changed, 37 insertions(+), 17 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ProofreadPage
refs/changes/22/64622/1
diff --git a/ApiQueryProofread.php b/ApiQueryProofread.php
index 079d250..e465d52 100644
--- a/ApiQueryProofread.php
+++ b/ApiQueryProofread.php
@@ -24,7 +24,7 @@
$pageSet = $this->getPageSet();
$pages = $pageSet->getGoodTitles();
if ( !count( $pages ) ) {
- return true;
+ return;
}
$pageNamespaceId = ProofreadPage::getPageNamespaceId();
@@ -36,7 +36,7 @@
}
if ( !count( $pageIds ) ) {
- return true;
+ return;
}
// Determine the categories defined in MediaWiki: pages
diff --git a/ProofreadPage.body.php b/ProofreadPage.body.php
index 820116e..4d37b7f 100644
--- a/ProofreadPage.body.php
+++ b/ProofreadPage.body.php
@@ -447,7 +447,7 @@
$filePage = $wgContLang->parseFormattedNumber(
$m[3] );
$params = array( 'width' => $width, 'page' =>
$filePage );
- $image->handler->normaliseParams( $image,
$params );
+ $image->getHandler()->normaliseParams( $image,
$params );
$thumbName = $image->thumbName( $params );
$fullURL = $image->getThumbUrl( $thumbName );
} else {
diff --git a/SpecialProofreadPages.php b/SpecialProofreadPages.php
index 0df6cd6..133f482 100644
--- a/SpecialProofreadPages.php
+++ b/SpecialProofreadPages.php
@@ -105,10 +105,8 @@
// Bug #27678: Do not use offset here, because it was
already used in
// search perfomed by execute method
return parent::reallyDoQuery( $limit, false );
- } else {
- return parent::reallyDoQuery( $limit, $offset );
}
- return $result;
+ return parent::reallyDoQuery( $limit, $offset );
}
function preprocessResults( $dbr, $res ) {
diff --git a/includes/ProofreadPageInit.php b/includes/ProofreadPageInit.php
index f59f321..40beed8 100644
--- a/includes/ProofreadPageInit.php
+++ b/includes/ProofreadPageInit.php
@@ -76,7 +76,7 @@
* @return int|bool the id of the namespace or false if it doesn't exist
*/
protected static function getNamespaceIdForDefaultName( $key ) {
- global $wgExtraNamespaces, $wgLanguageCode;
+ global $wgExtraNamespaces;
$xNamespaces = array();
foreach ( $wgExtraNamespaces as $i => $text ) {
@@ -95,7 +95,7 @@
* @return bool false if there is an error, true if not
*/
protected static function createNamespace( $id, $key ) {
- global $wgLanguageCode, $wgCanonicalNamespaceNames,
$wgExtraNamespaces;
+ global $wgCanonicalNamespaceNames, $wgExtraNamespaces;
if ( isset( $wgExtraNamespaces[$id] ) || isset(
$wgExtraNamespaces[$id + 1] ) ) {
return false;
@@ -134,6 +134,7 @@
* Warning: It's not the function you search. If you want to know the
index or page namespace id use ProofreadPage::getIndexNamespaceId() or
ProofreadPage::getPageNamespaceId()
* @param $key string the key of the namespace in the i18n file
* @param $configName string the name of the mediawiki configuration
entry that store the name of the namespace
+ * @return int
*/
public static function getNamespaceId( $key, $configName ) {
global $wgProofreadPageNamespaceIds;
diff --git a/includes/index/EditProofreadIndexPage.php
b/includes/index/EditProofreadIndexPage.php
index 4a93c03..e0ecef4 100644
--- a/includes/index/EditProofreadIndexPage.php
+++ b/includes/index/EditProofreadIndexPage.php
@@ -54,6 +54,7 @@
* Add an entry to the form
*
* @param $entry ProofreadIndexEntry
+ * @param $inputAttributes array
*/
protected function addEntry( ProofreadIndexEntry $entry,
$inputAttributes = array() ) {
global $wgOut;
@@ -120,6 +121,7 @@
* Return the name of the edit field for an entry
*
* @param $key string the entry key
+ * @return string
*/
protected function getFieldNameForEntry( $key ) {
return 'wpprpindex-' . str_replace( ' ', '_', $key );
diff --git a/includes/index/ProofreadIndexEntry.php
b/includes/index/ProofreadIndexEntry.php
index d2607ed..15405e5 100644
--- a/includes/index/ProofreadIndexEntry.php
+++ b/includes/index/ProofreadIndexEntry.php
@@ -246,8 +246,9 @@
* @return string
*/
public function getSimpleDublinCoreProperty() {
- if( !isset( $this->config['data'] ) || !$this->config['data'] )
+ if( !isset( $this->config['data'] ) || !$this->config['data'] )
{
return null;
+ }
switch( $this->config['data'] ) {
case 'language':
diff --git a/includes/index/ProofreadIndexValue.php
b/includes/index/ProofreadIndexValue.php
index fdfe7a6..43b7bbd 100644
--- a/includes/index/ProofreadIndexValue.php
+++ b/includes/index/ProofreadIndexValue.php
@@ -30,6 +30,7 @@
/**
* @param $value string
* @param $config array
+ * @throws MWException
*/
public function __construct( $value, $config ) {
if( !$this->isValid( $value ) ) {
@@ -77,6 +78,7 @@
/**
* Return name of the ProofreadIndexValue class for a type
* @param $type string
+ * @throws MWException
* @return string
*/
public static function getIndexValueClassNameForType( $type ) {
@@ -236,6 +238,7 @@
/**
* Return if $value is valid string
+ * @param $value string
* @return bool
*/
public function isValid( $value ) {
@@ -308,6 +311,7 @@
/**
* Return if $value is valid string
+ * @param $value string
* @return bool
*/
public function isValid( $value ) {
@@ -359,6 +363,7 @@
/**
* Return if $value is valid string
+ * @param $value string
* @return bool
*/
public function isValid( $value ) {
@@ -432,6 +437,7 @@
/**
* Return if $value is valid string
+ * @param $value string
* @return bool
*/
public function isValid( $value ) {
@@ -511,6 +517,7 @@
/**
* Return if $value is valid string
+ * @param $value string
* @return bool
*/
public function isValid( $value ) {
@@ -551,6 +558,7 @@
/**
* Return if $value is valid string
+ * @param $value string
* @return bool
*/
public function isValid( $value ) {
@@ -590,6 +598,7 @@
/**
* Return if $value is valid string
+ * @param $value string
* @return bool
*/
public function isValid( $value ) {
@@ -650,6 +659,7 @@
/**
* Return if $value is valid string
+ * @param $value string
* @return bool
*/
public function isValid( $value ) { //TODO to improve
diff --git a/includes/index/oai/ProofreadIndexOaiRecord.php
b/includes/index/oai/ProofreadIndexOaiRecord.php
index e2090f9..2db6c52 100644
--- a/includes/index/oai/ProofreadIndexOaiRecord.php
+++ b/includes/index/oai/ProofreadIndexOaiRecord.php
@@ -33,7 +33,7 @@
/**
* @param $index ProofreadIndexPage
- * @param $lastEditionTimestamp MW timestamp of the last edition
+ * @param $lastEditionTimestamp string MW timestamp of the last edition
*/
public function __construct( ProofreadIndexPage $index,
$lastEditionTimestamp ) {
$this->index = $index;
@@ -44,11 +44,10 @@
/**
* Return OAI record of an index page.
* @param $format string
+ * @throws MWException
* @return string
*/
public function renderRecord( $format ) {
- global $wgRightsPage, $wgRightsUrl, $wgRightsText;
-
$record = Xml::openElement( 'record' ) . "\n";
$record .= $this->renderHeader();
$record .= Xml::openElement( 'metadata' ) . "\n";
@@ -69,7 +68,6 @@
/**
* Return header of an OAI record of an index page.
- * @param $format string
* @return string
*/
public function renderHeader() {
@@ -125,6 +123,7 @@
/**
* Return Dublin Core entry
* @param $entry ProofreadIndexEntry
+ * @throws MWException
* @return string
*/
protected function getOaiDcEntry( ProofreadIndexEntry $entry ) {
@@ -192,6 +191,7 @@
/**
* Return Qualified Dublin Core entry
* @param $entry ProofreadIndexEntry
+ * @throws MWException
* @return string
*/
protected function getDcQdcEntry( ProofreadIndexEntry $entry ) {
diff --git a/includes/index/oai/SpecialProofreadIndexOai.php
b/includes/index/oai/SpecialProofreadIndexOai.php
index b0211d4..966dcdf 100644
--- a/includes/index/oai/SpecialProofreadIndexOai.php
+++ b/includes/index/oai/SpecialProofreadIndexOai.php
@@ -59,6 +59,7 @@
* Return OAI datestamp
* @param $datestamp string MW Timestamp
* @param $granularity string OAI ganularity ('YYYY-MM-DDThh:mm:ssZ' or
'YYY-MM-DD')
+ * @throws MWException
* @return string
*/
public static function datestamp( $datestamp, $granularity =
'YYYY-MM-DDThh:mm:ssZ' ) {
@@ -74,7 +75,7 @@
/**
* Return parameters of the request
- * @param $request WebRequest
+ * @throws ProofreadIndexOaiError
* @return array
*/
protected function parseRequest() {
@@ -192,6 +193,7 @@
/**
* Output the main OAI content
* @param $verb string
+ * @throws MWException
*/
protected function doResponse( $verb ) {
switch( $verb ) {
@@ -386,6 +388,7 @@
/**
* Return the earliest last rev_timestamp of an index page
+ * @throws MWException
* @return string
*/
protected function earliestDatestamp() {
@@ -483,7 +486,8 @@
/**
* check if the parameter is a valid metadata format and return it
- * @param $var Request parameter that contain a metadata format
+ * @param $var string Request parameter that contain a metadata format
+ * @throws ProofreadIndexOaiError
* @return string|null
*/
protected function validateMetadata( $var ) {
@@ -514,6 +518,7 @@
/**
* Get the Title page for a record
* @param $identifier string
+ * @throws ProofreadIndexOaiError
* @return ProofreadIndexPage
*/
protected function getRecordPage( $identifier ) {
@@ -530,6 +535,7 @@
/**
* Return the datestamp for a record
* @param $title Title
+ * @throws MWException
* @return string rev_timestamp
*/
protected function getRecordDatestamp( Title $title ) {
@@ -550,8 +556,9 @@
/**
* Check if an OAI datestamp is valid
- * @param $var Request parameter that contain a datestamp
+ * @param $var string Request parameter that contain a datestamp
* @param $defaultTime string default time for a date-only datestamp as
HHMMSS
+ * @throws ProofreadIndexOaiError
* @return string|null timestamp in MW format
*/
protected function validateDatestamp( $var, $defaultTime = '000000' ) {
@@ -571,7 +578,8 @@
/**
* Check if a token is valid
- * @param $var Request parameter that contain a token
+ * @param $var string Request parameter that contain a token
+ * @throws ProofreadIndexOaiError
* @return array|null the token content
*/
protected function validateToken( $var ) {
--
To view, visit https://gerrit.wikimedia.org/r/64622
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I959643c51529f93f2fb753f2506d43627ff9f96d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ProofreadPage
Gerrit-Branch: master
Gerrit-Owner: Reedy <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits