Index: trunk/extensions/OAI/OAIHarvest.php |
— | — | @@ -39,6 +39,7 @@ |
40 | 40 | |
41 | 41 | # Need shared code... |
42 | 42 | require_once( 'OAIRepo.php' ); |
| 43 | +require_once( 'maintenance/refreshLinks.inc' ); |
43 | 44 | |
44 | 45 | global $oaiSourceRepository; |
45 | 46 | global $oaiAgentExtra; |
— | — | @@ -386,19 +387,43 @@ |
387 | 388 | $fname ); |
388 | 389 | } |
389 | 390 | $dbw->commit(); |
| 391 | + |
| 392 | + fixLinksFromArticle( $id ); |
| 393 | + |
390 | 394 | return true; |
391 | 395 | } |
392 | 396 | |
393 | 397 | function doDelete() { |
| 398 | + $fname = 'OAIUpdateRecord::doDelete'; |
394 | 399 | $id = $this->getArticleId(); |
395 | 400 | |
396 | 401 | echo "DELETING\n"; |
397 | 402 | |
| 403 | + /* |
398 | 404 | $dbw =& wfGetDB( DB_WRITE ); |
399 | 405 | $dbw->begin(); |
400 | 406 | $dbw->delete( 'cur', array( 'cur_id' => $id ), $fname ); |
401 | 407 | $dbw->commit(); |
402 | | - |
| 408 | + */ |
| 409 | + $dbw =& wfGetDB( DB_WRITE ); |
| 410 | + $dbw->begin(); |
| 411 | + $title = Title::newFromId( $id ); |
| 412 | + if( is_null( $title ) ) { |
| 413 | + $dbw->commit(); |
| 414 | + return new OAIError( "Failed to delete article id $id" ); |
| 415 | + } else { |
| 416 | + $article = new Article( $title ); |
| 417 | + $article->doDeleteArticle( '(deleted via OAI updater)' ); |
| 418 | + |
| 419 | + global $wgDeferredUpdateList, $wgPostCommitUpdateList; |
| 420 | + while( $up = array_shift( $wgDeferredUpdateList ) ) { |
| 421 | + $up->doUpdate(); |
| 422 | + } |
| 423 | + $dbw->commit(); |
| 424 | + while( $up = array_shift( $wgPostCommitUpdateList ) ) { |
| 425 | + $up->doUpdate(); |
| 426 | + } |
| 427 | + } |
403 | 428 | return true; |
404 | 429 | } |
405 | 430 | |