本文整理汇总了PHP中Piwik\Config::forceSave方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::forceSave方法的具体用法?PHP Config::forceSave怎么用?PHP Config::forceSave使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik\Config
的用法示例。
在下文中一共展示了Config::forceSave方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_forceSave_writesNothingIfThereAreNoChanges
public function test_forceSave_writesNothingIfThereAreNoChanges()
{
$sourceConfigFile = PIWIK_INCLUDE_PATH . '/tests/resources/Config/config.ini.php';
$configFile = PIWIK_INCLUDE_PATH . '/tmp/tmp.config.ini.php';
if (file_exists($configFile)) {
@unlink($configFile);
}
copy($sourceConfigFile, $configFile);
$config = new Config(new GlobalSettingsProvider($sourceConfigFile, $configFile));
$config->forceSave();
$this->assertEquals(file_get_contents($sourceConfigFile), file_get_contents($configFile));
if (file_exists($configFile)) {
@unlink($configFile);
}
}
示例2: prepareTestDatabaseConfig
function prepareTestDatabaseConfig(Config $config)
{
$testDb = $config->database_tests;
Factory::setTest(true);
if ('@USERNAME@' !== $testDb['username']) {
return;
// testDb is already configured, we do not want to overwrite any existing settings.
}
$db = $config->database;
$testDb['username'] = $db['username'];
if (empty($testDb['password'])) {
$testDb['password'] = $db['password'];
}
if (empty($testDb['host'])) {
$testDb['host'] = $db['host'];
}
$testDb['tables_prefix'] = '';
// tables_prefix has to be empty for UI tests
$config->database_tests = $testDb;
$config->forceSave();
}
示例3: forceSave
public function forceSave()
{
if ($this->allowSave) {
parent::forceSave();
}
}