本文整理汇总了PHP中Piwik\Option::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Option::delete方法的具体用法?PHP Option::delete怎么用?PHP Option::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik\Option
的用法示例。
在下文中一共展示了Option::delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testDelete
public function testDelete()
{
// empty table, expect false (i.e., not found)
$this->assertFalse(Option::get('anonymous_defaultReport'));
$this->assertFalse(Option::get('admin_defaultReport'));
// populate table, expect '1'
Option::set('anonymous_defaultReport', '1', true);
Option::delete('_defaultReport');
$this->assertSame('1', Option::get('anonymous_defaultReport'));
// populate table, expect '2'
Option::set('admin_defaultReport', '2', false);
Option::delete('_defaultReport');
$this->assertSame('2', Option::get('admin_defaultReport'));
// delete with non-matching value, expect '1'
Option::delete('anonymous_defaultReport', '2');
$this->assertSame('1', Option::get('anonymous_defaultReport'));
// delete with matching value, expect false
Option::delete('anonymous_defaultReport', '1');
$this->assertFalse(Option::get('anonymous_defaultReport'));
// this shouldn't have been deleted, expect '2'
$this->assertSame('2', Option::get('admin_defaultReport'));
// deleted, expect false
Option::delete('admin_defaultReport');
$this->assertFalse(Option::get('admin_defaultReport'));
}
示例2: doUpdate
public function doUpdate(Updater $updater)
{
// delete schema version_
Option::delete('version_Referers');
$updater->executeMigrations(__FILE__, $this->getMigrations($updater));
// old plugins deleted in 2.0-a17 update file
}
示例3: testWebArchiving
public function testWebArchiving()
{
if (self::isMysqli() && self::isTravisCI()) {
$this->markTestSkipped('Skipping on Mysqli as it randomly fails.');
}
$host = Fixture::getRootUrl();
$token = Fixture::getTokenAuth();
$urlTmp = Option::get('piwikUrl');
Option::set('piwikUrl', $host . 'tests/PHPUnit/proxy/index.php');
$url = $host . 'tests/PHPUnit/proxy/archive.php?token_auth=' . $token;
$output = Http::sendHttpRequest($url, 600);
// ignore random build issues
if (empty($output) || strpos($output, \Piwik\CronArchive::NO_ERROR) === false) {
$message = "This test has failed. Because it sometimes randomly fails, we skip the test, and ignore this failure.\n";
$message .= "If you see this message often, or in every build, please investigate as this should only be a random and rare occurence!\n";
$message .= "\n\narchive web failed: " . $output . "\n\nurl used: {$url}";
$this->markTestSkipped($message);
}
if (!empty($urlTmp)) {
Option::set('piwikUrl', $urlTmp);
} else {
Option::delete('piwikUrl');
}
$this->assertContains('Starting Piwik reports archiving...', $output);
$this->assertContains('Archived website id = 1', $output);
$this->assertContains('Done archiving!', $output);
$this->compareArchivePhpOutputAgainstExpected($output);
}
示例4: setSiteIdsToArchive
public function setSiteIdsToArchive($siteIds)
{
if (!empty($siteIds)) {
Option::set($this->optionName, implode(',', $siteIds));
} else {
Option::delete($this->optionName);
}
}
示例5: setSiteIdsToArchive
public function setSiteIdsToArchive($siteIds)
{
if (!empty($siteIds)) {
Option::set('SharedSiteIdsToArchive', implode(',', $siteIds));
} else {
Option::delete('SharedSiteIdsToArchive');
}
}
示例6: should_load_spammer_list_from_options_if_exists
/**
* @test
*/
public function should_load_spammer_list_from_options_if_exists()
{
// We store google.com in the spammer blacklist
$list = serialize(array('google.com'));
Option::set(ReferrerSpamFilter::OPTION_STORAGE_NAME, $list);
$request = new Request(array('urlref' => 'semalt.com'));
$this->assertFalse($this->filter->isSpam($request));
// Now Google is blacklisted
$request = new Request(array('urlref' => 'google.com'));
$this->assertTrue($this->filter->isSpam($request));
Option::delete(ReferrerSpamFilter::OPTION_STORAGE_NAME);
}
示例7: setUp
public function setUp()
{
parent::setUp();
Fixture::createWebsite('2014-02-04');
$testingEnvironment = new \Piwik\Tests\Framework\TestingEnvironmentVariables();
$testingEnvironment->testCaseClass = null;
$testingEnvironment->addFailingScheduledTask = false;
$testingEnvironment->addScheduledTask = false;
$testingEnvironment->save();
Option::delete(self::TASKS_STARTED_OPTION_NAME);
Option::delete(self::TASKS_FINISHED_OPTION_NAME);
Option::delete(Timetable::TIMETABLE_OPTION_STRING);
SettingsPiwik::overwritePiwikUrl(self::$fixture->getRootUrl() . "tests/PHPUnit/proxy");
}
示例8: doUpdate
public function doUpdate(Updater $updater)
{
// delete schema version_
Option::delete('version_Referers');
$updater->executeMigrationQueries(__FILE__, $this->getMigrationQueries($updater));
// old plugins deleted in 2.0-a17 update file
try {
\Piwik\Plugin\Manager::getInstance()->activatePlugin('Referrers');
} catch (\Exception $e) {
}
try {
\Piwik\Plugin\Manager::getInstance()->activatePlugin('ScheduledReports');
} catch (\Exception $e) {
}
}
示例9: update
public static function update()
{
// delete schema version_
Option::delete('version_Referers');
Updater::updateDatabase(__FILE__, self::getSql());
// old plugins deleted in 2.0-a17 update file
try {
\Piwik\Plugin\Manager::getInstance()->activatePlugin('Referrers');
} catch (\Exception $e) {
}
try {
\Piwik\Plugin\Manager::getInstance()->activatePlugin('ScheduledReports');
} catch (\Exception $e) {
}
}
示例10: test_WebArchiving
public function test_WebArchiving()
{
if (self::isMysqli() && self::isTravisCI()) {
$this->markTestSkipped('Skipping on Mysqli as it randomly fails.');
}
$host = Fixture::getRootUrl();
$token = Fixture::getTokenAuth();
$urlTmp = Option::get('piwikUrl');
Option::set('piwikUrl', $host . 'tests/PHPUnit/proxy/index.php');
$url = $host . 'tests/PHPUnit/proxy/archive.php?token_auth=' . $token;
$output = Http::sendHttpRequest($url, 600);
// ignore random build issues
if (empty($output) || strpos($output, \Piwik\CronArchive::NO_ERROR) === false) {
$this->fail("archive web failed: " . $output . "\n\nurl used: {$url}");
}
if (!empty($urlTmp)) {
Option::set('piwikUrl', $urlTmp);
} else {
Option::delete('piwikUrl');
}
$this->assertWebArchivingDone($output);
}
示例11: forgetRememberedArchivedReportsToInvalidate
/**
* @internal
*/
public function forgetRememberedArchivedReportsToInvalidate($idSite, Date $date)
{
$id = $this->buildRememberArchivedReportId($idSite, $date->toString());
Option::delete($id);
}
示例12: removeAllPluginSettings
/**
* Removes all settings for this plugin from the database. Useful when uninstalling
* a plugin.
*/
public function removeAllPluginSettings()
{
Piwik::checkUserHasSuperUserAccess();
Option::delete($this->getOptionKey());
$this->settingsValues = array();
}
示例13: uninstallPlugin
/**
* Uninstalls a Plugin (deletes plugin files from the disk)
* Only deactivated plugins can be uninstalled
*
* @param $pluginName
* @throws \Exception
* @return bool
*/
public function uninstallPlugin($pluginName)
{
if ($this->isPluginLoaded($pluginName)) {
throw new \Exception("To uninstall the plugin {$pluginName}, first disable it in Piwik > Settings > Plugins");
}
$this->returnLoadedPluginsInfo();
\Piwik\Settings\Manager::cleanupPluginSettings($pluginName);
$this->executePluginDeactivate($pluginName);
$this->executePluginUninstall($pluginName);
$this->removePluginFromPluginsInstalledConfig($pluginName);
$this->unloadPluginFromMemory($pluginName);
$this->removePluginFromConfig($pluginName);
Option::delete('version_' . $pluginName);
$this->clearCache($pluginName);
self::deletePluginFromFilesystem($pluginName);
if ($this->isPluginInFilesystem($pluginName)) {
return false;
}
return true;
}
示例14: removePasswordResetInfo
/**
* Removes stored password reset info if it exists.
*
* @param string $login The user login to check for.
*/
public static function removePasswordResetInfo($login)
{
$optionName = self::getPasswordResetInfoOptionName($login);
Option::delete($optionName);
}
示例15: markComponentSuccessfullyUninstalled
/**
* Marks a component as successfully uninstalled. Deletes an option
* that looks like `"version_$componentName"`.
*
* @param string $name The component name. Eg, a plugin name, `'core'` or dimension column name.
*/
public function markComponentSuccessfullyUninstalled($name)
{
try {
Option::delete(self::getNameInOptionTable($name));
} catch (\Exception $e) {
// case when the option table is not yet created (before 0.2.10)
}
}