__('Page Trash', __FILE__), // getModuleInfo title 'summary' => __('Handles emptying of Page trash', __FILE__), // getModuleInfo summary 'version' => 101, 'permanent' => true, ); } protected $trashPages; protected $maxItems = 1000; /** * Check if an empty request has been received and delete if so, otherwise render a confirmation form * */ public function ___execute() { if(isset($_POST['submit_empty']) && !empty($_POST['confirm_empty'])) { ini_set('max_execution_time', 60*10); $this->trashPages = $this->pages->get($this->config->trashPageID)->children("limit=$this->maxItems, status<" . Page::statusMax); $this->session->CSRF->validate(); $this->session->message($this->_("The trash has been emptied")); foreach($this->trashPages as $t) $this->pages->delete($t, true); // redirect to admin root after emptying trash $this->session->redirect($this->config->urls->admin); } else { // render a form showing what pages are in the trash and confirming they want to empty it $this->trashPages = $this->pages->get($this->config->trashPageID)->children("limit=2, status<" . Page::statusMax); return $this->render(); } } /** * Render a form showing what pages are in the trash and confirming they want to empty it * */ protected function render() { $form = $this->modules->get("InputfieldForm"); $form->attr('action', './'); $form->attr('method', 'post'); if(!count($this->trashPages)) return "