本文整理汇总了PHP中OC_Config::deleteKey方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_Config::deleteKey方法的具体用法?PHP OC_Config::deleteKey怎么用?PHP OC_Config::deleteKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC_Config
的用法示例。
在下文中一共展示了OC_Config::deleteKey方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tearDown
protected function tearDown()
{
if (isset($this->restore_logfile)) {
OC_Config::setValue("logfile", $this->restore_logfile);
} else {
OC_Config::deleteKey("logfile");
}
if (isset($this->restore_logdateformat)) {
OC_Config::setValue("logdateformat", $this->restore_logdateformat);
} else {
OC_Config::deleteKey("restore_logdateformat");
}
OC_Log_Owncloud::init();
parent::tearDown();
}
示例2: testFindLanguage
/**
* @dataProvider findLanguageData
*/
public function testFindLanguage($default, $preference, $expected)
{
OC_User::setUserId(null);
if (is_null($default)) {
OC_Config::deleteKey('default_language');
} else {
OC_Config::setValue('default_language', $default);
}
$_SERVER['HTTP_ACCEPT_LANGUAGE'] = $preference;
$reflection = new \ReflectionClass('OC_L10N');
$prop = $reflection->getProperty('language');
$prop->setAccessible(1);
$prop->setValue('');
$prop->setAccessible(0);
$this->assertSame($expected, OC_L10N::findLanguage());
}
示例3: setMailSettings
/**
* Set mail settings
*/
public static function setMailSettings()
{
\OC_Util::checkAdminUser();
\OCP\JSON::callCheck();
$l = \OC::$server->getL10N('settings');
$smtp_settings = array('mail_domain' => null, 'mail_from_address' => null, 'mail_smtpmode' => array('sendmail', 'smtp', 'qmail', 'php'), 'mail_smtpsecure' => array('', 'ssl', 'tls'), 'mail_smtphost' => null, 'mail_smtpport' => null, 'mail_smtpauthtype' => array('LOGIN', 'PLAIN', 'NTLM'), 'mail_smtpauth' => true, 'mail_smtpname' => null, 'mail_smtppassword' => null);
foreach ($smtp_settings as $setting => $validate) {
if (!$validate) {
if (!isset($_POST[$setting]) || $_POST[$setting] === '') {
\OC_Config::deleteKey($setting);
} else {
\OC_Config::setValue($setting, $_POST[$setting]);
}
} else {
if (is_bool($validate)) {
if (!empty($_POST[$setting])) {
\OC_Config::setValue($setting, (bool) $_POST[$setting]);
} else {
\OC_Config::deleteKey($setting);
}
} else {
if (is_array($validate)) {
if (!isset($_POST[$setting]) || $_POST[$setting] === '') {
\OC_Config::deleteKey($setting);
} else {
if (in_array($_POST[$setting], $validate)) {
\OC_Config::setValue($setting, $_POST[$setting]);
} else {
$message = $l->t('Invalid value supplied for %s', array(self::getFieldname($setting, $l)));
\OC_JSON::error(array("data" => array("message" => $message)));
exit;
}
}
}
}
}
}
\OC_JSON::success(array("data" => array("message" => $l->t("Saved"))));
}
示例4: testGetInstanceIdGeneratesValidId
function testGetInstanceIdGeneratesValidId()
{
OC_Config::deleteKey('instanceid');
$this->assertStringStartsWith('oc', OC_Util::getInstanceId());
}
示例5: deleteValue
/**
* Delete a system wide defined value
*
* @param string $key the key of the value, under which it was saved
*/
public function deleteValue($key)
{
\OC_Config::deleteKey($key);
}
示例6: testServerHost
public function testServerHost()
{
OC_Config::deleteKey('overwritecondaddr');
OC_Config::setValue('overwritehost', 'overwritten.host:8080');
OC_Config::setValue('trusted_domains', array('trusted.host:8080', 'second.trusted.host:8080'));
$_SERVER['HTTP_HOST'] = 'trusted.host:8080';
// CLI always gives localhost
$oldCLI = OC::$CLI;
OC::$CLI = true;
$host = OC_Request::serverHost();
$this->assertEquals('localhost', $host);
OC::$CLI = false;
// overwritehost overrides trusted domain
$host = OC_Request::serverHost();
$this->assertEquals('overwritten.host:8080', $host);
// trusted domain returned when used
OC_Config::deleteKey('overwritehost');
$host = OC_Request::serverHost();
$this->assertEquals('trusted.host:8080', $host);
// trusted domain returned when untrusted one in header
$_SERVER['HTTP_HOST'] = 'untrusted.host:8080';
OC_Config::deleteKey('overwritehost');
$host = OC_Request::serverHost();
$this->assertEquals('trusted.host:8080', $host);
// clean up
OC_Config::deleteKey('overwritecondaddr');
OC_Config::deleteKey('overwritehost');
unset($_SERVER['HTTP_HOST']);
OC::$CLI = $oldCLI;
}
示例7: deleteSystemValue
/**
* Deletes a value from config.php
* @param string $key key
*
* This function deletes the value from config.php.
*/
public static function deleteSystemValue($key)
{
return \OC_Config::deleteKey($key);
}
示例8: testGetInstanceIdGeneratesValidId
function testGetInstanceIdGeneratesValidId()
{
OC_Config::deleteKey('instanceid');
$instanceId = OC_Util::getInstanceId();
$this->assertStringStartsWith('oc', $instanceId);
$matchesRegex = preg_match('/^[a-z0-9]+$/', $instanceId);
$this->assertSame(1, $matchesRegex);
}