/** * Remove the data about given file from the garbage collector */ public function tempFileClearInfo($id) { global $wgExternalSharedDB; wfProfileIn(__METHOD__); $imagePath = $this->tempFileGetPath($id); $imageName = basename($imagePath); $this->log(__METHOD__, "removing temp file '{$imageName}' (#{$id})"); // remove from file repo $imageTitle = Title::newFromText($imageName, NS_FILE); $repo = RepoGroup::singleton()->getLocalRepo(); $imageFile = new FakeLocalFile($imageTitle, $repo); $imageFile->delete(''); // remove from DB $dbw = wfGetDB(DB_MASTER, array(), $wgExternalSharedDB); $dbw->delete('garbage_collector', array('gc_id' => $id), __METHOD__); $dbw->commit(); wfProfileOut(__METHOD__); }
function clean() { global $wgRequest; $file = new FakeLocalFile(Title::newFromText($wgRequest->getVal('mwname'), 6), RepoGroup::singleton()->getLocalRepo()); $file->delete(''); $this->tempFileClearInfo($wgRequest->getVal('tempid')); }