return $this->quickPurgeBatch( array( $path ) );
}
+ /**
+ * Deletes a directory if empty.
+ * This function can be used to write to otherwise read-only foreign repos.
+ *
+ * @param $dir string Virtual URL (or storage path) of directory to clean
+ * @return Status
+ */
+ public function quickCleanDir( $dir ) {
+ $status = $this->newGood();
+ $status->merge( $this->backend->clean(
+ array( 'dir' => $this->resolveToStoragePath( $dir ) ) ) );
+
+ return $status;
+ }
+
/**
* Import a batch of files from the local file system into the repo.
* This does no locking nor journaling and overrides existing files.
/**
* Deletes a directory if empty.
- * This function can be used to write to otherwise read-only foreign repos.
*
* @param $dir string Virtual URL (or storage path) of directory to clean
* @return Status
*/
public function cleanDir( $dir ) {
+ $this->assertWritableRepo(); // fail out if read-only
+
$status = $this->newGood();
$status->merge( $this->backend->clean(
array( 'dir' => $this->resolveToStoragePath( $dir ) ) ) );
# Delete the thumbnails
$this->repo->quickPurgeBatch( $purgeList );
# Clear out the thumbnail directory if empty
- $this->repo->cleanDir( $dir );
+ $this->repo->quickCleanDir( $dir );
}
}
# Delete the thumbnails
$this->repo->quickPurgeBatch( $purgeList );
# Clear out the thumbnail directory if empty
- $this->repo->cleanDir( $dir );
+ $this->repo->quickCleanDir( $dir );
}
/** purgeDescription inherited */