Verzeichnisstruktur phpBB-3.1.0


Veröffentlicht
27.10.2014

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

      (Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

database_update.php

Zuletzt modifiziert: 09.10.2024, 12:51 - Dateigröße: 7.74 KiB


 001  <?php
 002  /**
 003  *
 004  * This file is part of the phpBB Forum Software package.
 005  *
 006  * @copyright (c) phpBB Limited <https://www.phpbb.com>
 007  * @license GNU General Public License, version 2 (GPL-2.0)
 008  *
 009  * For full copyright and license information, please see
 010  * the docs/CREDITS.txt file.
 011  *
 012  */
 013   
 014  $update_start_time = time();
 015   
 016  /**
 017  * @ignore
 018  */
 019  define('IN_PHPBB', true);
 020  define('IN_INSTALL', true);
 021  $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './../';
 022  $phpEx = substr(strrchr(__FILE__, '.'), 1);
 023   
 024  function phpbb_end_update($cache, $config)
 025  {
 026      $cache->purge();
 027   
 028      $config->increment('assets_version', 1);
 029   
 030  ?>
 031                                  </p>
 032                              </div>
 033                          </div>
 034                      <span class="corners-bottom"><span></span></span>
 035                  </div>
 036              </div>
 037          </div>
 038   
 039          <div id="page-footer">
 040              <div class="copyright">
 041                  Powered by <a href="https://www.phpbb.com/">phpBB</a>&reg; Forum Software &copy; phpBB Limited
 042              </div>
 043          </div>
 044      </div>
 045  </body>
 046  </html>
 047   
 048  <?php
 049   
 050      garbage_collection();
 051      exit_handler();
 052  }
 053   
 054  require($phpbb_root_path . 'includes/startup.' . $phpEx);
 055  require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx);
 056   
 057  $phpbb_class_loader = new \phpbb\class_loader('phpbb\\', "{$phpbb_root_path}phpbb/", $phpEx);
 058  $phpbb_class_loader->register();
 059   
 060  $phpbb_config_php_file = new \phpbb\config_php_file($phpbb_root_path, $phpEx);
 061  extract($phpbb_config_php_file->get_all());
 062   
 063  if (!defined('PHPBB_INSTALLED') || empty($dbms) || empty($acm_type))
 064  {
 065      die("Please read: <a href='../docs/INSTALL.html'>INSTALL.html</a> before attempting to update.");
 066  }
 067   
 068  // In case $phpbb_adm_relative_path is not set (in case of an update), use the default.
 069  $phpbb_adm_relative_path = (isset($phpbb_adm_relative_path)) ? $phpbb_adm_relative_path : 'adm/';
 070  $phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : $phpbb_root_path . $phpbb_adm_relative_path;
 071   
 072  // Include files
 073  require($phpbb_root_path . 'includes/functions.' . $phpEx);
 074  require($phpbb_root_path . 'includes/functions_content.' . $phpEx);
 075   
 076  require($phpbb_root_path . 'includes/constants.' . $phpEx);
 077  include($phpbb_root_path . 'includes/utf/utf_normalizer.' . $phpEx);
 078  require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
 079   
 080  // Set PHP error handler to ours
 081  set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler');
 082   
 083  // Set up container (must be done here because extensions table may not exist)
 084  $phpbb_container_builder = new \phpbb\di\container_builder($phpbb_config_php_file, $phpbb_root_path, $phpEx);
 085  $phpbb_container_builder->set_use_extensions(false);
 086  $phpbb_container_builder->set_use_kernel_pass(false);
 087  $phpbb_container_builder->set_dump_container(false);
 088  $phpbb_container = $phpbb_container_builder->get_container();
 089   
 090  // set up caching
 091  $cache = $phpbb_container->get('cache');
 092   
 093  // Instantiate some basic classes
 094  $phpbb_dispatcher = $phpbb_container->get('dispatcher');
 095  $request    = $phpbb_container->get('request');
 096  $user        = $phpbb_container->get('user');
 097  $auth        = $phpbb_container->get('auth');
 098  $db            = $phpbb_container->get('dbal.conn');
 099  $phpbb_log    = $phpbb_container->get('log');
 100   
 101  // make sure request_var uses this request instance
 102  request_var('', 0, false, false, $request); // "dependency injection" for a function
 103   
 104  // Grab global variables, re-cache if necessary
 105  $config = $phpbb_container->get('config');
 106  set_config(null, null, null, $config);
 107  set_config_count(null, null, null, $config);
 108   
 109  if (!isset($config['version_update_from']))
 110  {
 111      $config->set('version_update_from', $config['version']);
 112  }
 113   
 114  $orig_version = $config['version_update_from'];
 115   
 116  $user->add_lang(array('common', 'acp/common', 'install', 'migrator'));
 117   
 118  // Add own hook handler, if present. :o
 119  if (file_exists($phpbb_root_path . 'includes/hooks/index.' . $phpEx))
 120  {
 121      require($phpbb_root_path . 'includes/hooks/index.' . $phpEx);
 122      $phpbb_hook = new phpbb_hook(array('exit_handler', 'phpbb_user_session_handler', 'append_sid', array('template', 'display')));
 123   
 124      $phpbb_hook_finder = $phpbb_container->get('hook_finder');
 125      foreach ($phpbb_hook_finder->find() as $hook)
 126      {
 127          @include($phpbb_root_path . 'includes/hooks/' . $hook . '.' . $phpEx);
 128      }
 129  }
 130  else
 131  {
 132      $phpbb_hook = false;
 133  }
 134   
 135  header('Content-type: text/html; charset=UTF-8');
 136  ?>
 137  <!DOCTYPE html>
 138  <html dir="<?php echo $user->lang['DIRECTION']; ?>" lang="<?php echo $user->lang['USER_LANG']; ?>">
 139  <head>
 140  <meta charset="utf-8">
 141   
 142  <title><?php echo $user->lang['UPDATING_TO_LATEST_STABLE']; ?></title>
 143   
 144  <link href="<?php echo htmlspecialchars($phpbb_admin_path); ?>style/admin.css" rel="stylesheet" type="text/css" media="screen" />
 145   
 146  </head>
 147   
 148  <body>
 149      <div id="wrap">
 150          <div id="page-header">&nbsp;</div>
 151   
 152          <div id="page-body">
 153              <div id="acp">
 154                  <div class="panel">
 155                      <span class="corners-top"><span></span></span>
 156                          <div id="content">
 157                              <div id="main" class="install-body">
 158   
 159                                  <h1><?php echo $user->lang['UPDATING_TO_LATEST_STABLE']; ?></h1>
 160   
 161                                  <br />
 162   
 163                                  <p><?php echo $user->lang['DATABASE_TYPE']; ?> :: <strong><?php echo $db->get_sql_layer(); ?></strong><br />
 164                                  <?php echo $user->lang['PREVIOUS_VERSION']; ?> :: <strong><?php echo $config['version']; ?></strong><br />
 165   
 166  <?php
 167   
 168  define('IN_DB_UPDATE', true);
 169   
 170  /**
 171  * @todo mysql update?
 172  */
 173   
 174  // End startup code
 175   
 176  $migrator = $phpbb_container->get('migrator');
 177  $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'));
 178   
 179  $migrator->create_migrations_table();
 180   
 181  $phpbb_extension_manager = $phpbb_container->get('ext.manager');
 182   
 183  $migrations = $phpbb_extension_manager
 184      ->get_finder()
 185      ->core_path('phpbb/db/migration/data/')
 186      ->extension_directory('/migrations')
 187      ->get_classes();
 188   
 189  $migrator->set_migrations($migrations);
 190   
 191  // What is a safe limit of execution time? Half the max execution time should be safe.
 192  //  No more than 15 seconds so the user isn't sitting and waiting for a very long time
 193  $phpbb_ini = new \phpbb\php\ini();
 194  $safe_time_limit = min(15, ($phpbb_ini->get_int('max_execution_time') / 2));
 195   
 196  // While we're going to try limit this to half the max execution time,
 197  //  we want to try and take additional measures to prevent hitting the
 198  //  max execution time (if, say, one migration step takes much longer
 199  //  than the max execution time)
 200  @set_time_limit(0);
 201   
 202  while (!$migrator->finished())
 203  {
 204      try
 205      {
 206          $migrator->update();
 207      }
 208      catch (\phpbb\db\migration\exception $e)
 209      {
 210          echo $e->getLocalisedMessage($user);
 211   
 212          phpbb_end_update($cache, $config);
 213      }
 214   
 215      $state = array_merge(array(
 216              'migration_schema_done' => false,
 217              'migration_data_done'    => false,
 218          ),
 219          $migrator->last_run_migration['state']
 220      );
 221   
 222      // Are we approaching the time limit? If so we want to pause the update and continue after refreshing
 223      if ((time() - $update_start_time) >= $safe_time_limit)
 224      {
 225          echo '<br />' . $user->lang['DATABASE_UPDATE_NOT_COMPLETED'] . '<br /><br />';
 226          echo '<a href="' . append_sid($phpbb_root_path . 'install/database_update.' . $phpEx, 'type=' . $request->variable('type', 0) . '&amp;language=' . $request->variable('language', 'en')) . '" class="button1">' . $user->lang['DATABASE_UPDATE_CONTINUE'] . '</a>';
 227   
 228          phpbb_end_update($cache, $config);
 229      }
 230  }
 231   
 232  if ($orig_version != $config['version'])
 233  {
 234      add_log('admin', 'LOG_UPDATE_DATABASE', $orig_version, $config['version']);
 235  }
 236   
 237  echo $user->lang['DATABASE_UPDATE_COMPLETE'] . '<br />';
 238   
 239  if ($request->variable('type', 0))
 240  {
 241      echo $user->lang['INLINE_UPDATE_SUCCESSFUL'] . '<br /><br />';
 242      echo '<a href="' . append_sid($phpbb_root_path . 'install/index.' . $phpEx, 'mode=update&amp;sub=update_db&amp;language=' . $request->variable('language', 'en')) . '" class="button1">' . $user->lang['CONTINUE_UPDATE_NOW'] . '</a>';
 243  }
 244  else
 245  {
 246      echo '<div class="errorbox">' . $user->lang['UPDATE_FILES_NOTICE'] . '</div>';
 247      echo $user->lang['COMPLETE_LOGIN_TO_BOARD'];
 248  }
 249   
 250  $config->delete('version_update_from');
 251   
 252  phpbb_end_update($cache, $config);
 253