當前位置: 首頁>>代碼示例>>PHP>>正文


PHP IConfig::setAppValue方法代碼示例

本文整理匯總了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>');
 }
開發者ID:evanjt,項目名稱:core,代碼行數:30,代碼來源:import.php

示例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);
             }
         }
     }
 }
開發者ID:kenwi,項目名稱:core,代碼行數:25,代碼來源:enable.php

示例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']);
     }
 }
開發者ID:yheric455042,項目名稱:owncloud82,代碼行數:10,代碼來源:enablefilesapp.php

示例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);
     }
 }
開發者ID:rchicoli,項目名稱:owncloud-core,代碼行數:7,代碼來源:EncryptionTrait.php

示例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();
 }
開發者ID:rchicoli,項目名稱:owncloud-core,代碼行數:12,代碼來源:Config.php

示例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));
 }
開發者ID:schiessle,項目名稱:popularitycontestserver,代碼行數:8,代碼來源:computestatistics.php

示例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;
 }
開發者ID:Kevin-ZK,項目名稱:vaneDisk,代碼行數:15,代碼來源:updateoutdatedocsids.php

示例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>');
     }
 }
開發者ID:evanjt,項目名稱:core,代碼行數:9,代碼來源:disable.php

示例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);
 }
開發者ID:ZverAleksey,項目名稱:core,代碼行數:13,代碼來源:admincontroller.php

示例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;
 }
開發者ID:kenwi,項目名稱:core,代碼行數:13,代碼來源:setconfig.php

示例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();
 }
開發者ID:evanjt,項目名稱:core,代碼行數:14,代碼來源:repairlegacystorage.php

示例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.');
         }
     }
 }
開發者ID:loulancn,項目名稱:core,代碼行數:15,代碼來源:enablemasterkey.php

示例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();
 }
開發者ID:loulancn,項目名稱:core,代碼行數:29,代碼來源:expiretrash.php

示例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;
 }
開發者ID:adolfo2103,項目名稱:hcloudfilem,代碼行數:39,代碼來源:keymanager.php

示例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);
 }
開發者ID:Kevin-ZK,項目名稱:vaneDisk,代碼行數:11,代碼來源:etagpropagator.php


注:本文中的OCP\IConfig::setAppValue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。