Пример #1
0
function fetchStats()
{
    global $dbAccess;
    require 'lib/log.php';
    $db = new mysqli($dbAccess['host'], $dbAccess['user'], $dbAccess['pass'], $dbAccess['db']);
    $log = new log($db);
    $data = $log->get();
    $min = array();
    $max = array();
    $midOver = 12;
    $dateOf = 6;
    $c = 0;
    $set = array();
    $setDate = false;
    $lastDate = false;
    foreach ($data as $item) {
        $min[] = array($item['ts'], $item['min']);
        $max[] = array($item['ts'], $item['max']);
    }
    return array($min, $max);
}
Пример #2
0
 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));
 }
 if (init('action') == 'getRestoreLog') {
     ajax::success(log::get('restore', 0, 3000));
 }
 if (init('action') == 'removeBackup') {
     jeedom::removeBackup(init('backup'));
     ajax::success();
 }
 if (init('action') == 'listBackup') {
     ajax::success(jeedom::listBackup());
 }
 if (init('action') == 'getConfiguration') {
     ajax::success(jeedom::getConfiguration(init('key'), init('default')));
 }
 if (init('action') == 'flushcache') {
     cache::flush();
     ajax::success();
 }
Пример #3
0
     }
     $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']));
 }
 /*             * ************************Messages*************************** */
 if ($jsonrpc->getMethod() == 'message::removeAll') {
     message::removeAll();
     $jsonrpc->makeSuccess('ok');
 }
Пример #4
0
    }
    if (init('action') == 'clear') {
        log::clear(init('logfile'));
        ajax::success();
    }
    if (init('action') == 'remove') {
        log::remove(init('logfile'));
        ajax::success();
    }
    if (init('action') == 'removeAll') {
        log::removeAll();
        ajax::success();
    }
    if (init('action') == 'get') {
        if (init('jeeNetwork_id') != '') {
            $jeeNetwork = jeeNetwork::byId(init('jeeNetwork_id'));
            if (is_object($jeeNetwork)) {
                $jeeNetwork->getLog(init('log'), init('start', 0), init('nbLine', 99999));
            }
        } else {
            ajax::success(log::get(init('logfile'), init('start', 0), init('nbLine', 99999)));
        }
    }
    if (init('action') == 'getNbLine') {
        ajax::success(log::nbLine(init('logfile')));
    }
    throw new Exception(__('Aucune methode correspondante à : ', __FILE__) . init('action'));
    /*     * *********Catch exeption*************** */
} catch (Exception $e) {
    ajax::error(displayExeption($e), $e->getCode());
}