当前位置: 首页>>代码示例>>PHP>>正文


PHP config::save方法代码示例

本文整理汇总了PHP中config::save方法的典型用法代码示例。如果您正苦于以下问题:PHP config::save方法的具体用法?PHP config::save怎么用?PHP config::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在config的用法示例。


在下文中一共展示了config::save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: openzwave_update

function openzwave_update()
{
    if (openzwave::deamonRunning()) {
        echo 'Stop zwave network...';
        openzwave::stopDeamon();
        echo "OK\n";
    }
    echo 'Stop cron...';
    $cron = cron::byClassAndFunction('openzwave', 'pull');
    if (config::byKey('jeeNetwork::mode') != 'slave') {
        if (!is_object($cron)) {
            $cron = new cron();
        }
        $cron->setClass('openzwave');
        $cron->setFunction('pull');
        $cron->setEnable(1);
        $cron->setDeamon(1);
        $cron->setDeamonSleepTime(0.5);
        $cron->setTimeout(1440);
        $cron->setSchedule('* * * * *');
        $cron->save();
        $cron->stop();
    } else {
        if (is_object($cron)) {
            $cron->remove();
        }
    }
    echo "OK\n";
    echo 'Check zwave system...';
    if (count(eqLogic::byType('zwave')) > 0) {
        log::add('openzwave', 'error', 'Attention vous etes sur la nouvelle version d\'openzwave, des actions de votre part sont necessaire merci d\'aller voir https://jeedom.fr/blog/?p=1576');
    }
    if (config::byKey('port', 'openzwave', 'none') != 'none') {
        if (method_exists('openzwave', 'getVersion')) {
            if (version_compare(config::byKey('openzwave_version', 'openzwave'), openzwave::getVersion('openzwave'), '>')) {
                if (jeedom::getHardwareName() == 'Jeedomboard') {
                    config::save('allowStartDeamon', 0, 'openzwave');
                    openzwave::updateOpenzwave(false);
                    config::save('allowStartDeamon', 1, 'openzwave');
                } else {
                    log::add('openzwave', 'error', __('Attention votre version d\'openzwave est dépassée sur le démon local, il faut ABSOLUMENT la mettre à jour', __FILE__));
                }
            }
        }
    }
    if (config::byKey('jeeNetwork::mode') == 'master') {
        foreach (jeeNetwork::byPlugin('openzwave') as $jeeNetwork) {
            try {
                if ($jeeNetwork->configByKey('port', 'openzwave', 'none') != 'none') {
                    if (version_compare($jeeNetwork->sendRawRequest('getVersion', array('plugin' => 'openzwave', 'module' => 'openzwave')), openzwave::getVersion('openzwave'), '>')) {
                        log::add('openzwave', 'error', __('Attention votre version d\'openzwave est dépassée sur', __FILE__) . ' ' . $jeeNetwork->getName() . ' ' . __('il faut ABSOLUMENT la mettre à jour', __FILE__));
                    }
                }
            } catch (Exception $e) {
            }
        }
    }
    echo "OK\n";
}
开发者ID:stef3569,项目名称:plugin-openzwave,代码行数:59,代码来源:install.php

示例2: openzwave_update

function openzwave_update()
{
    log::add('openzwave', 'error', __('Après toute installation/mise à jour pensez bien à mettre à jour les dépendances Openzwave (voir documentation)', __FILE__));
    if (!file_exists(dirname(__FILE__) . '/../data')) {
        mkdir(dirname(__FILE__) . '/../data');
    }
    shell_exec('cp -R /opt/python-openzwave/xml_backups ' . dirname(__FILE__) . '/../data');
    shell_exec('cp -R /opt/python-openzwave/zwcfg_*.xml ' . dirname(__FILE__) . '/../data');
    shell_exec('rm -rf /opt/python-openzwave/xml_backups');
    shell_exec('rm -rf /opt/python-openzwave/zwcfg_*.xml');
    config::save('allowStartDeamon', 0, 'openzwave');
    echo 'Stop zwave network...';
    openzwave::stop();
    openzwave::stopDeamon();
    echo "OK\n";
    echo 'Stop cron...';
    $cron = cron::byClassAndFunction('openzwave', 'pull');
    if (is_object($cron)) {
        $cron->remove();
    }
    echo "OK\n";
    echo 'Check zwave system...';
    if (count(eqLogic::byType('zwave')) > 0) {
        log::add('openzwave', 'error', 'Attention vous etes sur la nouvelle version d\'openzwave, des actions de votre part sont necessaire merci d\'aller voir https://jeedom.fr/blog/?p=1576');
    }
    if (config::byKey('port', 'openzwave', 'none') != 'none') {
        if (method_exists('openzwave', 'getVersion')) {
            if (version_compare(config::byKey('openzwave_version', 'openzwave'), openzwave::getVersion('openzwave'), '>')) {
                if (jeedom::getHardwareName() == 'Jeedomboard') {
                    openzwave::updateOpenzwave(false);
                } else {
                    log::add('openzwave', 'error', __('Attention votre version d\'openzwave est dépassée sur le démon local, il faut ABSOLUMENT la mettre à jour', __FILE__));
                }
            }
        }
    }
    if (config::byKey('jeeNetwork::mode') == 'master') {
        foreach (jeeNetwork::byPlugin('openzwave') as $jeeNetwork) {
            try {
                if ($jeeNetwork->configByKey('port', 'openzwave', 'none') != 'none') {
                    if (version_compare($jeeNetwork->sendRawRequest('getVersion', array('plugin' => 'openzwave', 'module' => 'openzwave')), openzwave::getVersion('openzwave'), '>')) {
                        log::add('openzwave', 'error', __('Attention votre version d\'openzwave est dépassée sur', __FILE__) . ' ' . $jeeNetwork->getName() . ' ' . __('il faut ABSOLUMENT la mettre à jour', __FILE__));
                    }
                }
            } catch (Exception $e) {
            }
        }
    }
    echo "OK\n";
    echo 'Redemarrage zwave network...';
    try {
        config::save('allowStartDeamon', 1, 'openzwave');
        openzwave::runDeamon();
    } catch (Exception $e) {
    }
    echo "OK\n";
}
开发者ID:kaneda-fr,项目名称:plugin-openzwave,代码行数:57,代码来源:install.php

示例3: install

function install()
{
    $cron = cron::byId(config::byKey('xPLDeamonCronId', 'xPL'));
    if (!is_object($cron)) {
        $cron = new cron();
    }
    $cron->setClass('xpl');
    $cron->setFunction('deamon');
    $cron->setEnable(1);
    $cron->setDeamon(1);
    $cron->setSchedule('* * * * *');
    $cron->save();
    config::save('xPLDeamonCronId', $cron->getId(), 'xPL');
}
开发者ID:Wators,项目名称:jeedom_plugins,代码行数:14,代码来源:install.php

示例4: listing

 function listing()
 {
     if (!$this->haveAccessTo('view')) {
         return $this->showAccessDenied();
     }
     $nType = func::GET('type', false, true);
     $sQuery = '';
     switch ($nType) {
         case CONTACTS_TYPE_CONTACT:
             $sQuery = 'SELECT C.*, U.login as ulogin, U.name as uname, U.blocked as ublocked, U.admin as uadmin
                     FROM ' . TABLE_CONTACTS . ' C
                         LEFT JOIN ' . TABLE_USERS . ' U ON C.user_id=U.user_id
                     WHERE C.ctype=' . $nType;
             break;
     }
     $this->generatePagenationPrevNext($sQuery . ' ORDER BY C.created DESC', $aData, 'contacts', 15);
     $this->db->execute('UPDATE ' . TABLE_CONTACTS . ' SET viewed = 1 WHERE viewed = 0');
     config::save('contacts_new', 0);
     $aData['type'] = $nType;
     $this->tplAssignByRef('aData', $aData);
     return $this->tplFetch('admin.listing.tpl');
 }
开发者ID:Sywooch,项目名称:dobox,代码行数:22,代码来源:contacts.adm.class.php

示例5: arduidom_update

function arduidom_update()
{
    arduidom::stopdaemon();
    $MigrationCheck = config::byKey('db_version', 'arduidom', 0);
    if ($MigrationCheck < 108) {
        arduidom::MigrateDatas();
        arduidom::start();
    }
    if ($MigrationCheck < 145) {
        arduidom::stopdaemon();
        $daemon_path = realpath(dirname(__FILE__) . '/../../ressources');
        log::add('arduidom', 'info', "Suppression de arduidom1.py devenu inutile => " . unlink($daemon_path . "/arduidom1.py"));
        log::add('arduidom', 'info', "Suppression de arduidom2.py devenu inutile => " . unlink($daemon_path . "/arduidom2.py"));
        log::add('arduidom', 'info', "Suppression de arduidom3.py devenu inutile => " . unlink($daemon_path . "/arduidom3.py"));
        log::add('arduidom', 'info', "Suppression de arduidom4.py devenu inutile => " . unlink($daemon_path . "/arduidom4.py"));
        log::add('arduidom', 'info', "Suppression de arduidom5.py devenu inutile => " . unlink($daemon_path . "/arduidom5.py"));
        log::add('arduidom', 'info', "Suppression de arduidom6.py devenu inutile => " . unlink($daemon_path . "/arduidom6.py"));
        log::add('arduidom', 'info', "Suppression de arduidom7.py devenu inutile => " . unlink($daemon_path . "/arduidom7.py"));
        log::add('arduidom', 'info', "Suppression de arduidom8.py devenu inutile => " . unlink($daemon_path . "/arduidom8.py"));
        config::save('db_version', 145, 'arduidom');
        // Inscrit la version de migration dans la config
        arduidom::start();
    }
    arduidom::startdaemon();
    $cron = cron::byClassAndFunction('arduidom', 'checkdaemon');
    if (!is_object($cron)) {
        $cron = new cron();
        $cron->setClass('arduidom');
        $cron->setFunction('checkdaemon');
        $cron->setEnable(1);
        $cron->setDeamon(0);
        $cron->setSchedule('* * * * *');
        $cron->save();
    }
    $cron->stop();
    @exec("sudo usermod -G dialout www-data");
}
开发者ID:cedric222,项目名称:arduidom,代码行数:37,代码来源:install.php

示例6: zwave_update

function zwave_update()
{
    $cron = cron::byClassAndFunction('zwave', 'pull');
    if (config::byKey('jeeNetwork::mode') != 'slave') {
        if (!is_object($cron)) {
            $cron = new cron();
        }
        $cron->setClass('zwave');
        $cron->setFunction('pull');
        $cron->setEnable(1);
        $cron->setDeamon(1);
        $cron->setTimeout(1440);
        $cron->setSchedule('* * * * *');
        $cron->save();
        $cron->stop();
    } else {
        if (is_object($cron)) {
            $cron->remove();
        }
    }
    foreach (zwave::byType('zwave') as $zwave) {
        if ($zwave->getConfiguration('serverID') == '') {
            $zwave->setConfiguration('serverID', 1);
        }
        $zwave->save();
    }
    config::save('zwaveAddr1', config::byKey('zwaveAddr1', 'zwave', config::byKey('zwaveAddr', 'zwave')), 'zwave');
    config::save('zwavePort1', config::byKey('zwavePort1', 'zwave', config::byKey('zwavePort', 'zwave')), 'zwave');
    config::save('isOpenZwave1', config::byKey('isOpenZwave1', 'zwave', config::byKey('isOpenZwave', 'zwave')), 'zwave');
    if (method_exists('zwave', 'listServerZway')) {
        foreach (zwave::listServerZway() as $serverID => $server) {
            if (config::byKey('lastNotificationCheck' . $serverID, 'zwave', 0) == 0) {
                config::save('lastNotificationCheck' . $serverID, strtotime('now'), 'zwave');
            }
        }
    }
}
开发者ID:ksoul78,项目名称:plugin-zwave,代码行数:37,代码来源:install.php

示例7: runDeamon

 public static function runDeamon()
 {
     log::add('rfxcom', 'info', 'Lancement du démon RFXcom');
     $port = config::byKey('port', 'rfxcom');
     if (!file_exists($port)) {
         config::save('port', '', 'rfxcom');
         throw new Exception('Le port : ' . $port . ' n\'éxiste pas');
     }
     $rfxcom_path = realpath(dirname(__FILE__) . '/../../ressources/rfxcmd');
     $trigger = file_get_contents($rfxcom_path . '/trigger_tmpl.xml');
     $config = file_get_contents($rfxcom_path . '/config_tmpl.xml');
     $pid_file = realpath(dirname(__FILE__) . '/../../../../tmp') . '/rfxcom.pid';
     if (file_exists($rfxcom_path . '/trigger.xml')) {
         unlink($rfxcom_path . '/trigger.xml');
     }
     if (file_exists($rfxcom_path . '/config.xml')) {
         unlink($rfxcom_path . '/config.xml');
     }
     file_put_contents($rfxcom_path . '/trigger.xml', str_replace('#path#', $rfxcom_path . '/../../core/php/jeeRfxcom.php', $trigger));
     $config = str_replace('#log_path#', log::getPathToLog('rfxcmd'), str_replace('#trigger_path#', $rfxcom_path . '/trigger.xml', $config));
     file_put_contents($rfxcom_path . '/config.xml', $config);
     chmod($rfxcom_path . '/trigger.xml', 0777);
     chmod($rfxcom_path . '/config.xml', 0777);
     $cmd = '/usr/bin/python ' . $rfxcom_path . '/rfxcmd.py -z -d ' . $port;
     $cmd .= ' -o ' . $rfxcom_path . '/config.xml --pidfile=' . $pid_file;
     log::add('rfxcmd', 'info', 'Lancement démon rfxcmd : ' . $cmd);
     $result = exec('nohup ' . $cmd . ' >> ' . log::getPathToLog('rfxcmd') . ' 2>&1 &');
     if (strpos(strtolower($result), 'error') !== false || strpos(strtolower($result), 'traceback') !== false) {
         log::add('rfxcom', 'error', $result);
         return false;
     }
     if (!self::deamonRunning()) {
         sleep(10);
         if (!self::deamonRunning()) {
             log::add('rfxcom', 'info', 'Impossible de lancer le démon RFXcom');
             return false;
         }
     }
     log::add('rfxcom', 'info', 'Démon RFXcom lancé');
 }
开发者ID:Wators,项目名称:jeedom_plugins,代码行数:40,代码来源:rfxcom.class.php

示例8: archive

    /**
     * Archive les données de history dans historyArch
     */
    public static function archive()
    {
        $sql = 'DELETE FROM history WHERE `datetime` <= "2000-01-01 01:00:00" OR  `datetime` >= "2020-01-01 01:00:00"';
        DB::Prepare($sql, array());
        $sql = 'DELETE FROM historyArch WHERE `datetime` <= "2000-01-01 01:00:00" OR  `datetime` >= "2020-01-01 01:00:00"';
        DB::Prepare($sql, array());
        $sql = 'DELETE FROM history WHERE `value` IS NULL';
        DB::Prepare($sql, array());
        $sql = 'DELETE FROM historyArch WHERE `value` IS NULL';
        DB::Prepare($sql, array());
        if (config::byKey('historyArchivePackage') >= config::byKey('historyArchiveTime')) {
            config::save('historyArchivePackage', config::byKey('historyArchiveTime') - 1);
        }
        if (config::byKey('historyArchiveTime') < 1) {
            $archiveDatetime = date('Y-m-d H:i:s', strtotime('- 1 hours'));
        } else {
            $archiveDatetime = date('Y-m-d H:i:s', strtotime('- ' . config::byKey('historyArchiveTime', 'core', 1) . ' hours'));
        }
        if (config::byKey('historyArchivePackage') < 1) {
            $archivePackage = '00:' . config::byKey('historyArchivePackage') * 60 . ':00';
        } else {
            $archivePackage = config::byKey('historyArchivePackage') . ':00:00';
            if (strlen($archivePackage) < 8) {
                $archivePackage = '0' . $archivePackage;
            }
        }
        $values = array('archiveDatetime' => $archiveDatetime);
        $sql = 'SELECT DISTINCT(cmd_id)
		FROM history
		WHERE `datetime`<:archiveDatetime';
        $list_sensors = DB::Prepare($sql, $values, DB::FETCH_TYPE_ALL);
        foreach ($list_sensors as $sensors) {
            $cmd = cmd::byId($sensors['cmd_id']);
            if (is_object($cmd) && $cmd->getType() == 'info' && $cmd->getIsHistorized() == 1) {
                if ($cmd->getConfiguration('historyPurge', '') != '') {
                    $purgeTime = date('Y-m-d H:i:s', strtotime($cmd->getConfiguration('historyPurge', '')));
                    $values = array('cmd_id' => $cmd->getId(), 'datetime' => $purgeTime);
                    $sql = 'DELETE FROM historyArch WHERE cmd_id=:cmd_id AND `datetime` < :datetime';
                    DB::Prepare($sql, $values, DB::FETCH_TYPE_ROW);
                }
                if ($cmd->getSubType() == 'binary' || $cmd->getConfiguration('historizeMode', 'avg') == 'none') {
                    $values = array('cmd_id' => $cmd->getId());
                    $sql = 'SELECT ' . DB::buildField(__CLASS__) . '
					FROM history
					WHERE cmd_id=:cmd_id ORDER BY `datetime` ASC';
                    $history = DB::Prepare($sql, $values, DB::FETCH_TYPE_ALL, PDO::FETCH_CLASS, __CLASS__);
                    for ($i = 1; $i < count($history); $i++) {
                        if ($history[$i]->getValue() != $history[$i - 1]->getValue()) {
                            $history[$i]->setTableName('historyArch');
                            $history[$i]->save();
                            $history[$i]->setTableName('history');
                        }
                        $history[$i]->remove();
                    }
                    $history[0]->setTableName('historyArch');
                    $history[0]->save();
                    $history[0]->setTableName('history');
                    $history[0]->remove();
                    $values = array('cmd_id' => $cmd->getId());
                    $sql = 'SELECT ' . DB::buildField(__CLASS__) . '
					FROM historyArch
					WHERE cmd_id=:cmd_id ORDER BY datetime ASC';
                    $history = DB::Prepare($sql, $values, DB::FETCH_TYPE_ALL, PDO::FETCH_CLASS, __CLASS__);
                    for ($i = 1; $i < count($history); $i++) {
                        if ($history[$i]->getValue() == $history[$i - 1]->getValue()) {
                            $history[$i]->setTableName('historyArch');
                            $history[$i]->remove();
                        }
                    }
                } else {
                    $values = array('cmd_id' => $sensors['cmd_id'], 'archiveDatetime' => $archiveDatetime);
                    $sql = 'SELECT MIN(`datetime`) as oldest
					FROM history
					WHERE `datetime`<:archiveDatetime
					AND cmd_id=:cmd_id';
                    $oldest = DB::Prepare($sql, $values, DB::FETCH_TYPE_ROW);
                    $mode = $cmd->getConfiguration('historizeMode', 'avg');
                    while ($oldest['oldest'] != null) {
                        $values = array('cmd_id' => $sensors['cmd_id'], 'oldest' => $oldest['oldest'], 'archivePackage' => $archivePackage);
                        $sql = 'SELECT ' . $mode . '(value) as value,
						FROM_UNIXTIME(AVG(UNIX_TIMESTAMP(`datetime`))) as datetime
						FROM history
						WHERE TIMEDIFF(`datetime`,:oldest)<:archivePackage
						AND cmd_id=:cmd_id';
                        $avg = DB::Prepare($sql, $values, DB::FETCH_TYPE_ROW);
                        $history = new self();
                        $history->setCmd_id($sensors['cmd_id']);
                        $history->setValue($avg['value']);
                        $history->setDatetime($avg['datetime']);
                        $history->setTableName('historyArch');
                        $history->save();
                        $values = array('cmd_id' => $sensors['cmd_id'], 'oldest' => $oldest['oldest'], 'archivePackage' => $archivePackage);
                        $sql = 'DELETE FROM history
						WHERE TIMEDIFF(`datetime`,:oldest)<:archivePackage
						AND cmd_id=:cmd_id';
                        DB::Prepare($sql, $values, DB::FETCH_TYPE_ROW);
                        $values = array('cmd_id' => $sensors['cmd_id'], 'archiveDatetime' => $archiveDatetime);
//.........这里部分代码省略.........
开发者ID:GaelGRIFFON,项目名称:core,代码行数:101,代码来源:history.class.php

示例9: getVersion

 public static function getVersion($_module = 'openzwave')
 {
     if ($_module == 'openzwave') {
         try {
             $network = self::callOpenzwave('/ZWaveAPI/Run/network.GetStatus()', 0, 2000);
             if (isset($network['OpenZwaveLibraryVersion'])) {
                 config::save('currentOzwVersion', $network['OpenZwaveLibraryVersion'], 'openzwave');
             }
         } catch (Exception $e) {
         }
         return config::byKey('currentOzwVersion', 'openzwave', -1);
     }
 }
开发者ID:sfrias,项目名称:plugin-openzwave,代码行数:13,代码来源:openzwave.class.php

示例10: config

<?php

require '../class.config.php';
$config = new config('test.php');
var_dump($config->get());
$config->save();
$config->save('test.xml');
开发者ID:roelandbosch,项目名称:config,代码行数:7,代码来源:index.php

示例11: cronHourly

 public static function cronHourly()
 {
     if (config::byKey('noAlertOnNotification', 'zwave', 0) == 1) {
         return;
     }
     foreach (self::listServerZway() as $serverID => $server) {
         if (!isset($server['name'])) {
             continue;
         }
         $notifications = self::showNotification($serverID);
         if (is_array($notifications) && isset($notifications['data']) && isset($notifications['data']['notifications'])) {
             $notifications = array_reverse($notifications['data']['notifications']);
             $lastCheck = config::byKey('lastNotificationCheck' . $serverID, 'zwave', strtotime('now'));
             foreach ($notifications as $notification) {
                 $timestamp = strtotime($notification['timestamp']);
                 if ($timestamp > $lastCheck) {
                     log::add('zwave', 'error', __('Notification sur ', __FILE__) . $server['name'] . __(' le ', __FILE__) . date('Y-m-d H:i:s', $timestamp) . __(' type ', __FILE__) . $notification['type'] . __(' de niveau ', __FILE__) . $notification['level'] . '  : ' . $notification['message']);
                 }
             }
             config::save('lastNotificationCheck' . $serverID, strtotime('now'), 'zwave');
         }
     }
 }
开发者ID:ksoul78,项目名称:plugin-zwave,代码行数:23,代码来源:zwave.class.php

示例12: build

    /**
     * Generates the code to build a module
     * @static function
     * @param string $name module name
     * @param string $title module title
     */
    public static function build($name, $title)
    {
        $reservedKeywords = array('__halt_compiler', 'abstract', 'and', 'array', 'as', 'break', 'callable', 'case', 'catch', 'class', 'clone', 'const', 'continue', 'declare', 'default', 'die', 'do', 'echo', 'else', 'elseif', 'empty', 'enddeclare', 'endfor', 'endforeach', 'endif', 'endswitch', 'endwhile', 'eval', 'exit', 'extends', 'final', 'for', 'foreach', 'function', 'global', 'goto', 'if', 'implements', 'include', 'include_once', 'instanceof', 'insteadof', 'interface', 'isset', 'list', 'namespace', 'new', 'or', 'print', 'private', 'protected', 'public', 'require', 'require_once', 'return', 'static', 'switch', 'throw', 'trait', 'try', 'unset', 'use', 'var', 'while', 'xor');
        if (!is_dir('modules/' . $name) && !is_numeric($name) && !in_array($name, $reservedKeywords)) {
            $name = preg_replace('@[^a-zA-Z0-9]@', '', $name);
            $licence = str_replace('{{module}}', $name, file_get_contents("modules/admin/licence.txt"));
            tools::createDirectory('modules/' . $name);
            $template = '<?php
' . $licence . '

namespace ' . $name . ';

/**
 * @title ' . str_replace('\'', '\\\'', $title) . '
 * @description ' . str_replace('\'', '\\\'', $title) . '
 * @copyright 1
 * @browsers all
 * @php_version_min 5.3
 */

class module extends \\module {
	protected $name = \'' . str_replace('\'', '\\\'', $name) . '\';
}
?>';
            file_put_contents('modules/' . $name . '/module.php', $template);
            include 'modules/' . $name . '/module.php';
            $name2 = $name . '\\module';
            $mod = new $name2($name);
            $page = new \page(1, $name);
            $page->setModule($name);
            $page->setTitle('Index ' . $name);
            $page->setRegex('@^index$@');
            /* Set rights forbidden for non admins, admins are allowed by default */
            foreach (\app::getModule('core')->getEntity('role') as $role) {
                if ($role->permissions == 0) {
                    $mod->setRights($role->id_role, 0);
                    $page->setRights($role->id_role, 0);
                }
            }
            $mod->addPage($page);
            $mod->save();
            $config = new \config('profiles/' . PROFILE . '/config.php', TRUE);
            $config->add('$config[\'modules\'][\'' . $name . '\']', '7');
            return $config->save();
        } else {
            return FALSE;
        }
    }
开发者ID:saitinet,项目名称:parsimony,代码行数:54,代码来源:module.php

示例13: pull

 public static function pull()
 {
     try {
         $request_http = new com_http(config::byKey('superviseurIP', 'ewattch') . '/log.json?mode=1');
         $result = json_decode(trim(trim($request_http->exec(1, 1)), ','), true);
         if (config::byKey('numberFailed', 'ewattch', 0) > 0) {
             config::save('numberFailed', 0, 'ewattch');
         }
     } catch (Exception $e) {
         if (config::byKey('numberFailed', 'ewattch', 0) > 3) {
             log::add('ewattch', 'error', __('Erreur sur synchro ewattch ', __FILE__) . '(' . config::byKey('numberFailed', 'ewattch', 0) . ')' . $e->getMessage());
         } else {
             config::save('numberFailed', config::byKey('numberFailed', 'ewattch', 0) + 1, 'ewattch');
         }
         return;
     }
     print_r($result);
     if (isset($result[1][0])) {
         foreach ($result[1][0] as $resource) {
             $name = $resource[0];
             $eqLogic = self::byLogicalId('electricity_' . $name, 'ewattch');
             if (!is_object($eqLogic)) {
                 continue;
             }
             $index = $eqLogic->getCmd(null, 'index');
             if (is_object($index)) {
                 $value = $resource[7] + $index->getConfiguration('previous', 0);
                 $index->event($value);
                 if ($index->getConfiguration('lastPrevious') == '') {
                     $index->setConfiguration('previous', 0);
                     $index->setConfiguration('lastPrevious', date('Y-m-d'));
                     $index->save();
                 }
                 if ($index->getConfiguration('lastPrevious', date('Y-m-d')) != date('Y-m-d')) {
                     $index->setConfiguration('previous', $value);
                     $index->setConfiguration('lastPrevious', date('Y-m-d'));
                     $index->save();
                 }
             }
             $cost = $eqLogic->getCmd(null, 'cost');
             if (is_object($cost)) {
                 $value = $resource[6] + $index->getConfiguration('previous', 0);
                 $cost->event($value);
                 if ($cost->getConfiguration('lastPrevious') == '') {
                     $cost->setConfiguration('previous', 0);
                     $cost->setConfiguration('lastPrevious', date('Y-m-d'));
                     $cost->save();
                 }
                 if ($cost->getConfiguration('lastPrevious', date('Y-m-d')) != date('Y-m-d')) {
                     $cost->setConfiguration('previous', $value);
                     $cost->setConfiguration('lastPrevious', date('Y-m-d'));
                     $cost->save();
                 }
             }
         }
     }
     if (isset($result[1][1])) {
         foreach ($result[1][1] as $resource) {
             $name = $resource[0];
             $eqLogic = self::byLogicalId('water_' . $name, 'ewattch');
             if (!is_object($eqLogic)) {
                 continue;
             }
             $index = $eqLogic->getCmd(null, 'index');
             if (is_object($index)) {
                 $value = $resource[7] + $index->getConfiguration('previous', 0);
                 $index->event($value);
                 if ($index->getConfiguration('lastPrevious') == '') {
                     $index->setConfiguration('previous', 0);
                     $index->setConfiguration('lastPrevious', date('Y-m-d'));
                     $index->save();
                 }
                 if ($index->getConfiguration('lastPrevious', date('Y-m-d')) != date('Y-m-d')) {
                     $index->setConfiguration('previous', $value);
                     $index->setConfiguration('lastPrevious', date('Y-m-d'));
                     $index->save();
                 }
             }
             $cost = $eqLogic->getCmd(null, 'cost');
             if (is_object($cost)) {
                 $value = $resource[6] + $index->getConfiguration('previous', 0);
                 $cost->event($value);
                 if ($cost->getConfiguration('lastPrevious') == '') {
                     $cost->setConfiguration('previous', 0);
                     $cost->setConfiguration('lastPrevious', date('Y-m-d'));
                     $cost->save();
                 }
                 if ($cost->getConfiguration('lastPrevious', date('Y-m-d')) != date('Y-m-d')) {
                     $cost->setConfiguration('previous', $value);
                     $cost->setConfiguration('lastPrevious', date('Y-m-d'));
                     $cost->save();
                 }
             }
         }
     }
     try {
         $request_http = new com_http(config::byKey('superviseurIP', 'ewattch') . '/log.json?mode=10');
         $result = json_decode(trim(trim($request_http->exec(1, 1)), ','), true);
         if (config::byKey('numberFailed', 'ewattch', 0) > 0) {
             config::save('numberFailed', 0, 'ewattch');
//.........这里部分代码省略.........
开发者ID:jooooooon,项目名称:plugin-ewattch,代码行数:101,代码来源:ewattch.class.php

示例14: getHardwareName

 public static function getHardwareName()
 {
     if (config::byKey('hardware_name') != '') {
         return config::byKey('hardware_name');
     }
     $result = 'DIY';
     $uname = shell_exec('uname -a');
     if (strpos($uname, 'cubox') !== false) {
         $result = 'Jeedomboard';
     } else {
         if (file_exists('/.dockerinit')) {
             $result = 'Docker';
         } else {
             if (file_exists('/usr/bin/raspi-config')) {
                 $result = 'RPI/RPI2';
             }
         }
     }
     config::save('hardware_name', $result);
     return config::byKey('hardware_name');
 }
开发者ID:GaelGRIFFON,项目名称:core,代码行数:21,代码来源:jeedom.class.php

示例15: action

    connection::failed();
    echo 'Clef API non valide, vous n\'etes pas autorisé à effectuer cette action (jeeZwave)';
    die;
}
if (isset($_GET['test'])) {
    echo 'OK';
    die;
}
if (isset($_GET['stopOpenzwave'])) {
    config::save('allowStartDeamon', 0, 'openzwave');
    openzwave::stopDeamon();
    die;
}
if (isset($_GET['startOpenzwave'])) {
    log::add('openzwave', 'debug', 'Restart Zwave deamon');
    config::save('allowStartDeamon', 1, 'openzwave');
    openzwave::runDeamon();
    openzwave::getVersion();
    die;
}
$results = json_decode(file_get_contents("php://input"), true);
if (!is_array($results)) {
    die;
}
if (isset($results['device'])) {
    foreach ($results['device'] as $node_id => $datas) {
        $eqLogic = openzwave::getEqLogicByLogicalIdAndServerId($node_id, $results['serverId']);
        if (is_object($eqLogic)) {
            if (strpos($eqLogic->getConfiguration('fileconf'), 'fibaro.fgs221.fil.pilote') !== false) {
                foreach ($eqLogic->getCmd('info', '0&&1.0x0', null, true) as $cmd) {
                    if ($cmd->getConfiguration('value') == 'pilotWire') {
开发者ID:sfrias,项目名称:plugin-openzwave,代码行数:31,代码来源:jeeZwave.php


注:本文中的config::save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。