本文整理汇总了PHP中Piwik\Option::deleteLike方法的典型用法代码示例。如果您正苦于以下问题:PHP Option::deleteLike方法的具体用法?PHP Option::deleteLike怎么用?PHP Option::deleteLike使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik\Option
的用法示例。
在下文中一共展示了Option::deleteLike方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: clearUserViewDataTableParameters
public static function clearUserViewDataTableParameters($userLogin)
{
Option::deleteLike('viewDataTableParameters_' . $userLogin . '_%');
}
示例2: deleteSite
/**
* Delete user preferences associated with a particular site
*/
public function deleteSite($idSite)
{
Option::deleteLike('%\\_' . API::PREFERENCE_DEFAULT_REPORT, $idSite);
}
示例3: forgetRememberedArchivedReportsToInvalidateForSite
public function forgetRememberedArchivedReportsToInvalidateForSite($idSite)
{
$id = $this->buildRememberArchivedReportIdForSite($idSite) . '_%';
Option::deleteLike($id);
}
示例4: updateDatabase
public static function updateDatabase($force = false)
{
Cache::deleteTrackerCache();
Option::clearCache();
if ($force) {
// remove version options to force update
Option::deleteLike('version%');
Option::set('version_core', '0.0');
}
$updater = new Updater();
$componentsWithUpdateFile = CoreUpdater::getComponentUpdates($updater);
if (empty($componentsWithUpdateFile)) {
return false;
}
$result = CoreUpdater::updateComponents($updater, $componentsWithUpdateFile);
if (!empty($result['coreError']) || !empty($result['warnings']) || !empty($result['errors'])) {
throw new \Exception("Failed to update database (errors or warnings found): " . print_r($result, true));
}
return $result;
}
示例5: testDeleteLike
/**
* @group Core
*/
public function testDeleteLike()
{
// empty table, expect false (i.e., not found)
$this->assertFalse(Option::get('anonymous_defaultReport'));
$this->assertFalse(Option::get('admin_defaultReport'));
$this->assertFalse(Option::get('visitor_defaultReport'));
// insert guard - to test unescaped underscore
Option::set('adefaultReport', '0', true);
$this->assertTrue(Option::get('adefaultReport') === '0');
// populate table, expect '1'
Option::set('anonymous_defaultReport', '1', true);
Option::deleteLike('\\_defaultReport');
$this->assertSame('1', Option::get('anonymous_defaultReport'));
$this->assertSame('0', Option::get('adefaultReport'));
// populate table, expect '2'
Option::set('admin_defaultReport', '2', false);
Option::deleteLike('\\_defaultReport');
$this->assertSame('2', Option::get('admin_defaultReport'));
$this->assertSame('0', Option::get('adefaultReport'));
// populate table, expect '3'
Option::set('visitor_defaultReport', '3', false);
Option::deleteLike('\\_defaultReport');
$this->assertSame('3', Option::get('visitor_defaultReport'));
$this->assertSame('0', Option::get('adefaultReport'));
// delete with non-matching value, expect '1'
Option::deleteLike('%\\_defaultReport', '4');
$this->assertSame('1', Option::get('anonymous_defaultReport'));
$this->assertSame('0', Option::get('adefaultReport'));
// delete with matching pattern, expect false
Option::deleteLike('%\\_defaultReport', '1');
$this->assertFalse(Option::get('anonymous_defaultReport'));
$this->assertSame('0', Option::get('adefaultReport'));
// this shouldn't have been deleted, expect '2' and '3'
$this->assertSame('2', Option::get('admin_defaultReport'));
$this->assertSame('3', Option::get('visitor_defaultReport'));
$this->assertSame('0', Option::get('adefaultReport'));
// deleted, expect false (except for the guard)
Option::deleteLike('%\\_defaultReport');
$this->assertFalse(Option::get('admin_defaultReport'));
$this->assertFalse(Option::get('visitor_defaultReport'));
// unescaped backslash (single quotes)
Option::deleteLike('%\\_defaultReport');
$this->assertSame('0', Option::get('adefaultReport'));
// escaped backslash (single quotes)
Option::deleteLike('%\\_defaultReport');
$this->assertSame('0', Option::get('adefaultReport'));
// unescaped backslash (double quotes)
Option::deleteLike("%\\_defaultReport");
$this->assertSame('0', Option::get('adefaultReport'));
// escaped backslash (double quotes)
Option::deleteLike("%\\_defaultReport");
$this->assertSame('0', Option::get('adefaultReport'));
}