本文整理汇总了PHP中OCP\Config::setAppValue方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::setAppValue方法的具体用法?PHP Config::setAppValue怎么用?PHP Config::setAppValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OCP\Config
的用法示例。
在下文中一共展示了Config::setAppValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: enableBackend
/**
* @NoAdminRequired
* @NoCSRFRequired
*/
public function enableBackend()
{
$response = new JSONResponse();
$params = $this->request->urlParams;
$backend = $params['backend'];
$enable = $params['enable'];
return $response->setData(\OCP\Config::setAppValue('contacts', 'backend_' . $backend, $enable));
}
示例2: testSetAppValueIfSetToNull
public function testSetAppValueIfSetToNull()
{
$key = $this->getUniqueID('key-');
$result = \OCP\Config::setAppValue('unit-test', $key, null);
$this->assertTrue($result);
$result = \OCP\Config::setAppValue('unit-test', $key, '12');
$this->assertTrue($result);
}
示例3: disableBackend
public function disableBackend($backend)
{
$backends = $this->getBackends();
if (array_key_exists($backend, $backends)) {
\OCP\Config::setAppValue('chat', 'backend_' . $backend . '_enabled', false);
return true;
} else {
throw new BackendNotFoundException('Backend not found', 404);
}
}
示例4: tearDown
public function tearDown()
{
\OC_User::setUserId($this->user);
$cache = $this->storage->getCache();
$ids = $cache->getAll();
$permissionsCache = $this->storage->getPermissionsCache();
$permissionsCache->removeMultiple($ids, \OC_User::getUser());
$cache->clear();
if (!is_null($this->config['av_mode'])) {
\OCP\Config::setAppValue('files_antivirus', 'av_mode', $this->config['av_mode']);
}
if (!is_null($this->config['av_path'])) {
\OCP\Config::setAppValue('files_antivirus', 'av_path', $this->config['av_path']);
}
}
示例5: webStep
private static function webStep()
{
// Iterate over all users
$lastid = \OCP\Config::getAppValue('news', 'backgroundjob_lastid', 0);
$feedmapper = new FeedMapper();
$feeds = $feedmapper->findAll();
usort($feeds, array('OCA\\News\\Backgroundjob', 'sortFeeds'));
$done = false;
foreach ($feeds as $feed) {
if ($feed['id'] > $lastid) {
// set lastid BEFORE updating feed!
\OCP\Config::setAppValue('news', 'backgroundjob_lastid', $feed['id']);
$done = true;
self::updateFeed($feedmapper, $feed);
}
}
if (!$done) {
\OCP\Config::setAppValue('news', 'backgroundjob_lastid', 0);
}
}
示例6: updateGroups
public static function updateGroups()
{
\OCP\Util::writeLog('user_ldap', 'Run background job "updateGroups"', \OCP\Util::DEBUG);
$lastUpdate = \OCP\Config::getAppValue('user_ldap', 'bgjUpdateGroupsLastRun', 0);
if (time() - $lastUpdate < self::getRefreshInterval()) {
\OCP\Util::writeLog('user_ldap', 'bgJ "updateGroups" – last run too fresh, aborting.', \OCP\Util::DEBUG);
//komm runter Werner die Maurer geben ein aus
return;
}
$knownGroups = array_keys(self::getKnownGroups());
$actualGroups = self::getGroupBE()->getGroups();
if (empty($actualGroups) && empty($knownGroups)) {
\OCP\Util::writeLog('user_ldap', 'bgJ "updateGroups" – groups do not seem to be configured properly, aborting.', \OCP\Util::INFO);
\OCP\Config::setAppValue('user_ldap', 'bgjUpdateGroupsLastRun', time());
return;
}
self::handleKnownGroups(array_intersect($actualGroups, $knownGroups));
self::handleCreatedGroups(array_diff($actualGroups, $knownGroups));
self::handleRemovedGroups(array_diff($knownGroups, $actualGroups));
\OCP\Config::setAppValue('user_ldap', 'bgjUpdateGroupsLastRun', time());
\OCP\Util::writeLog('user_ldap', 'bgJ "updateGroups" – Finished.', \OCP\Util::DEBUG);
}
示例7: saveValue
/**
* @param string $varName
* @param string $value
* @return bool
*/
protected function saveValue($varName, $value)
{
return \OCP\Config::setAppValue('user_ldap', $this->configPrefix . $varName, $value);
}
示例8: setRecentBackupPath
public static function setRecentBackupPath($path)
{
\OCP\Config::setAppValue(self::APP_ID, self::LAST_BACKUP_PATH, $path);
}
示例9: isset
<?php
/**
* ownCloud - Documents App
*
* @author Victor Dubiniuk
* @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com
*
* This file is licensed under the Affero General Public License version 3 or
* later.
*/
namespace OCA\Documents;
\OCP\JSON::callCheck();
$unstable = isset($_POST['unstable']) ? $_POST['unstable'] : null;
if (!is_null($unstable)) {
\OCP\JSON::checkAdminUser();
\OCP\Config::setAppValue('documents', 'unstable', $unstable);
\OCP\JSON::success();
exit;
}
if (isset($_GET['unstable'])) {
\OCP\JSON::success(array('value' => \OCP\Config::getAppValue('documents', 'unstable', 'false')));
}
exit;
示例10: foreach
<?php
/**
* ownCloud - Documents App
*
* @author Victor Dubiniuk
* @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com
*
* This file is licensed under the Affero General Public License version 3 or
* later.
*/
$installedVersion = \OCP\Config::getAppValue('documents', 'installed_version');
$cleanup = \OC_DB::prepare('DELETE FROM `*PREFIX*documents_member` WHERE `last_activity`=0 or `last_activity` is NULL');
$cleanup->execute();
if (version_compare($installedVersion, '0.7', '<=')) {
\OCP\Config::setAppValue('documents', 'unstable', 'false');
$session = new \OCA\Documents\Db_Session();
$query = \OC_DB::prepare('UPDATE `*PREFIX*documents_session` SET `genesis_url`=? WHERE `es_id`=?');
foreach ($session->getCollection() as $sessionData) {
$sessionData['genesis_url'] = \OCA\Documents\Genesis::DOCUMENTS_DIRNAME . $sessionData['genesis_url'];
$query->execute(array($sessionData['genesis_url'], $sessionData['es_id']));
}
}
if (version_compare($installedVersion, '0.8', '<')) {
$query = \OC_DB::prepare('UPDATE `*PREFIX*documents_member` SET `is_guest`=1 WHERE `uid` LIKE \'%(guest)\' ');
$query->execute(array());
}
示例11: setAppValue
/**
* Writes a new app wide value
*
* @param string $appName the appName that we want to store the value under
* @param string $key the key of the value, under which will be saved
* @param string $value the value that should be stored
*/
public function setAppValue($appName, $key, $value) {
\OCP\Config::setAppValue($appName, $key, $value);
}
示例12: setAutoCreateUser
/**
* @brief Sets auto create account flag
*
* If true Mozilla Sync accounts are auto created for ownCloud users, i.e. no registration required
*
* @param boolean $autocreate
*/
public static function setAutoCreateUser($autocreate)
{
\OCP\Config::setAppValue('mozilla_sync', 'auto_create_user', $autocreate);
}
示例13: testUpdateShareExpireDate
/**
* @medium
*/
function testUpdateShareExpireDate()
{
$fileInfo = $this->view->getFileInfo($this->folder);
// enforce expire date, by default 7 days after the file was shared
\OCP\Config::setAppValue('core', 'shareapi_default_expire_date', 'yes');
\OCP\Config::setAppValue('core', 'shareapi_enforce_expire_date', 'yes');
$dateWithinRange = new \DateTime();
$dateWithinRange->add(new \DateInterval('P5D'));
$dateOutOfRange = new \DateTime();
$dateOutOfRange->add(new \DateInterval('P8D'));
$result = \OCP\Share::shareItem('folder', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_LINK, null, 1);
// share was successful?
$this->assertTrue(is_string($result));
$items = \OCP\Share::getItemShared('file', null);
// make sure that we found a link share
$this->assertEquals(1, count($items));
$linkShare = reset($items);
// update expire date to a valid value
$params = array();
$params['id'] = $linkShare['id'];
$params['_put'] = array();
$params['_put']['expireDate'] = $dateWithinRange->format('Y-m-d');
$result = Share\Api::updateShare($params);
$this->assertTrue($result->succeeded());
$items = \OCP\Share::getItemShared('file', $linkShare['file_source']);
$updatedLinkShare = reset($items);
// date should be changed
$this->assertTrue(is_array($updatedLinkShare));
$this->assertEquals($dateWithinRange->format('Y-m-d') . ' 00:00:00', $updatedLinkShare['expiration']);
// update expire date to a value out of range
$params = array();
$params['id'] = $linkShare['id'];
$params['_put'] = array();
$params['_put']['expireDate'] = $dateOutOfRange->format('Y-m-d');
$result = Share\Api::updateShare($params);
$this->assertFalse($result->succeeded());
$items = \OCP\Share::getItemShared('file', $linkShare['file_source']);
$updatedLinkShare = reset($items);
// date shouldn't be changed
$this->assertTrue(is_array($updatedLinkShare));
$this->assertEquals($dateWithinRange->format('Y-m-d') . ' 00:00:00', $updatedLinkShare['expiration']);
// cleanup
\OCP\Config::setAppValue('core', 'shareapi_default_expire_date', 'no');
\OCP\Config::setAppValue('core', 'shareapi_enforce_expire_date', 'no');
\OCP\Share::unshare('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_LINK, null);
}
示例14: version_compare
//detect if we can switch on naming guidelines. We won't do it on conflicts.
//it's a bit spaghetti, but hey.
$state = OCP\Config::getSystemValue('ldapIgnoreNamingRules', 'unset');
if ($state === 'unset') {
OCP\Config::setSystemValue('ldapIgnoreNamingRules', false);
}
$installedVersion = OCP\Config::getAppValue('user_ldap', 'installed_version');
$enableRawMode = version_compare($installedVersion, '0.4.1', '<');
$configPrefixes = OCA\user_ldap\lib\Helper::getServerConfigurationPrefixes(true);
$ldap = new OCA\user_ldap\lib\LDAP();
foreach ($configPrefixes as $config) {
$connection = new OCA\user_ldap\lib\Connection($ldap, $config);
$state = \OCP\Config::getAppValue('user_ldap', $config . 'ldap_uuid_user_attribute', 'not existing');
if ($state === 'non existing') {
$value = \OCP\Config::getAppValue('user_ldap', $config . 'ldap_uuid_attribute', '');
\OCP\Config::setAppValue('user_ldap', $config . 'ldap_uuid_user_attribute', $value);
\OCP\Config::setAppValue('user_ldap', $config . 'ldap_uuid_group_attribute', $value);
}
$state = \OCP\Config::getAppValue('user_ldap', $config . 'ldap_expert_uuid_user_attr', 'not existing');
if ($state === 'non existing') {
$value = \OCP\Config::getAppValue('user_ldap', $config . 'ldap_expert_uuid_attr', '');
\OCP\Config::setAppValue('user_ldap', $config . 'ldap_expert_uuid_user_attr', $value);
\OCP\Config::setAppValue('user_ldap', $config . 'ldap_expert_uuid_group_attr', $value);
}
if ($enableRawMode) {
\OCP\Config::setAppValue('user_ldap', $config . 'ldap_user_filter_mode', 1);
\OCP\Config::setAppValue('user_ldap', $config . 'ldap_login_filter_mode', 1);
\OCP\Config::setAppValue('user_ldap', $config . 'ldap_group_filter_mode', 1);
}
}
示例15: count
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library 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 AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
OCP\App::registerAdmin('files_antivirus', 'settings');
OCP\Util::connectHook('OC_Filesystem', 'post_write', '\\OCA\\Files_Antivirus\\Scanner', 'av_scan');
OCP\BackgroundJob::AddRegularTask('OCA\\Files_Antivirus\\BackgroundScanner', 'check');
$avBinary = \OCP\Config::getAppValue('files_antivirus', 'av_path', '');
if (empty($avBinary)) {
try {
$query = \OCP\DB::prepare('SELECT count(`id`) AS `totalRules` FROM `*PREFIX*files_antivirus_status`');
$result = $query->execute();
$result = $result->fetchRow();
if ($result['totalRules'] == 0) {
\OCA\Files_Antivirus\Status::init();
}
\OCP\Config::setAppValue('files_antivirus', 'av_path', '/usr/bin/clamscan');
} catch (\Exception $e) {
}
}