本文整理匯總了PHP中phpbb\config\config::delete方法的典型用法代碼示例。如果您正苦於以下問題:PHP config::delete方法的具體用法?PHP config::delete怎麽用?PHP config::delete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類phpbb\config\config
的用法示例。
在下文中一共展示了config::delete方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: remove
/**
* Remove an existing config setting.
*
* @param string $config_name The name of the config setting you would
* like to remove
* @return null
*/
public function remove($config_name)
{
if (!isset($this->config[$config_name])) {
return;
}
$this->config->delete($config_name);
}
示例2: test_image_upload
/**
* @dataProvider data_image_upload
*/
public function test_image_upload($is_image, $plupload_active, $config_data, $expected)
{
$filespec = $this->getMock('\\phpbb\\files\\filespec', array('init_error', 'is_image', 'move_file', 'is_uploaded'), array($this->filesystem, $this->language, $this->php_ini, new \FastImageSize\FastImageSize(), $this->phpbb_root_path, $this->mimetype_guesser, $this->plupload));
foreach ($config_data as $key => $value) {
$this->config[$key] = $value;
}
$filespec->set_upload_namespace($this->files_upload);
$filespec->expects($this->any())->method('init_error')->willReturn(false);
$filespec->expects($this->any())->method('is_image')->willReturn($is_image);
$filespec->expects($this->any())->method('is_uploaded')->willReturn(true);
$filespec->expects($this->any())->method('move_file')->willReturn(false);
$this->container->set('files.filespec', $filespec);
$factory_mock = $this->getMockBuilder('\\phpbb\\files\\factory')->disableOriginalConstructor()->getMock();
$factory_mock->expects($this->any())->method('get')->willReturn($filespec);
$this->container->set('files.types.local', new \phpbb\files\types\local($factory_mock, $this->language, $this->php_ini, $this->request));
$plupload = $this->getMockBuilder('\\phpbb\\plupload\\plupload')->disableOriginalConstructor()->getMock();
$plupload->expects($this->any())->method('is_active')->willReturn($plupload_active);
if ($plupload_active) {
$plupload->expects($this->once())->method('emit_error')->with(104, 'ATTACHED_IMAGE_NOT_IMAGE')->willReturn(false);
}
$this->upload = new \phpbb\attachment\upload($this->auth, $this->cache, $this->config, $this->files_upload, $this->language, $this->mimetype_guesser, $this->phpbb_dispatcher, $plupload, $this->user, $this->phpbb_root_path);
$filedata = $this->upload->upload('foobar', 1, true, '', false, array('realname' => 'foobar.jpg', 'type' => 'jpg', 'size' => 100));
foreach ($expected as $key => $entry) {
$this->assertEquals($entry, $filedata[$key]);
}
// Reset config data
foreach ($config_data as $key => $value) {
$this->config->delete($key);
}
}
示例3: run
/**
* {@inheritdoc}
*/
public function run()
{
$this->language->add_lang('migrator');
if (!isset($this->config['version_update_from'])) {
$this->config->set('version_update_from', $this->config['version']);
}
$original_version = $this->config['version_update_from'];
$this->migrator->set_output_handler(new log_wrapper_migrator_output_handler($this->language, new installer_migrator_output_handler($this->iohandler), $this->phpbb_root_path . 'store/migrations_' . time() . '.log', $this->filesystem));
$this->migrator->create_migrations_table();
$migrations = $this->extension_manager->get_finder()->core_path('phpbb/db/migration/data/')->extension_directory('/migrations')->get_classes();
$this->migrator->set_migrations($migrations);
$migration_step_count = $this->installer_config->get('database_update_migration_steps', -1);
if ($migration_step_count < 0) {
$migration_step_count = count($this->migrator->get_installable_migrations()) * 2;
$this->installer_config->set('database_update_migration_steps', $migration_step_count);
}
$progress_count = $this->installer_config->get('database_update_count', 0);
$restart_progress_bar = $progress_count === 0;
// Only "restart" when the update runs for the first time
$this->iohandler->set_task_count($migration_step_count, $restart_progress_bar);
$this->installer_config->set_task_progress_count($migration_step_count);
while (!$this->migrator->finished()) {
try {
$this->migrator->update();
$progress_count++;
$last_run_migration = $this->migrator->get_last_run_migration();
if (isset($last_run_migration['effectively_installed']) && $last_run_migration['effectively_installed']) {
// We skipped two step, so increment $progress_count by another one
$progress_count++;
} else {
if ($last_run_migration['task'] === 'process_schema_step' && !$last_run_migration['state']['migration_schema_done'] || $last_run_migration['task'] === 'process_data_step' && !$last_run_migration['state']['migration_data_done']) {
// We just run a step that wasn't counted yet so make it count
$migration_step_count++;
}
}
$this->iohandler->set_task_count($migration_step_count);
$this->installer_config->set_task_progress_count($migration_step_count);
$this->iohandler->set_progress('STAGE_UPDATE_DATABASE', $progress_count);
} catch (exception $e) {
$msg = $e->getParameters();
array_unshift($msg, $e->getMessage());
$this->iohandler->add_error_message($msg);
throw new user_interaction_required_exception();
}
if ($this->installer_config->get_time_remaining() <= 0 || $this->installer_config->get_memory_remaining() <= 0) {
$this->installer_config->set('database_update_count', $progress_count);
$this->installer_config->set('database_update_migration_steps', $migration_step_count);
throw new resource_limit_reached_exception();
}
}
if ($original_version !== $this->config['version']) {
$this->log->add('admin', isset($this->user->data['user_id']) ? $this->user->data['user_id'] : ANONYMOUS, $this->user->ip, 'LOG_UPDATE_DATABASE', false, array($original_version, $this->config['version']));
}
$this->iohandler->add_success_message('INLINE_UPDATE_SUCCESSFUL');
$this->config->delete('version_update_from');
$this->cache->purge();
$this->config->increment('assets_version', 1);
}
示例4: run
/**
* {@inheritdoc}
*/
public function run()
{
$this->language->add_lang('migrator');
if (!isset($this->config['version_update_from'])) {
$this->config->set('version_update_from', $this->config['version']);
}
$original_version = $this->config['version_update_from'];
$this->migrator->set_output_handler(new log_wrapper_migrator_output_handler($this->language, new installer_migrator_output_handler($this->iohandler), $this->phpbb_root_path . 'store/migrations_' . time() . '.log', $this->filesystem));
$this->migrator->create_migrations_table();
$migrations = $this->extension_manager->get_finder()->core_path('phpbb/db/migration/data/')->extension_directory('/migrations')->get_classes();
$this->migrator->set_migrations($migrations);
$migration_count = count($this->migrator->get_migrations());
$this->iohandler->set_task_count($migration_count, true);
$progress_count = $this->installer_config->get('database_update_count', 0);
while (!$this->migrator->finished()) {
try {
$this->migrator->update();
$progress_count++;
$this->iohandler->set_progress('STAGE_UPDATE_DATABASE', $progress_count);
} catch (exception $e) {
$msg = $e->getParameters();
array_unshift($msg, $e->getMessage());
$this->iohandler->add_error_message($msg);
$this->iohandler->send_response();
throw new user_interaction_required_exception();
}
if ($this->installer_config->get_time_remaining() <= 0 || $this->installer_config->get_memory_remaining() <= 0) {
$this->installer_config->set('database_update_count', $progress_count);
throw new resource_limit_reached_exception();
}
}
if ($original_version !== $this->config['version']) {
$this->log->add('admin', isset($this->user->data['user_id']) ? $this->user->data['user_id'] : ANONYMOUS, $this->user->ip, 'LOG_UPDATE_DATABASE', false, array($original_version, $this->config['version']));
}
$this->iohandler->finish_progress('INLINE_UPDATE_SUCCESSFUL');
$this->iohandler->add_success_message('INLINE_UPDATE_SUCCESSFUL');
$this->config->delete('version_update_from');
$this->cache->purge();
$this->config->increment('assets_version', 1);
}
示例5: uninstall
/**
* {@inheritdoc}
*/
public function uninstall($module_id, $db)
{
$this->config->delete('board3_clock_src_' . $module_id);
return true;
}