/** * Changes updater mode via AJAX */ public function changeUpdaterMode() { $f3 = \Base::instance(); $mode = $f3->get("PARAMS.mode"); $settings = \MassUpdate\Admin\Models\Settings::fetch(); $current_settings = $settings->populateState()->getItem(); $current_settings['general.updater_mode'] = (int) $mode; $settings->bind($current_settings); $settings->save(); echo $this->outputJson($this->getJsonResponse(array('result' => "Updater mode has been changed"))); }
/** * Lets all registered groups initialize */ public function initializeApps() { if ($this->initialized) { return; } // get current mode from Settings model $settings = \MassUpdate\Admin\Models\Settings::fetch(); $paths = \Base::instance()->get('dsc.massupdate.paths'); if (!empty($paths)) { foreach ($paths as $path) { if (file_exists($path . '/App.php')) { $app = null; require $path . '/App.php'; if ($app != null) { $res = $app->initialize($settings->{'general.updater_mode'}); if ($res) { $this->list_apps[$app->getName()] = $app; } } } } } $this->initialized = true; }
/** * Returns approprate model * * @param $type Name * model * * @return Instance of model */ public function getModel($type = "settings") { $model = null; switch ($type) { case "settings": // get current mode from Settings model $model = \MassUpdate\Admin\Models\Settings::fetch(); break; } return $model; }