r22718 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r22717‎ | r22718 | r22719 >
Date:21:03, 4 June 2007
Author:tstarling
Status:old
Tags:
Comment:
Don't delete images in foreign repositories. Also fixed image counter downwards drift bug.
Modified paths:
  • /trunk/phase3/includes/ImagePage.php (modified) (history)
  • /trunk/phase3/includes/filerepo/ForeignDBFile.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/ImagePage.php
@@ -502,6 +502,12 @@
503503 {
504504 global $wgUser, $wgOut, $wgRequest;
505505
 506+ if ( !$this->img->exists() || !$this->img->isLocal() ) {
 507+ # Use standard article deletion
 508+ Article::delete();
 509+ return;
 510+ }
 511+
506512 $confirm = $wgRequest->wasPosted();
507513 $reason = $wgRequest->getVal( 'wpReason' );
508514 $image = $wgRequest->getVal( 'image' );
@@ -533,7 +539,7 @@
534540 # Deleting old images doesn't require confirmation
535541 if ( !is_null( $oldimage ) || $confirm ) {
536542 if( $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ), $oldimage ) ) {
537 - $this->doDelete( $reason );
 543+ $this->doDeleteImage( $reason );
538544 } else {
539545 $wgOut->showFatalError( wfMsg( 'sessionfailure' ) );
540546 }
@@ -552,9 +558,12 @@
553559
554560 /*
555561 * Delete an image.
 562+ * Called doDeleteImage() not doDelete() so that Article::delete() doesn't
 563+ * call back to here.
 564+ *
556565 * @param $reason User provided reason for deletion.
557566 */
558 - function doDelete( $reason ) {
 567+ function doDeleteImage( $reason ) {
559568 global $wgOut, $wgRequest;
560569
561570 $oldimage = $wgRequest->getVal( 'oldimage' );
Index: trunk/phase3/includes/filerepo/ForeignDBFile.php
@@ -25,6 +25,9 @@
2626 function restore( /*...*/ ) {
2727 $this->readOnlyError();
2828 }
 29+ function delete( /*...*/ ) {
 30+ $this->readOnlyError();
 31+ }
2932
3033 function getDescriptionUrl() {
3134 // Restore remote behaviour

Follow-up revisions

RevisionCommit summaryAuthorDate
r22747Merged revisions 22716-22746 via svnmerge from...david07:07, 5 June 2007

Status & tagging log