public loadhistory ( ) : boolean | ||
return | boolean | True if the content history is reverted, false otherwise |
public function loadhistory()
{
$model = $this->getModel();
$model->lock();
$historyId = $this->input->get('version_id', null, 'integer');
$alias = $this->container->componentName . '.' . $this->view;
$returnUrl = 'index.php?option=' . $this->container->componentName . '&view=' . $this->container->inflector->pluralize($this->view) . $this->getItemidURLSuffix();
if ($customURL = $this->input->getBase64('returnurl', '')) {
$customURL = base64_decode($customURL);
}
if (!empty($customURL)) {
$returnUrl = $customURL;
}
try {
$model->loadhistory($historyId, $alias);
} catch (\Exception $e) {
$this->setRedirect($returnUrl, $e->getMessage(), 'error');
$model->unlock();
return false;
}
// Access check.
if (!$this->checkACL('@loadhistory')) {
$this->setRedirect($returnUrl, \JText::_('JLIB_APPLICATION_ERROR_EDIT_NOT_PERMITTED'), 'error');
$model->unlock();
return false;
}
$model->store();
$this->setRedirect($returnUrl, \JText::sprintf('JLIB_APPLICATION_SUCCESS_LOAD_HISTORY', $model->getState('save_date'), $model->getState('version_note')));
return true;
}