$jsonrpc->makeSuccess('ok'); } if ($jsonrpc->getMethod() == 'plugin::remove') { $market = market::byId($params['plugin_id']); if (!is_object($market)) { throw new Exception(__('Impossible de trouver l\'objet associé : ', __FILE__) . $params['plugin_id']); } if (!isset($params['version'])) { $params['version'] = 'stable'; } $market->remove(); $jsonrpc->makeSuccess('ok'); } /* * ************************Update*************************** */ if ($jsonrpc->getMethod() == 'update::all') { $jsonrpc->makeSuccess(utils::o2a(update::all())); } if ($jsonrpc->getMethod() == 'update::update') { jeedom::update('', 0); $jsonrpc->makeSuccess('ok'); } if ($jsonrpc->getMethod() == 'update::checkUpdate') { update::checkAllUpdate(); $jsonrpc->makeSuccess('ok'); } /* * ************************Network*************************** */ if ($jsonrpc->getMethod() == 'network::restartNgrok') { config::save('market::allowDNS', 1); if (network::dns_run()) { network::dns_stop(); }
* Jeedom is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Jeedom. If not, see <http://www.gnu.org/licenses/>. */ try { require_once dirname(__FILE__) . '/../../core/php/core.inc.php'; include_file('core', 'authentification', 'php'); if (!isConnect('admin')) { throw new Exception(__('401 - Accès non autorisé', __FILE__), -1234); } if (init('action') == 'all') { ajax::success(utils::o2a(update::all(init('filter')))); } if (init('action') == 'checkAllUpdate') { update::checkAllUpdate(); ajax::success(); } if (init('action') == 'update') { log::clear('update'); $update = update::byId(init('id')); if (!is_object($update)) { throw new Exception(__('Aucune correspondance pour l\'ID : ' . init('id'), __FILE__)); } try { if ($update->getType() != 'core') { log::add('update', 'update', __("[START UPDATE]\n", __FILE__)); }
public static function changeMode($_mode) { switch ($_mode) { case 'master': if (config::byKey('jeeNetwork::mode') != 'master') { $cron = new cron(); $cron->setClass('history'); $cron->setFunction('historize'); $cron->setSchedule('*/5 * * * * *'); $cron->setTimeout(5); $cron->save(); $cron = new cron(); $cron->setClass('scenario'); $cron->setFunction('check'); $cron->setSchedule('* * * * * *'); $cron->setTimeout(5); $cron->save(); $cron = new cron(); $cron->setClass('cmd'); $cron->setFunction('collect'); $cron->setSchedule('*/5 * * * * *'); $cron->setTimeout(5); $cron->save(); $cron = new cron(); $cron->setClass('history'); $cron->setFunction('archive'); $cron->setSchedule('00 * * * * *'); $cron->setTimeout(20); $cron->save(); config::save('jeeNetwork::mode', 'master'); } break; case 'slave': if (config::byKey('jeeNetwork::mode') != 'slave') { foreach (eqLogic::all() as $eqLogic) { $eqLogic->remove(); } foreach (object::all() as $object) { $object->remove(); } foreach (update::all() as $update) { switch ($update->getType()) { case 'core': break; case 'plugin': try { $plugin = plugin::byId($update->getLogicalId()); if (is_object($plugin) && $plugin->getAllowRemote() != 1) { $update->deleteObjet(); } } catch (Exception $e) { } break; default: $update->deleteObjet(); break; } } foreach (view::all() as $view) { $view->remove(); } foreach (plan::all() as $plan) { $plan->remove(); } foreach (scenario::all() as $scenario) { $scenario->remove(); } foreach (listener::all() as $listener) { $listener->remove(); } $cron = cron::byClassAndFunction('history', 'historize'); if (is_object($cron)) { $cron->remove(); } $cron = cron::byClassAndFunction('scenario', 'check'); if (is_object($cron)) { $cron->remove(); } $cron = cron::byClassAndFunction('cmd', 'collect'); if (is_object($cron)) { $cron->remove(); } $cron = cron::byClassAndFunction('history', 'archive'); if (is_object($cron)) { $cron->remove(); } $user = new user(); $user->setLogin('jeedom_master'); $user->setPassword(config::genKey(255)); $user->setRights('admin', 1); $user->save(); config::save('jeeNetwork::mode', 'slave'); } break; } }