public static function setUpBeforeClass() { if (!extension_loaded('apc')) { self::markTestSkipped('APC extension is not loaded'); } $php_ini = new \bantu\IniGetWrapper\IniGetWrapper(); if (!$php_ini->getBool('apc.enabled')) { self::markTestSkipped('APC is not enabled. Make sure apc.enabled=1 in php.ini'); } if (PHP_SAPI == 'cli' && !$php_ini->getBool('apc.enable_cli')) { self::markTestSkipped('APC is not enabled for CLI. Set apc.enable_cli=1 in php.ini'); } }
* @todo mysql update? */ // End startup code /* @var $migrator \phpbb\db\migrator */ $migrator = $phpbb_container->get('migrator'); /** @var \phpbb\filesystem\filesystem_interface $phpbb_filesystem */ $phpbb_filesystem = $phpbb_container->get('filesystem'); $migrator->set_output_handler(new \phpbb\db\log_wrapper_migrator_output_handler($user, new \phpbb\db\html_migrator_output_handler($user), $phpbb_root_path . 'store/migrations_' . time() . '.log', $phpbb_filesystem)); $migrator->create_migrations_table(); /* @var $phpbb_extension_manager \phpbb\extension\manager */ $phpbb_extension_manager = $phpbb_container->get('ext.manager'); $migrations = $phpbb_extension_manager->get_finder()->core_path('phpbb/db/migration/data/')->extension_directory('/migrations')->get_classes(); $migrator->set_migrations($migrations); // What is a safe limit of execution time? Half the max execution time should be safe. // No more than 15 seconds so the user isn't sitting and waiting for a very long time $phpbb_ini = new \bantu\IniGetWrapper\IniGetWrapper(); $safe_time_limit = min(15, $phpbb_ini->getNumeric('max_execution_time') / 2); // While we're going to try limit this to half the max execution time, // we want to try and take additional measures to prevent hitting the // max execution time (if, say, one migration step takes much longer // than the max execution time) @set_time_limit(0); while (!$migrator->finished()) { try { $migrator->update(); } catch (\phpbb\db\migration\exception $e) { echo $e->getLocalisedMessage($user); phpbb_end_update($cache, $config); } $state = array_merge(array('migration_schema_done' => false, 'migration_data_done' => false), $migrator->last_run_migration['state']); // Are we approaching the time limit? If so we want to pause the update and continue after refreshing