本文整理汇总了PHP中OCP\IConfig::setAppValue方法的典型用法代码示例。如果您正苦于以下问题:PHP IConfig::setAppValue方法的具体用法?PHP IConfig::setAppValue怎么用?PHP IConfig::setAppValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OCP\IConfig
的用法示例。
在下文中一共展示了IConfig::setAppValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$importFile = $input->getArgument('file');
if ($importFile !== null) {
$content = $this->getArrayFromFile($importFile);
} else {
$content = $this->getArrayFromStdin();
}
try {
$configs = $this->validateFileContent($content);
} catch (\UnexpectedValueException $e) {
$output->writeln('<error>' . $e->getMessage() . '</error>');
return;
}
if (!empty($configs['system'])) {
$this->config->setSystemValues($configs['system']);
}
if (!empty($configs['apps'])) {
foreach ($configs['apps'] as $app => $appConfigs) {
foreach ($appConfigs as $key => $value) {
if ($value === null) {
$this->config->deleteAppValue($app, $key);
} else {
$this->config->setAppValue($app, $key, $value);
}
}
}
}
$output->writeln('<info>Config successfully imported from: ' . $importFile . '</info>');
}
示例2: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
if ($this->config->getAppValue('core', 'encryption_enabled', 'no') === 'yes') {
$output->writeln('Encryption is already enabled');
} else {
$this->config->setAppValue('core', 'encryption_enabled', 'yes');
$output->writeln('<info>Encryption enabled</info>');
}
$output->writeln('');
$modules = $this->encryptionManager->getEncryptionModules();
if (empty($modules)) {
$output->writeln('<error>No encryption module is loaded</error>');
} else {
$defaultModule = $this->config->getAppValue('core', 'default_encryption_module', null);
if ($defaultModule === null) {
$output->writeln('<error>No default module is set</error>');
} else {
if (!isset($modules[$defaultModule])) {
$output->writeln('<error>The current default module does not exist: ' . $defaultModule . '</error>');
} else {
$output->writeln('Default module: ' . $defaultModule);
}
}
}
}
示例3: run
/**
* Enables the files app if it is disabled
*/
public function run()
{
if ($this->config->getAppValue('files', 'enabled', 'no') !== 'yes') {
$this->config->setAppValue('files', 'enabled', 'yes');
$this->emit('\\OC\\Repair', 'info', ['Files app was disabled - re-enabled']);
}
}
示例4: tearDownEncryptionTrait
protected function tearDownEncryptionTrait()
{
if ($this->config) {
$this->config->setAppValue('core', 'encryption_enabled', $this->encryptionWasEnabled);
$this->config->setAppValue('core', 'default_encryption_module', $this->originalEncryptionModule);
}
}
示例5: setAppValue
/**
* @param array $parameters
* @return \OC_OCS_Result
*/
public function setAppValue($parameters)
{
$app = $parameters['appid'];
$configKey = $parameters['configkey'];
$value = $this->request->getParam('value');
$this->config->setAppValue($app, $configKey, $value);
return new \OC_OCS_Result();
}
示例6: run
protected function run($argument)
{
$result = [];
$result['instances'] = $this->getNumberOfInstances();
$result['categories'] = $this->getStatisticsOfCategories();
$result['apps'] = $this->getApps();
$this->config->setAppValue('popularitycontestserver', 'evaluated_statistics', json_encode($result));
}
示例7: fixOcsId
/**
* @param string $appName
* @param string $oldId
* @param string $newId
* @return bool True if updated, false otherwise
*/
public function fixOcsId($appName, $oldId, $newId)
{
$existingId = $this->config->getAppValue($appName, 'ocsid');
if ($existingId === $oldId) {
$this->config->setAppValue($appName, 'ocsid', $newId);
return true;
}
return false;
}
示例8: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
if ($this->config->getAppValue('core', 'encryption_enabled', 'no') !== 'yes') {
$output->writeln('Encryption is already disabled');
} else {
$this->config->setAppValue('core', 'encryption_enabled', 'no');
$output->writeln('<info>Encryption disabled</info>');
}
}
示例9: createCredentials
/**
* @return DataResponse
*/
public function createCredentials()
{
// Create a new job and store the creation date
$this->jobList->add('OCA\\UpdateNotification\\ResetTokenBackgroundJob');
$this->config->setAppValue('core', 'updater.secret.created', $this->timeFactory->getTime());
// Create a new token
$newToken = $this->secureRandom->generate(64);
$this->config->setSystemValue('updater.secret', password_hash($newToken, PASSWORD_DEFAULT));
return new DataResponse($newToken);
}
示例10: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$appName = $input->getArgument('app');
$configName = $input->getArgument('name');
if (!in_array($configName, $this->config->getAppKeys($appName)) && $input->hasParameterOption('--update-only')) {
$output->writeln('<comment>Config value ' . $configName . ' for app ' . $appName . ' not updated, as it has not been set before.</comment>');
return 1;
}
$configValue = $input->getOption('value');
$this->config->setAppValue($appName, $configName, $configValue);
$output->writeln('<info>Config value ' . $configName . ' for app ' . $appName . ' set to ' . $configValue . '</info>');
return 0;
}
示例11: tearDown
protected function tearDown()
{
$user = \OC::$server->getUserManager()->get($this->user);
if ($user) {
$user->delete();
}
$sql = 'DELETE FROM `*PREFIX*storages`';
$this->connection->executeQuery($sql);
$sql = 'DELETE FROM `*PREFIX*filecache`';
$this->connection->executeQuery($sql);
$this->config->setSystemValue('datadirectory', $this->oldDataDir);
$this->config->setAppValue('core', 'repairlegacystoragesdone', 'no');
parent::tearDown();
}
示例12: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$isAlreadyEnabled = $this->util->isMasterKeyEnabled();
if ($isAlreadyEnabled) {
$output->writeln('Master key already enabled');
} else {
$question = new ConfirmationQuestion('Warning: Only available for fresh installations with no existing encrypted data! ' . 'There is also no way to disable it again. Do you want to continue? (y/n) ', false);
if ($this->questionHelper->ask($input, $output, $question)) {
$this->config->setAppValue('encryption', 'useMasterKey', '1');
$output->writeln('Master key successfully enabled.');
} else {
$output->writeln('aborted.');
}
}
}
示例13: run
/**
* @param $argument
* @throws \Exception
*/
protected function run($argument)
{
$maxAge = $this->expiration->getMaxAgeAsTimestamp();
if (!$maxAge) {
return;
}
$offset = $this->config->getAppValue('files_trashbin', 'cronjob_user_offset', 0);
$users = $this->userManager->search('', self::USERS_PER_SESSION, $offset);
if (!count($users)) {
// No users found, reset offset and retry
$offset = 0;
$users = $this->userManager->search('', self::USERS_PER_SESSION);
}
$offset += self::USERS_PER_SESSION;
$this->config->setAppValue('files_trashbin', 'cronjob_user_offset', $offset);
foreach ($users as $user) {
$uid = $user->getUID();
if (!$this->setupFS($uid)) {
continue;
}
$dirContent = Helper::getTrashFiles('/', $uid, 'mtime');
Trashbin::deleteExpiredFiles($dirContent, $uid);
}
\OC_Util::tearDownFS();
}
示例14: __construct
/**
* @param IStorage $keyStorage
* @param Crypt $crypt
* @param IConfig $config
* @param IUserSession $userSession
* @param Session $session
* @param ILogger $log
* @param Util $util
*/
public function __construct(IStorage $keyStorage, Crypt $crypt, IConfig $config, IUserSession $userSession, Session $session, ILogger $log, Util $util)
{
$this->util = $util;
$this->session = $session;
$this->keyStorage = $keyStorage;
$this->crypt = $crypt;
$this->config = $config;
$this->log = $log;
$this->recoveryKeyId = $this->config->getAppValue('encryption', 'recoveryKeyId');
if (empty($this->recoveryKeyId)) {
$this->recoveryKeyId = 'recoveryKey_' . substr(md5(time()), 0, 8);
$this->config->setAppValue('encryption', 'recoveryKeyId', $this->recoveryKeyId);
}
$this->publicShareKeyId = $this->config->getAppValue('encryption', 'publicShareKeyId');
if (empty($this->publicShareKeyId)) {
$this->publicShareKeyId = 'pubShare_' . substr(md5(time()), 0, 8);
$this->config->setAppValue('encryption', 'publicShareKeyId', $this->publicShareKeyId);
}
$shareKey = $this->getPublicShareKey();
if (empty($shareKey)) {
$keyPair = $this->crypt->createKeyPair();
// Save public key
$this->keyStorage->setSystemUserKey($this->publicShareKeyId . '.publicKey', $keyPair['publicKey']);
// Encrypt private key empty passphrase
$encryptedKey = $this->crypt->symmetricEncryptFileContent($keyPair['privateKey'], '');
$this->keyStorage->setSystemUserKey($this->publicShareKeyId . '.privateKey', $encryptedKey);
}
$this->keyId = $userSession && $userSession->isLoggedIn() ? $userSession->getUser()->getUID() : false;
$this->log = $log;
}
示例15: markDirty
/**
* @param string $mountPoint
* @param int $time
*/
protected function markDirty($mountPoint, $time = null)
{
if ($time === null) {
$time = time();
}
$this->config->setAppValue('files_external', $mountPoint, $time);
}