Adds getAjaxHandler() API to controllers
Fixes bug where update process fails midway
This commit is contained in:
parent
56caa1db3d
commit
f9c921a797
|
|
@ -355,17 +355,31 @@ class Controller extends Extendable
|
|||
return $this->makeViewContent($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the AJAX handler for the current request, if available.
|
||||
* @return string
|
||||
*/
|
||||
public function getAjaxHandler()
|
||||
{
|
||||
if (!Request::ajax() || Request::method() != 'POST') {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($handler = Request::header('X_OCTOBER_REQUEST_HANDLER')) {
|
||||
return trim($handler);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is used internally.
|
||||
* Invokes a controller event handler and loads the supplied partials.
|
||||
*/
|
||||
protected function execAjaxHandlers()
|
||||
{
|
||||
if (Request::method() != 'POST') {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($handler = trim(Request::header('X_OCTOBER_REQUEST_HANDLER'))) {
|
||||
if ($handler = $this->getAjaxHandler()) {
|
||||
try {
|
||||
/*
|
||||
* Validate the handler name
|
||||
|
|
|
|||
|
|
@ -566,17 +566,30 @@ class Controller
|
|||
// AJAX
|
||||
//
|
||||
|
||||
/**
|
||||
* Returns the AJAX handler for the current request, if available.
|
||||
* @return string
|
||||
*/
|
||||
public function getAjaxHandler()
|
||||
{
|
||||
if (!Request::ajax() || Request::method() != 'POST') {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($handler = Request::header('X_OCTOBER_REQUEST_HANDLER')) {
|
||||
return trim($handler);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the page, layout, component and plugin AJAX handlers.
|
||||
* @return mixed Returns the AJAX Response object or null.
|
||||
*/
|
||||
protected function execAjaxHandlers()
|
||||
{
|
||||
if (Request::method() != 'POST') {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($handler = trim(Request::header('X_OCTOBER_REQUEST_HANDLER'))) {
|
||||
if ($handler = $this->getAjaxHandler()) {
|
||||
try {
|
||||
/*
|
||||
* Validate the handler name
|
||||
|
|
|
|||
|
|
@ -43,6 +43,10 @@ class Updates extends Controller
|
|||
|
||||
BackendMenu::setContext('October.System', 'system', 'updates');
|
||||
SettingsManager::setContext('October.System', 'updates');
|
||||
|
||||
if ($this->getAjaxHandler() == 'onExecuteStep') {
|
||||
$this->useSecurityToken = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue