本文整理汇总了PHP中jeedom::restore方法的典型用法代码示例。如果您正苦于以下问题:PHP jeedom::restore方法的具体用法?PHP jeedom::restore怎么用?PHP jeedom::restore使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jeedom
的用法示例。
在下文中一共展示了jeedom::restore方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
}
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));
}
if (init('action') == 'getRestoreLog') {
ajax::success(log::get('restore', 0, 3000));
}
示例2: Exception
throw new Exception('Repertoire de téléversement non trouvé : ' . $uploaddir);
}
$_file = $_FILES['file'];
$extension = strtolower(strrchr($_file['name'], '.'));
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']));
示例3: retoreBackup
public static function retoreBackup($_backup)
{
$url = config::byKey('market::address') . "/core/php/downloadBackup.php?backup=" . $_backup . '&hwkey=' . jeedom::getHardwareKey() . '&username=' . urlencode(config::byKey('market::username')) . '&password=' . config::byKey('market::password') . '&password_type=sha1';
$tmp_dir = dirname(__FILE__) . '/../../tmp';
$tmp = $tmp_dir . '/' . $_backup;
file_put_contents($tmp, fopen($url, 'r'));
if (!file_exists($tmp)) {
throw new Exception(__('Impossible de télécharger la sauvegarde : ', __FILE__) . $url . '.');
}
if (!file_exists(dirname(__FILE__) . '/../../backup/')) {
mkdir(dirname(__FILE__) . '/../../backup/');
}
$backup_path = dirname(__FILE__) . '/../../backup/' . $_backup;
if (!copy($tmp, $backup_path)) {
throw new Exception(__('Impossible de copier le fichier de : ', __FILE__) . $tmp . '.');
}
if (!file_exists($backup_path)) {
throw new Exception(__('Impossible de trouver le fichier : ', __FILE__) . $backup_path . '.');
}
jeedom::restore('backup/' . $_backup, true);
}
示例4: express
config::save('cronSleepTime', 60);
}
} else {
config::save('cronSleepTime', 60);
}
config::save('logLevel', $logLevel);
echo "OK\n";
echo 'Installation de socket.io et express (peut etre très long > 30min)';
echo shell_exec('cd ' . dirname(__FILE__) . '/../core/nodeJS;sudo npm install socket.io;npm install express');
echo "OK\n";
}
config::save('version', jeedom::version());
} catch (Exception $e) {
if ($update) {
if ($backup_ok && $update_begin) {
jeedom::restore();
}
jeedom::start();
}
echo __('Erreur durant l\'installation : ', __FILE__) . $e->getMessage();
echo __('Details : ', __FILE__) . print_r($e->getTrace());
echo "[END UPDATE ERROR]\n";
throw $e;
}
echo "[END UPDATE SUCCESS]\n";
function incrementVersion($_version)
{
$version = explode('.', $_version);
if ($version[2] < 500) {
$version[2]++;
} else {