diff options
author | hd2000 <hd2000@users.sourceforge.net> | 2001-03-07 18:54:38 +0000 |
---|---|---|
committer | hd2000 <hd2000@users.sourceforge.net> | 2001-03-07 18:54:38 +0000 |
commit | 012e64b3d214e8c6eae2cbb21cd9881f2e623dbe (patch) | |
tree | 4562e7103e16578d542a059bbfdf57a3848ab679 | |
parent | adbe70c23d2cc64d348a5fdd004e9d0fb668bb81 (diff) | |
download | forums-012e64b3d214e8c6eae2cbb21cd9881f2e623dbe.tar forums-012e64b3d214e8c6eae2cbb21cd9881f2e623dbe.tar.gz forums-012e64b3d214e8c6eae2cbb21cd9881f2e623dbe.tar.bz2 forums-012e64b3d214e8c6eae2cbb21cd9881f2e623dbe.tar.xz forums-012e64b3d214e8c6eae2cbb21cd9881f2e623dbe.zip |
Added del_backup_table function to delete the backup tables
git-svn-id: file:///svn/phpbb/trunk@85 89ea8834-ac86-4346-8a33-228a782c2dd0
-rw-r--r-- | phpBB/upgrade_20.php | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/phpBB/upgrade_20.php b/phpBB/upgrade_20.php index 094cc5dedd..4964cf68b1 100644 --- a/phpBB/upgrade_20.php +++ b/phpBB/upgrade_20.php @@ -61,6 +61,13 @@ function change_column($db, $table, $column, $type, $null) echo "<font color=\"#FF0000\">ERROR! count not change column $column from table $table. Reason: <b>" . mysql_error(). "</B></FONT>"; } +function del_backup_table($db, $table) +{ + $sql = "drop table $table"; + if (!$r = mysql_query($sql, $db)) + echo "<font color=\"#FF0000\">ERROR! could not delete table $table. Reason: <b>" . mysql_error(). "</B></FONT>"; +} + function add_column($db, $table, $column, $type, $null) { $sql = "alter table $table add $column $type $null"; @@ -110,6 +117,7 @@ if($next) echo "Backing up the $table_name table... <BR>"; $backup_name = $table_name . "_backup"; + $table_create = "CREATE TABLE $backup_name (\n"; $r = mysql_query("show fields from $table_name", $db); @@ -342,6 +350,7 @@ Backups completed ok.<P> $forum_id = $row['forum_id']; $poster_id = $row['poster_id']; $post_text = $row['post_text']; + $post_text = addslashes('$post_text'); $sql = "insert posts (post_id, topic_id, forum_id, poster_id, post_time, poster_ip) values ($post_id, $topic_id, $forum_id, $poster_id, $post_time, $post_ip)"; @@ -450,6 +459,27 @@ Backups completed ok.<P> } + echo "Delete the backup tables ..<br>"; + flush(); + + $tables = array("posts" , + "priv_msgs", + "sessions" , + "topics" , + "banlist" , + "config" , + "forums" , + "users" , + "access" , + "smiles" , + "words" , + "forum_mods"); + while (list(, $drop_table) = each($tables)) + { + $backup_name = $drop_table . '_backup'; + del_backup_table($db, $backup_name); + } + ?> All Done. <?php |