本文整理汇总了PHP中jeedom::version方法的典型用法代码示例。如果您正苦于以下问题:PHP jeedom::version方法的具体用法?PHP jeedom::version怎么用?PHP jeedom::version使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jeedom
的用法示例。
在下文中一共展示了jeedom::version方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkAllUpdate
public static function checkAllUpdate($_filter = '', $_findNewObject = true)
{
$findCore = false;
$marketObject = array('logical_id' => array(), 'version' => array());
if ($_findNewObject) {
self::findNewUpdateObject();
}
$updates = self::all($_filter);
if (is_array($updates)) {
foreach (self::all($_filter) as $update) {
if ($update->getType() == 'core') {
if ($findCore) {
$update->remove();
continue;
}
$findCore = true;
$update->setType('core');
$update->setLogicalId('jeedom');
if (method_exists('jeedom', 'version')) {
$update->setLocalVersion(jeedom::version());
} else {
$update->setLocalVersion(getVersion('jeedom'));
}
$update->save();
$update->checkUpdate();
} else {
if ($update->getStatus() != 'hold') {
$marketObject['logical_id'][] = array('logicalId' => $update->getLogicalId(), 'type' => $update->getType());
$marketObject['version'][] = $update->getConfiguration('version', 'stable');
$marketObject[$update->getType() . $update->getLogicalId()] = $update;
}
}
}
}
if (!$findCore) {
$update = new update();
$update->setType('core');
$update->setLogicalId('jeedom');
if (method_exists('jeedom', 'version')) {
$update->setLocalVersion(jeedom::version());
} else {
$update->setLocalVersion(getVersion('jeedom'));
}
$update->save();
$update->checkUpdate();
}
$markets_infos = market::getInfo($marketObject['logical_id'], $marketObject['version']);
foreach ($markets_infos as $logicalId => $market_info) {
$update = $marketObject[$logicalId];
if (is_object($update)) {
$update->setStatus($market_info['status']);
$update->setConfiguration('market_owner', $market_info['market_owner']);
$update->setConfiguration('market', $market_info['market']);
$update->setRemoteVersion($market_info['datetime']);
$update->save();
}
}
config::save('update::lastCheck', date('Y-m-d H:i:s'));
}
示例2: dirname
*/
try {
require_once dirname(__FILE__) . '/../../core/php/core.inc.php';
include_file('core', 'authentification', 'php');
if (!isConnect()) {
throw new Exception(__('401 - Accès non autorisé', __FILE__));
}
if (init('action') == 'getConf') {
if (!isConnect('admin')) {
throw new Exception(__('401 - Accès non autorisé', __FILE__));
}
$plugin = plugin::byId(init('id'));
$return = utils::o2a($plugin);
$return['activate'] = $plugin->isActive();
$return['configurationPath'] = $plugin->getPathToConfigurationById();
$return['checkVersion'] = version_compare(jeedom::version(), $plugin->getRequire());
$return['status'] = market::getInfo(array('logicalId' => $plugin->getId(), 'type' => 'plugin'));
$return['update'] = utils::o2a(update::byLogicalId($plugin->getId()));
ajax::success($return);
}
if (init('action') == 'toggle') {
if (!isConnect('admin')) {
throw new Exception(__('401 - Accès non autorisé', __FILE__));
}
$plugin = plugin::byId(init('id'));
if (!is_object($plugin)) {
throw new Exception(__('Plugin introuvable : ', __FILE__) . init('id'));
}
$plugin->setIsEnable(init('state'));
ajax::success();
}
示例3: needUpdate
public static function needUpdate($_refresh = false)
{
$return = array();
$return['currentVersion'] = market::getJeedomCurrentVersion($_refresh);
$return['version'] = jeedom::version();
if (version_compare($return['currentVersion'], $return['version'], '>')) {
$return['needUpdate'] = true;
} else {
$return['needUpdate'] = false;
}
return $return;
}
示例4: setIsEnable
public function setIsEnable($_state)
{
if (version_compare(jeedom::version(), $this->getRequire()) == -1 && $_state == 1) {
throw new Exception('Votre version de jeedom n\'est pas assez récente pour activer ce plugin');
}
$alreadyActive = config::byKey('active', $this->getId(), 0);
if ($_state == 1) {
if (config::byKey('jeeNetwork::mode') != 'master' && $this->getAllowRemote() != 1) {
throw new Exception('Vous ne pouvez pas activer ce plugin sur un Jeedom configuré en esclave');
}
//market::checkPayment($this->getId());
config::save('active', $_state, $this->getId());
}
if ($_state == 0) {
$eqLogics = eqLogic::byType($this->getId());
if (is_array($eqLogics)) {
foreach ($eqLogics as $eqLogic) {
try {
$eqLogic->setConfiguration('previousIsEnable', $eqLogic->getIsEnable());
$eqLogic->setConfiguration('previousIsVisible', $eqLogic->getIsVisible());
$eqLogic->setIsEnable(0);
$eqLogic->setIsVisible(0);
$eqLogic->save();
} catch (Exception $e) {
}
}
}
$listeners = listener::byClass($this->getId());
if (is_array($listeners)) {
foreach ($listeners as $listener) {
$listener->remove();
}
}
}
if ($alreadyActive == 0 && $_state == 1) {
foreach (eqLogic::byType($this->getId()) as $eqLogic) {
try {
$eqLogic->setIsEnable($eqLogic->getConfiguration('previousIsEnable', 1));
$eqLogic->setIsVisible($eqLogic->getConfiguration('previousIsVisible', 1));
$eqLogic->save();
} catch (Exception $e) {
}
}
}
try {
if ($_state == 1) {
if ($alreadyActive == 1) {
$out = $this->callInstallFunction('update');
} else {
$out = $this->callInstallFunction('install');
}
} else {
if ($alreadyActive == 1) {
$out = $this->callInstallFunction('remove');
}
}
if (isset($out) && trim($out) != '') {
log::add($this->getId(), 'info', "Installation/remove/update result : " . $out);
}
} catch (Exception $e) {
config::save('active', $alreadyActive, $this->getId());
log::add('plugin', 'error', $e->getMessage());
throw $e;
}
if ($_state == 0) {
config::save('active', $_state, $this->getId());
}
return true;
}
示例5:
echo '<li class="cursor"><a id="bt_expertMode" state="0"><i class="fa fa-square-o"></i> {{Mode expert}}</a></li>';
}
if (jeedom::isCapable('sudo')) {
echo '<li class="cursor expertModeVisible"><a id="bt_rebootSystem" state="0"><i class="fa fa-repeat"></i> {{Redémarrer}}</a></li>';
echo '<li class="cursor expertModeVisible"><a id="bt_haltSystem" state="0"><i class="fa fa-power-off"></i> {{Eteindre}}</a></li>';
}
}
?>
<li class="expertModeVisible"><a href="#" id="bt_showEventInRealTime"><i class="fa fa-tachometer"></i> {{Temps réel}}</a></li>
<li><a href="index.php?v=m"><i class="fa fa-mobile"></i> {{Version mobile}}</a></li>
<li class="divider"></li>
<li><a href="index.php?v=d&logout=1"><i class="fa fa-sign-out"></i> {{Se déconnecter}}</a></li>
<li class="divider"></li>
<li><a href="#">{{Node JS}} <span class="span_nodeJsState binary red tooltips"></span></a></li>
<li><a href="#" id="bt_jeedomAbout">{{Version}} v<?php
echo jeedom::version();
?>
</a></li>
</ul>
</li>
<?php
if (network::ehtIsUp()) {
echo '<li><a href="#"><i class="fa fa-sitemap tooltips" title="{{Connecté en filaire}}"></i></a></li>';
}
if (network::wlanIsUp()) {
$signalStrength = network::signalStrength();
if ($signalStrength !== '' && $signalStrength >= 0) {
if ($signalStrength > 80) {
echo '<li><a href="#"><i class="jeedom2-fdp1-signal5 tooltips" title="{{Connecté en wifi. Signal : ' . $signalStrength . '%}}"></i></a></li>';
} else {
示例6: getJsonRpc
public static function getJsonRpc()
{
if (config::byKey('market::address') == '') {
throw new Exception(__('Aucune addresse n\'est renseignée pour le market', __FILE__));
}
if (config::byKey('market::username') != '' && config::byKey('market::password') != '') {
$params = array('username' => config::byKey('market::username'), 'password' => config::byKey('market::password'), 'password_type' => 'sha1', 'jeedomversion' => jeedom::version(), 'hwkey' => jeedom::getHardwareKey(), 'addrComplement' => config::byKey('externalComplement'), 'information' => array('nbMessage' => message::nbMessage(), 'hardware' => method_exists('jeedom', 'getHardwareName') ? jeedom::getHardwareName() : ''));
if (config::byKey('market::allowDNS') != 1) {
$params['addr'] = config::byKey('externalAddr');
$params['addrProtocol'] = config::byKey('externalProtocol');
$params['addrPort'] = config::byKey('externalPort');
}
$jsonrpc = new jsonrpcClient(config::byKey('market::address') . '/core/api/api.php', '', $params);
} else {
$jsonrpc = new jsonrpcClient(config::byKey('market::address') . '/core/api/api.php', '', array('jeedomversion' => jeedom::version(), 'hwkey' => jeedom::getHardwareKey()));
}
$jsonrpc->setCb_class('market');
$jsonrpc->setCb_function('postJsonRpc');
return $jsonrpc;
}
示例7: getVersion
function getVersion($_name)
{
return jeedom::version();
}
示例8: mkdir
}
if (!file_exists($uploaddir)) {
mkdir($uploaddir);
}
if (!file_exists($uploaddir)) {
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']));
}
示例9: array
$logLevel = array('info' => 0, 'debug' => 0, 'event' => 0, 'error' => 1);
if (init('mode') != 'force') {
echo "Jeedom est-il installé sur un Rasberry PI ? [o/N] ";
if (trim(fgets(STDIN)) === 'o') {
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)
{
示例10: Exception
* 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/>.
*/
if (!isConnect('admin')) {
throw new Exception('401 Unauthorized');
}
//if (config::byKey('enableLogging', 'arduidom', 0) == 0) {
// echo '<div class="alert alert-danger">{{Vous n\'avez pas activé l\'enregistrement de tous les messages : allez dans Générale -> Plugin puis rfxcom et coché la case correspondante}}</div>';
//}
if (arduidom::get_daemon_mode() != "OK") {
if (substr(jeedom::version(), 0, 1) == 2) {
event::add('jeedom::alert', array('level' => 'error', 'message' => __("Action Impossible : Le démon ne fonctionne pas !", __FILE__)));
}
}
?>
<pre id='pre_ardulog' style='overflow: auto; height: 95%;width:90%;'></pre>
<script>
getArduLog(1);
function getArduLog(_autoUpdate) {
$.ajax({
type: 'POST',
示例11: sendtoArduino
public static function sendtoArduino($_tcpmsg, $_AID)
{
$General_Debug = config::byKey('generalDebug', 'arduidom', 0, true);
if ($_AID == 0) {
$General_Debug = 0;
}
// Pas de log sur démon direct, trop bavard...
if ($General_Debug) {
log::add('arduidom', 'debug', "^--------------------------------------------------------------------------------------");
}
if ($General_Debug) {
log::add('arduidom', 'debug', 'sendtoArduino(' . $_tcpmsg . ',' . $_AID . ') called');
}
$func_start_time = getmicrotime(true);
$daemonmode = self::get_daemon_mode();
if ($daemonmode == "FLASHING") {
log::add("arduidom", "debug", "sendtoArduino impossible, arduino en cours de flashage...");
return "DAEMON_NOT_OK";
}
$port = config::byKey('A' . $_AID . '_port', 'arduidom', 'none', true);
$ip = config::byKey('A' . $_AID . '_daemonip', 'arduidom', '127.0.0.1', true);
if ($port != 'none' && $port != "" || $_AID == 0) {
if (file_exists($port) || $port == 'Network' || $_AID == 0) {
if ($port != 'Network') {
//if ($General_Debug) log::add('arduidom', 'debug', 'Le démon ' . $_AID . ' est un démon python');
if ($General_Debug) {
log::add('arduidom', 'debug', 'IP: ' . $ip . ":" . (58200 + intval($_AID)));
}
$fp = fsockopen($ip, 58200 + intval($_AID), $errno, $errstr, 10);
} else {
//if ($General_Debug) log::add('arduidom', 'debug', 'Le démon ' . $_AID . ' est un arduino Réseau (IP:' . $ip . ")");
if ($General_Debug) {
log::add('arduidom', 'debug', 'IP: ' . $ip . ":58174");
}
$fp = fsockopen($ip, 58174, $errno, $errstr, 1);
}
if (!$fp) {
if ($_AID == 0) {
log::add('arduidom', 'error', "Le démon " . $_AID . " n'est pas connecté ! (errstr:" . $errstr . ")");
if ($General_Debug) {
log::add('arduidom', 'debug', "v--------------------------------------------------------------------------------------");
}
} else {
log::add('arduidom', 'error', "L'Arduino " . $_AID . " n'est pas connecté ! (errstr:" . $errstr . ")");
if ($General_Debug) {
log::add('arduidom', 'debug', "v--------------------------------------------------------------------------------------");
}
}
return $errstr;
} else {
stream_set_timeout($fp, 10);
if ($_AID == 0) {
if ($General_Debug) {
log::add('arduidom', 'debug', "Le démon " . $_AID . " est connecté, envoi...");
}
} else {
if ($General_Debug) {
log::add('arduidom', 'debug', "L'Arduino " . $_AID . " est connecté, envoi...");
}
}
if ($port == "Network") {
$_tcpmsg = $_tcpmsg . "\n";
}
// ajout d'une fin de ligne pour shield ethernet
fwrite($fp, $_tcpmsg);
$start_time = time();
$resp = "";
if ($port == "Network") {
if ($General_Debug) {
log::add('arduidom', 'debug', "Attente de la réponse de l'arduino " . $_AID . " ...");
}
while (!feof($fp)) {
$resp = $resp . fgets($fp);
if (time() - $start_time > 10) {
// Time out de 10 secondes pour le check du démon
log::add('arduidom', 'error', "Erreur: TIMEOUT sur attente de réponse de l'arduino " . $_AID);
if (substr(jeedom::version(), 0, 1) == 2) {
event::add('jeedom::alert', array('level' => 'error', 'message' => __("Erreur: TIMEOUT sur attente de réponse de l'arduino " . $_AID, __FILE__)));
}
if ($General_Debug) {
log::add('arduidom', 'debug', "v--------------------------------------------------------------------------------------");
}
return "TIMEOUT";
}
}
$resp = str_replace("\r", '', $resp);
$resp = str_replace("\n", '', $resp);
if ($General_Debug) {
log::add('arduidom', 'debug', 'Réponse TCP recue = ' . $resp);
}
if (time() - $start_time > 10) {
// Time out de 10 secondes pour le check du démon
log::add('arduidom', 'error', "Erreur: TIMEOUT sur Réponse de l'arduino " . $_AID);
if (substr(jeedom::version(), 0, 1) == 2) {
event::add('jeedom::alert', array('level' => 'error', 'message' => __("Erreur: TIMEOUT sur Réponse de l'arduino " . $_AID, __FILE__)));
}
if ($General_Debug) {
log::add('arduidom', 'debug', "v--------------------------------------------------------------------------------------");
}
return "TIMEOUT";
//.........这里部分代码省略.........