diff options
-rw-r--r-- | modules-available/sysconfig/clientscript.js | 2 | ||||
-rw-r--r-- | modules-available/sysconfig/page.inc.php | 32 |
2 files changed, 33 insertions, 1 deletions
diff --git a/modules-available/sysconfig/clientscript.js b/modules-available/sysconfig/clientscript.js index f3a47824..1553d678 100644 --- a/modules-available/sysconfig/clientscript.js +++ b/modules-available/sysconfig/clientscript.js @@ -98,7 +98,7 @@ function checkBuildStatus() { confs.push($(this).val()); }); if (mods.length === 0 && confs.length === 0) return; - if (++statusChecks < 10) setTimeout(checkBuildStatus, 200 + 50 * statusChecks); + if (++statusChecks < 10) setTimeout(checkBuildStatus, 150 + 100 * statusChecks); $.post('?do=SysConfig', { mods: mods.join(), confs: confs.join(), token: TOKEN, action: 'status' }, function (data) { if (typeof data === 'undefined') return; if (typeof data.mods === 'object') updateButtonColor($(".refmod.btn-primary"), data.mods); diff --git a/modules-available/sysconfig/page.inc.php b/modules-available/sysconfig/page.inc.php index 8053ab43..30271514 100644 --- a/modules-available/sysconfig/page.inc.php +++ b/modules-available/sysconfig/page.inc.php @@ -479,4 +479,36 @@ class Page_SysConfig extends Page AddConfig_Base::setStep($step); } + /** + * If modules need updates (blue refresh buttons), we query their state + * via ajax, in case they are about to generate. This happens for example + * if you edit a module and a bunch of configs depend on it and will be + * rebuilt. + */ + protected function doAjax() + { + if (Request::post('action') === 'status') { + $mods = Request::post('mods'); + $confs = Request::post('confs'); + $outMods = array(); + $outConfs = array(); + $mods = explode(',', $mods); + $confs = explode(',', $confs); + // Mods + $res = Database::simpleQuery("SELECT moduleid FROM configtgz_module + WHERE moduleid in (:mods) AND status = 'OK'", compact('mods')); + while ($row = $res->fetch(PDO::FETCH_ASSOC)) { + $outMods[] = $row['moduleid']; + } + // Confs + $res = Database::simpleQuery("SELECT configid FROM configtgz + WHERE configid in (:confs) AND status = 'OK'", compact('confs')); + while ($row = $res->fetch(PDO::FETCH_ASSOC)) { + $outConfs[] = $row['configid']; + } + Header('Content-Type: application/json'); + die(json_encode(array('mods' => $outMods, 'confs' => $outConfs))); + } + } + } |