r95187 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r95186‎ | r95187 | r95188 >
Date:01:02, 22 August 2011
Author:reedy
Status:ok
Tags:
Comment:
Documentation

Commented out some unreachable code
Modified paths:
  • /trunk/extensions/OAI/OAIHarvest.php (modified) (history)
  • /trunk/extensions/OAI/OAIRepo_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/OAI/OAIRepo_body.php
@@ -69,6 +69,9 @@
7070 $this->_errors[] = array( $code, $message );
7171 }
7272
 73+ /**
 74+ * @return bool
 75+ */
7376 function errorCondition() {
7477 return !empty( $this->_errors );
7578 }
@@ -241,8 +244,11 @@
242245 }
243246 }
244247
 248+ /**
 249+ * @param $responseSize int
 250+ */
245251 private function logRequest( $responseSize ) {
246 - global $oaiAudit, $wgDBname;
 252+ global $oaiAudit, $wgDBname, $wgRequest;
247253 if( $oaiAudit ) {
248254 $db = $this->getAuditDatabase();
249255 $db->insert(
@@ -250,7 +256,7 @@
251257 array(
252258 'oa_client' => $this->_clientId,
253259 'oa_timestamp' => $db->timestamp(),
254 - 'oa_ip' => wfGetIP(),
 260+ 'oa_ip' => $wgRequest->getIP(),
255261 'oa_agent' => @$_SERVER['HTTP_USER_AGENT'],
256262 'oa_dbname' => $wgDBname,
257263 'oa_response_size' => $responseSize,
@@ -692,7 +698,6 @@
693699 'namespace' => 'http://www.mediawiki.org/xml/lsearch-0.1/',
694700 'schema' => 'http://www.mediawiki.org/xml/lsearch-0.1.xsd' ) );
695701 }
696 -
697702 }
698703
699704 class OAIRecord {
@@ -775,10 +780,16 @@
776781 $this->_writer = $writer;
777782 }
778783
 784+ /**
 785+ * @return bool
 786+ */
779787 function isDeleted() {
780788 return $this->_deleted;
781789 }
782790
 791+ /**
 792+ * @return string
 793+ */
783794 function getIdentifier() {
784795 return OAIRepo::identifierPrefix() . $this->_id;
785796 }
Index: trunk/extensions/OAI/OAIHarvest.php
@@ -271,14 +271,23 @@
272272 $this->_page = $pageData;
273273 }
274274
 275+ /**
 276+ * @return int
 277+ */
275278 function getArticleId() {
276279 return IntVal( $this->_page['id'] );
277280 }
278281
 282+ /**
 283+ * @return bool
 284+ */
279285 function isDeleted() {
280286 return isset( $this->_page['deleted'] );
281287 }
282288
 289+ /**
 290+ * @return Title
 291+ */
283292 function getTitle() {
284293 return Title::newFromText( $this->_page['title'] );
285294 }
@@ -419,8 +428,9 @@
420429 }
421430
422431 /**
423 - * @param int $pageId
424 - * @param Title $title
 432+ * @param $db DatabaseBase
 433+ * @param $pageId int
 434+ * @param $title Title
425435 * @return Article
426436 */
427437 function prepareArticle( $db, $pageId, $title ) {
@@ -539,6 +549,7 @@
540550 echo "File updating temporarily broken on 1.11, sorry!\n";
541551 return;
542552
 553+ /*
543554 $timestamp = wfTimestamp( TS_UNIX, $this->getTimestamp( $upload['timestamp'] ) );
544555 if( file_exists( $filename )
545556 && filemtime( $filename ) == $timestamp
@@ -575,6 +586,7 @@
576587
577588 touch( $filename, $timestamp );
578589 echo " done.\n";
 590+ */
579591 }
580592
581593 /**
@@ -600,12 +612,12 @@
601613 }
602614
603615 /**
604 - * @param DomNode $node
 616+ * @param $node DomNode
 617+ * @return OAIUpdateRecord
605618 */
606619 static function newFromNode( $node ) {
607620 $pageData = OAIUpdateRecord::readRecord( $node );
608 - $record = new OAIUpdateRecord( $pageData );
609 - return $record;
 621+ return new OAIUpdateRecord( $pageData );
610622 }
611623
612624 /**

Status & tagging log