if (!in_array($extension, array('.tar.gz', '.gz', '.tar'))) { throw new Exception('Extension du fichier non valide (autorisé .tar.gz, .tar et .gz) : ' . $extension); } if (filesize($_file['tmp_name']) > 50000000) { throw new Exception('La taille du fichier est trop importante (maximum 50Mo)'); } $bakcup_name = 'backup-' . jeedom::version() . '-' . date("d-m-Y-H\\hi") . '.tar.gz'; $uploadfile = $uploaddir . '/' . $bakcup_name; if (!move_uploaded_file($_file['tmp_name'], $uploadfile)) { throw new Exception('Impossible de téléverser le fichier'); } jeedom::restore($uploadfile, true); $jsonrpc->makeSuccess('ok'); } if ($jsonrpc->getMethod() == 'jeeNetwork::backup') { jeedom::backup(true); $jsonrpc->makeSuccess('ok'); } /* * ************************Log*************************** */ if ($jsonrpc->getMethod() == 'log::get') { $jsonrpc->makeSuccess(log::get($params['log'], $params['start'], $params['nbLine'])); } if ($jsonrpc->getMethod() == 'log::list') { $jsonrpc->makeSuccess(log::liste()); } if ($jsonrpc->getMethod() == 'log::empty') { $jsonrpc->makeSuccess(log::clear($params['log'])); } if ($jsonrpc->getMethod() == 'log::remove') { $jsonrpc->makeSuccess(log::remove($params['log'])); }
throw new Exception(__('401 - Accès non autorisé', __FILE__), -1234); } if (init('action') == 'ssh') { ajax::success(shell_exec(init('command'))); } if (init('action') == 'update') { jeedom::update(); ajax::success(); } if (init('action') == 'clearDate') { $cache = cache::byKey('jeedom::lastDate'); $cache->remove(); ajax::success(); } if (init('action') == 'backup') { jeedom::backup(true, init('noCloudUpload')); ajax::success(); } if (init('action') == 'restore') { jeedom::restore(init('backup'), true); ajax::success(); } if (init('action') == 'restoreCloud') { market::retoreBackup(init('backup')); ajax::success(); } if (init('action') == 'getUpdateLog') { ajax::success(log::get('update', 0, 3000)); } if (init('action') == 'getBackupLog') { ajax::success(log::get('backup', 0, 3000));
} try { echo __("Mise à plat des droits...", __FILE__); jeedom::cleanFileSytemRight(); echo __("OK\n", __FILE__); } catch (Exception $e) { echo __('***ERREUR*** ', __FILE__) . $e->getMessage(); } if (init('level', -1) < 1) { if (config::byKey('update::backupBefore') == 1 && init('mode') != 'force') { try { global $NO_PLUGIN_BAKCUP; $NO_PLUGIN_BAKCUP = true; global $NO_CLOUD_BAKCUP; $NO_CLOUD_BAKCUP = true; jeedom::backup(); } catch (Exception $e) { if (init('mode') != 'force') { throw $e; } else { echo __('***ERREUR*** ', __FILE__) . $e->getMessage(); } } $backup_ok = true; } if (init('mode') == 'force') { echo __("/!\\ Mise à jour en mode forcé /!\\ \n", __FILE__); } jeedom::stop(); if (init('version') == '') { try {