MDL-56958 ajax: Prefer the general renderer

This commit is contained in:
Damyon Wiese 2016-11-15 12:36:37 +08:00
parent 0b8e0c374f
commit 946281d282
2 changed files with 5 additions and 1 deletions

View File

@ -32,6 +32,8 @@ define('AJAX_SCRIPT', true);
require_once(__DIR__ . '/../../config.php');
require_once($CFG->libdir . '/externallib.php');
define('PREFERRED_RENDERER_TARGET', RENDERER_TARGET_GENERAL);
$rawjson = file_get_contents('php://input');
$requests = json_decode($rawjson, true);

View File

@ -137,7 +137,9 @@ abstract class renderer_factory_base implements renderer_factory {
// If the target hasn't been specified we need to guess the defaults.
// We also override the target with the default if the maintenance target has been provided.
// This ensures we don't use the maintenance renderer if we are processing a special target.
if (CLI_SCRIPT) {
if (defined('PREFERRED_RENDERER_TARGET')) {
$target = PREFERRED_RENDERER_TARGET;
} else if (CLI_SCRIPT) {
$target = RENDERER_TARGET_CLI;
} else if (AJAX_SCRIPT) {
$target = RENDERER_TARGET_AJAX;