/** * Delete an old version of the file. * * Moves the file into an archive directory (or deletes it) * and removes the database row. * * Cache purging is done; logging is caller's responsibility. * * @param string $archiveName * @param string $reason * @param bool $suppress * @throws MWException Exception on database or file store failure * @return FileRepoStatus */ function deleteOld($archiveName, $reason, $suppress = false) { global $wgUseSquid; if ($this->getRepo()->getReadOnlyReason() !== false) { return $this->readOnlyFatalStatus(); } $batch = new LocalFileDeleteBatch($this, $reason, $suppress); $this->lock(); // begin $batch->addOld($archiveName); $status = $batch->execute(); $this->unlock(); // done $this->purgeOldThumbnails($archiveName); if ($status->isOK()) { $this->purgeDescription(); $this->purgeHistory(); } if ($wgUseSquid) { // Purge the squid SquidUpdate::purge(array($this->getArchiveUrl($archiveName))); } return $status; }
/** * Delete an old version of the file. * * Moves the file into an archive directory (or deletes it) * and removes the database row. * * Cache purging is done; logging is caller's responsibility. * * @param $archiveName String * @param $reason String * @param $suppress Boolean * @throws MWException or FSException on database or file store failure * @return FileRepoStatus object. */ function deleteOld($archiveName, $reason, $suppress = false) { $this->lock(); $batch = new LocalFileDeleteBatch($this, $reason, $suppress); $batch->addOld($archiveName); $this->purgeOldThumbnails($archiveName); $status = $batch->execute(); $this->unlock(); if ($status->ok) { $this->purgeDescription(); $this->purgeHistory(); } return $status; }
/** * Delete an old version of the file. * * Moves the file into an archive directory (or deletes it) * and removes the database row. * * Cache purging is done; logging is caller's responsibility. * * @param string $archiveName * @param string $reason * @param bool $suppress * @param User|null $user * @throws MWException Exception on database or file store failure * @return FileRepoStatus */ function deleteOld($archiveName, $reason, $suppress = false, $user = null) { if ($this->getRepo()->getReadOnlyReason() !== false) { return $this->readOnlyFatalStatus(); } $batch = new LocalFileDeleteBatch($this, $reason, $suppress, $user); $this->lock(); // begin $batch->addOld($archiveName); $status = $batch->execute(); $this->unlock(); // done $this->purgeOldThumbnails($archiveName); if ($status->isOK()) { $this->purgeDescription(); } DeferredUpdates::addUpdate(new CdnCacheUpdate(array($this->getArchiveUrl($archiveName))), DeferredUpdates::PRESEND); return $status; }
/** * Delete an old version of the file. * * Moves the file into an archive directory (or deletes it) * and removes the database row. * * Cache purging is done; logging is caller's responsibility. * * @param $archiveName String * @param $reason String * @param $suppress Boolean * @throws MWException or FSException on database or file store failure * @return FileRepoStatus object. */ function deleteOld($archiveName, $reason, $suppress = false) { if ($this->getRepo()->getReadOnlyReason() !== false) { return $this->readOnlyFatalStatus(); } $batch = new LocalFileDeleteBatch($this, $reason, $suppress); $this->lock(); // begin $batch->addOld($archiveName); $status = $batch->execute(); $this->unlock(); // done $this->purgeOldThumbnails($archiveName); if ($status->isOK()) { $this->purgeDescription(); $this->purgeHistory(); } return $status; }