Index: trunk/extensions/OAI/OAIRepo_body.php |
— | — | @@ -69,6 +69,9 @@ |
70 | 70 | $this->_errors[] = array( $code, $message ); |
71 | 71 | } |
72 | 72 | |
| 73 | + /** |
| 74 | + * @return bool |
| 75 | + */ |
73 | 76 | function errorCondition() { |
74 | 77 | return !empty( $this->_errors ); |
75 | 78 | } |
— | — | @@ -241,8 +244,11 @@ |
242 | 245 | } |
243 | 246 | } |
244 | 247 | |
| 248 | + /** |
| 249 | + * @param $responseSize int |
| 250 | + */ |
245 | 251 | private function logRequest( $responseSize ) { |
246 | | - global $oaiAudit, $wgDBname; |
| 252 | + global $oaiAudit, $wgDBname, $wgRequest; |
247 | 253 | if( $oaiAudit ) { |
248 | 254 | $db = $this->getAuditDatabase(); |
249 | 255 | $db->insert( |
— | — | @@ -250,7 +256,7 @@ |
251 | 257 | array( |
252 | 258 | 'oa_client' => $this->_clientId, |
253 | 259 | 'oa_timestamp' => $db->timestamp(), |
254 | | - 'oa_ip' => wfGetIP(), |
| 260 | + 'oa_ip' => $wgRequest->getIP(), |
255 | 261 | 'oa_agent' => @$_SERVER['HTTP_USER_AGENT'], |
256 | 262 | 'oa_dbname' => $wgDBname, |
257 | 263 | 'oa_response_size' => $responseSize, |
— | — | @@ -692,7 +698,6 @@ |
693 | 699 | 'namespace' => 'http://www.mediawiki.org/xml/lsearch-0.1/', |
694 | 700 | 'schema' => 'http://www.mediawiki.org/xml/lsearch-0.1.xsd' ) ); |
695 | 701 | } |
696 | | - |
697 | 702 | } |
698 | 703 | |
699 | 704 | class OAIRecord { |
— | — | @@ -775,10 +780,16 @@ |
776 | 781 | $this->_writer = $writer; |
777 | 782 | } |
778 | 783 | |
| 784 | + /** |
| 785 | + * @return bool |
| 786 | + */ |
779 | 787 | function isDeleted() { |
780 | 788 | return $this->_deleted; |
781 | 789 | } |
782 | 790 | |
| 791 | + /** |
| 792 | + * @return string |
| 793 | + */ |
783 | 794 | function getIdentifier() { |
784 | 795 | return OAIRepo::identifierPrefix() . $this->_id; |
785 | 796 | } |
Index: trunk/extensions/OAI/OAIHarvest.php |
— | — | @@ -271,14 +271,23 @@ |
272 | 272 | $this->_page = $pageData; |
273 | 273 | } |
274 | 274 | |
| 275 | + /** |
| 276 | + * @return int |
| 277 | + */ |
275 | 278 | function getArticleId() { |
276 | 279 | return IntVal( $this->_page['id'] ); |
277 | 280 | } |
278 | 281 | |
| 282 | + /** |
| 283 | + * @return bool |
| 284 | + */ |
279 | 285 | function isDeleted() { |
280 | 286 | return isset( $this->_page['deleted'] ); |
281 | 287 | } |
282 | 288 | |
| 289 | + /** |
| 290 | + * @return Title |
| 291 | + */ |
283 | 292 | function getTitle() { |
284 | 293 | return Title::newFromText( $this->_page['title'] ); |
285 | 294 | } |
— | — | @@ -419,8 +428,9 @@ |
420 | 429 | } |
421 | 430 | |
422 | 431 | /** |
423 | | - * @param int $pageId |
424 | | - * @param Title $title |
| 432 | + * @param $db DatabaseBase |
| 433 | + * @param $pageId int |
| 434 | + * @param $title Title |
425 | 435 | * @return Article |
426 | 436 | */ |
427 | 437 | function prepareArticle( $db, $pageId, $title ) { |
— | — | @@ -539,6 +549,7 @@ |
540 | 550 | echo "File updating temporarily broken on 1.11, sorry!\n"; |
541 | 551 | return; |
542 | 552 | |
| 553 | + /* |
543 | 554 | $timestamp = wfTimestamp( TS_UNIX, $this->getTimestamp( $upload['timestamp'] ) ); |
544 | 555 | if( file_exists( $filename ) |
545 | 556 | && filemtime( $filename ) == $timestamp |
— | — | @@ -575,6 +586,7 @@ |
576 | 587 | |
577 | 588 | touch( $filename, $timestamp ); |
578 | 589 | echo " done.\n"; |
| 590 | + */ |
579 | 591 | } |
580 | 592 | |
581 | 593 | /** |
— | — | @@ -600,12 +612,12 @@ |
601 | 613 | } |
602 | 614 | |
603 | 615 | /** |
604 | | - * @param DomNode $node |
| 616 | + * @param $node DomNode |
| 617 | + * @return OAIUpdateRecord |
605 | 618 | */ |
606 | 619 | static function newFromNode( $node ) { |
607 | 620 | $pageData = OAIUpdateRecord::readRecord( $node ); |
608 | | - $record = new OAIUpdateRecord( $pageData ); |
609 | | - return $record; |
| 621 | + return new OAIUpdateRecord( $pageData ); |
610 | 622 | } |
611 | 623 | |
612 | 624 | /** |