/** * Revert selected Version as last Version. * * @return void */ public function revert() { $path = JoomDOCRequest::getPath(); $result = false; if (JoomDOCAccessFileSystem::manageVersions(false, $path)) { JRequest::checkToken() or jexit(JText::_('JINVALID_TOKEN')); $cid = JRequest::getVar('cid', array(), 'default', 'array'); $id = reset($cid); $model = $this->getModel(); $result = $model->revert($id, $path); } $msg = $result ? JText::sprintf('JOOMDOC_REVERT_SUCCESS', $result->revertVersion, $result->newLastVersion, $result->oldLastVersion) : JText::_('JOOMDOC_REVERT_UNSUCCESS'); $type = $result ? 'message' : 'error'; $this->setRedirect(JoomDOCRoute::viewFileInfo($path), $msg, $type); }