Verzeichnisstruktur phpBB-3.0.0


Veröffentlicht
12.12.2007

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

merge_attachment_tables.php

Zuletzt modifiziert: 09.10.2024, 12:50 - Dateigröße: 2.27 KiB


 01  <?php
 02  // -------------------------------------------------------------
 03  //
 04  // $Id$
 05  //
 06  // FILENAME  : merge_attachment_tables.php
 07  // STARTED   : Tue Nov 04, 2003
 08  // COPYRIGHT : � 2001, 2003 phpBB Group
 09  // WWW       : http://www.phpbb.com/
 10  // LICENCE   : GPL vs2.0 [ see /docs/COPYING ] 
 11  // 
 12  // -------------------------------------------------------------
 13   
 14  //
 15  // Security message:
 16  //
 17  // This script is potentially dangerous.
 18  // Remove or comment the next line (die(".... ) to enable this script.
 19  // Do NOT FORGET to either remove this script or disable it after you have used it.
 20  //
 21  die("Please read the first lines of this script for instructions on how to enable it");
 22   
 23  $db = $dbhost = $dbuser = $dbpasswd = $dbport = $dbname = '';
 24   
 25  define('IN_PHPBB', 1);
 26  define('ANONYMOUS', 1);
 27  $phpEx = substr(strrchr(__FILE__, '.'), 1);
 28  $phpbb_root_path='./../';
 29  include($phpbb_root_path . 'config.'.$phpEx);
 30  require($phpbb_root_path . 'includes/acm/acm_' . $acm_type . '.'.$phpEx);
 31  require($phpbb_root_path . 'includes/db/' . $dbms . '.'.$phpEx);
 32  include($phpbb_root_path . 'includes/functions.'.$phpEx);
 33   
 34  $cache        = new acm();
 35  $db            = new sql_db();
 36   
 37  // Connect to DB
 38  $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false);
 39   
 40  // Rename the attachments table... 
 41  $sql = "RENAME TABLE {$table_prefix}attachments TO {$table_prefix}attach_temp";
 42  $db->sql_query($sql);
 43   
 44  $sql = "CREATE TABLE {$table_prefix}attachments 
 45      SELECT d.*, a.post_id, a.user_id_from as poster_id, p.topic_id
 46          FROM {$table_prefix}attach_desc d, {$table_prefix}attach_temp a, {$table_prefix}posts p
 47          WHERE a.attach_id = d.attach_id
 48              AND a.post_id = p.post_id";
 49  $db->sql_query($sql);
 50   
 51  switch ($db->sql_layer)
 52  {
 53      case 'mysql':
 54      case 'mysql4':
 55          $sql = 'ALTER TABLE ' . $table_prefix . 'attachments 
 56              ADD PRIMARY KEY (attach_id), 
 57              ADD INDEX filetime (filetime),
 58              ADD INDEX post_id (post_id),
 59              ADD INDEX poster_id (poster_id),
 60              ADD INDEX physical_filename (physical_filename(10)),
 61              ADD INDEX filesize (filesize),
 62              ADD INDEX topic_id (topic_id),
 63              MODIFY COLUMN attach_id mediumint(8) UNSIGNED NOT NULL auto_increment';
 64          break;
 65   
 66      case 'mssql':
 67      case 'mssql-odbc':
 68      case 'msaccess':
 69          break;
 70   
 71      case 'postgresql':
 72          break;
 73  }
 74  $db->sql_query($sql);
 75   
 76  //$db->sql_query("DROP TABLE {$table_prefix}attach_temp");
 77   
 78  echo "<p><b>Done</b></p>\n";
 79   
 80  ?>