当前位置: 首页>>代码示例>>PHP>>正文


PHP config::delete方法代码示例

本文整理汇总了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);
 }
开发者ID:phpbb,项目名称:phpbb-core,代码行数:14,代码来源:config.php

示例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);
     }
 }
开发者ID:phpbb,项目名称:phpbb,代码行数:33,代码来源:upload_test.php

示例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);
 }
开发者ID:phpbb,项目名称:phpbb-core,代码行数:61,代码来源:update.php

示例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);
 }
开发者ID:hybiepoo,项目名称:phpbb,代码行数:43,代码来源:update.php

示例5: uninstall

 /**
  * {@inheritdoc}
  */
 public function uninstall($module_id, $db)
 {
     $this->config->delete('board3_clock_src_' . $module_id);
     return true;
 }
开发者ID:alhitary,项目名称:Board3-Portal,代码行数:8,代码来源:clock.php


注:本文中的phpbb\config\config::delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。