mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-09 12:02:24 +09:00
Disable rewrite level 2 if test request fails
This commit is contained in:
parent
dd561d9159
commit
8964891387
4 changed files with 35 additions and 1 deletions
|
|
@ -52,6 +52,12 @@ class Router
|
||||||
'extra_vars' => ['act' => 'procFileOutput'],
|
'extra_vars' => ['act' => 'procFileOutput'],
|
||||||
'priority' => 0,
|
'priority' => 0,
|
||||||
),
|
),
|
||||||
|
'common/rewrite/test/$test' => array(
|
||||||
|
'regexp' => '#^common/rewrite/test/(?<test>[0-9]+)$#',
|
||||||
|
'vars' => ['test' => 'int'],
|
||||||
|
'extra_vars' => ['act' => 'dispAdminRewriteTest'],
|
||||||
|
'priority' => 0,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1008,6 +1008,15 @@ class adminAdminView extends admin
|
||||||
$this->setTemplateFile('server_env.html');
|
$this->setTemplateFile('server_env.html');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rewrite test
|
||||||
|
*/
|
||||||
|
public function dispAdminRewriteTest()
|
||||||
|
{
|
||||||
|
$test = intval(Context::get('test'));
|
||||||
|
Context::setResponseMethod('JSON');
|
||||||
|
$this->add('result', $test * 42);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* End of file admin.admin.view.php */
|
/* End of file admin.admin.view.php */
|
||||||
/* Location: ./modules/admin/admin.admin.view.php */
|
/* Location: ./modules/admin/admin.admin.view.php */
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@
|
||||||
<action name="dispAdminConfigFtp" type="view" menu_name="adminConfigurationFtp" menu_index="true" />
|
<action name="dispAdminConfigFtp" type="view" menu_name="adminConfigurationFtp" menu_index="true" />
|
||||||
<action name="dispAdminSetup" type="view" menu_name="adminMenuSetup" menu_index="true" />
|
<action name="dispAdminSetup" type="view" menu_name="adminMenuSetup" menu_index="true" />
|
||||||
<action name="dispAdminViewServerEnv" type="view" />
|
<action name="dispAdminViewServerEnv" type="view" />
|
||||||
|
<action name="dispAdminRewriteTest" type="view" />
|
||||||
|
|
||||||
<action name="procAdminRemoveIcons" type="controller" />
|
<action name="procAdminRemoveIcons" type="controller" />
|
||||||
<action name="procAdminRecompileCacheFile" type="controller" />
|
<action name="procAdminRecompileCacheFile" type="controller" />
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,24 @@ jQuery(function($){
|
||||||
}
|
}
|
||||||
}).triggerHandler("change");
|
}).triggerHandler("change");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Disable rewrite level 2 if test AJAX request fails.
|
||||||
|
if ($('#use_rewrite_2').size() && !$('#use_rewrite_2').is(':checked')) {
|
||||||
|
var testval = 1000 + Math.floor(Math.random() * 9000);
|
||||||
|
$.ajax({
|
||||||
|
url: request_uri + 'common/rewrite/test/' + testval,
|
||||||
|
type: 'GET',
|
||||||
|
dataType: 'json',
|
||||||
|
success: function(data) {
|
||||||
|
if (data.result != testval * 42) {
|
||||||
|
$('#use_rewrite_2').prop('disabled', true);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function() {
|
||||||
|
$('#use_rewrite_2').prop('disabled', true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function setStartModule(){
|
function setStartModule(){
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue