本文整理汇总了PHP中OCP\IConfig::deleteSystemValue方法的典型用法代码示例。如果您正苦于以下问题:PHP IConfig::deleteSystemValue方法的具体用法?PHP IConfig::deleteSystemValue怎么用?PHP IConfig::deleteSystemValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OCP\IConfig
的用法示例。
在下文中一共展示了IConfig::deleteSystemValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* @param $argument
*/
protected function run($argument)
{
// Delete old tokens after 2 days
if ($this->timeFactory->getTime() - $this->config->getAppValue('core', 'updater.secret.created', $this->timeFactory->getTime()) >= 172800) {
$this->config->deleteSystemValue('updater.secret');
}
}
示例2: testStreamDecryptLongFileContentWithoutHeader
/**
* @medium
* Test that data that is written by the crypto stream wrapper with AES 128
* @note Encrypted data is manually prepared and decrypted here to avoid dependency on success of stream_read
* @note If this test fails with truncate content, check that enough array slices are being rejoined to form $e, as the crypt.php file may have gotten longer and broken the manual
* reassembly of its data
*/
public function testStreamDecryptLongFileContentWithoutHeader()
{
// Generate a a random filename
$filename = 'tmp-' . $this->getUniqueID() . '.test';
$this->config->setSystemValue('cipher', 'AES-128-CFB');
// Save long data as encrypted file using stream wrapper
$cryptedFile = file_put_contents('crypt:///' . $this->userId . '/files/' . $filename, $this->dataLong . $this->dataLong);
$this->config->deleteSystemValue('cipher');
// Test that data was successfully written
$this->assertTrue(is_int($cryptedFile));
// Disable encryption proxy to prevent recursive calls
$proxyStatus = \OC_FileProxy::$enabled;
\OC_FileProxy::$enabled = false;
// Get file contents without using any wrapper to get it's actual contents on disk
$retreivedCryptedFile = $this->view->file_get_contents($this->userId . '/files/' . $filename);
// Check that the file was encrypted before being written to disk
$this->assertNotEquals($this->dataLong . $this->dataLong, $retreivedCryptedFile);
// remove the header to check if we can also decrypt old files without a header,
// this files should fall back to AES-128
$cryptedWithoutHeader = substr($retreivedCryptedFile, \OCA\Files_Encryption\Crypt::BLOCKSIZE);
$this->view->file_put_contents($this->userId . '/files/' . $filename, $cryptedWithoutHeader);
// Re-enable proxy - our work is done
\OC_FileProxy::$enabled = $proxyStatus;
$decrypted = file_get_contents('crypt:///' . $this->userId . '/files/' . $filename);
$this->assertEquals($this->dataLong . $this->dataLong, $decrypted);
// Teardown
$this->view->unlink($this->userId . '/files/' . $filename);
}
示例3: setMailSettings
/**
* Sets the email settings
* @param string $mail_domain
* @param string $mail_from_address
* @param string $mail_smtpmode
* @param string $mail_smtpsecure
* @param string $mail_smtphost
* @param string $mail_smtpauthtype
* @param int $mail_smtpauth
* @param string $mail_smtpport
* @return array
*/
public function setMailSettings($mail_domain, $mail_from_address, $mail_smtpmode, $mail_smtpsecure, $mail_smtphost, $mail_smtpauthtype, $mail_smtpauth, $mail_smtpport)
{
$params = get_defined_vars();
foreach ($params as $key => $value) {
if (empty($value)) {
$this->config->deleteSystemValue($key);
} else {
$this->config->setSystemValue($key, $value);
}
}
// Delete passwords from config in case no auth is specified
if ($params['mail_smtpauth'] !== 1) {
$this->config->deleteSystemValue('mail_smtpname');
$this->config->deleteSystemValue('mail_smtppassword');
}
return array('data' => array('message' => (string) $this->l10n->t('Saved')), 'status' => 'success');
}