From: Tim Starling Date: Mon, 4 Jun 2007 21:03:36 +0000 (+0000) Subject: Don't delete images in foreign repositories. Also fixed image counter downwards drift... X-Git-Tag: 1.31.0-rc.0~52688 X-Git-Url: https://git.cyclocoop.org//%22?a=commitdiff_plain;h=e1736970254c0b4551286300ff7b92795dd6180b;p=lhc%2Fweb%2Fwiklou.git Don't delete images in foreign repositories. Also fixed image counter downwards drift bug. --- diff --git a/includes/ImagePage.php b/includes/ImagePage.php index bdda7a14c4..1f3454168d 100644 --- a/includes/ImagePage.php +++ b/includes/ImagePage.php @@ -502,6 +502,12 @@ EOT { global $wgUser, $wgOut, $wgRequest; + if ( !$this->img->exists() || !$this->img->isLocal() ) { + # Use standard article deletion + Article::delete(); + return; + } + $confirm = $wgRequest->wasPosted(); $reason = $wgRequest->getVal( 'wpReason' ); $image = $wgRequest->getVal( 'image' ); @@ -533,7 +539,7 @@ EOT # Deleting old images doesn't require confirmation if ( !is_null( $oldimage ) || $confirm ) { if( $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ), $oldimage ) ) { - $this->doDelete( $reason ); + $this->doDeleteImage( $reason ); } else { $wgOut->showFatalError( wfMsg( 'sessionfailure' ) ); } @@ -552,9 +558,12 @@ EOT /* * Delete an image. + * Called doDeleteImage() not doDelete() so that Article::delete() doesn't + * call back to here. + * * @param $reason User provided reason for deletion. */ - function doDelete( $reason ) { + function doDeleteImage( $reason ) { global $wgOut, $wgRequest; $oldimage = $wgRequest->getVal( 'oldimage' ); diff --git a/includes/filerepo/ForeignDBFile.php b/includes/filerepo/ForeignDBFile.php index 6c903e9f5c..c5f65d5ca5 100644 --- a/includes/filerepo/ForeignDBFile.php +++ b/includes/filerepo/ForeignDBFile.php @@ -25,6 +25,9 @@ class ForeignDBFile extends LocalFile { function restore( /*...*/ ) { $this->readOnlyError(); } + function delete( /*...*/ ) { + $this->readOnlyError(); + } function getDescriptionUrl() { // Restore remote behaviour