public function setup() { if (!$this->hasSetting("folder")) { return; } TrashBinEvent::register($this->env->events()); $this->trashBinManager = new TrashBinManager($this->env, $this->getSettings()); $this->env->events()->register("session/login", $this->trashBinManager); $this->addService("trash", "TrashBinServices"); $this->env->filesystem()->registerActionInterceptor("plugin-trashbin", $this->trashBinManager); $this->env->filesystem()->registerFilesystemId("trash", $this->trashBinManager); }
public function restoreItem($item) { $originalItem = $this->getOriginalItem($item); $this->env->filesystem()->assertRights($originalItem->parent(), FilesystemController::PERMISSION_LEVEL_READWRITE, "restore"); $this->env->filesystem()->validateAction(TrashBinEvent::RESTORE, $originalItem); if ($this->env->filesystem()->triggerActionInterceptor(TrashBinEvent::RESTORE, $item)) { return; } $this->doRestoreItem($item, $originalItem); $this->env->events()->onEvent(TrashBinEvent::restored($originalItem)); }