aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/develop
diff options
context:
space:
mode:
authorPaul S. Owen <psotfx@users.sourceforge.net>2001-09-07 00:23:40 +0000
committerPaul S. Owen <psotfx@users.sourceforge.net>2001-09-07 00:23:40 +0000
commit6695be87e82d294aa04d925b8ef880326b3352fb (patch)
treecbf16bb6aaa5dce4f0ff50339865c3073437b401 /phpBB/develop
parentda87531f2f1253d4f9ae5564f9aade2f2a0d04ad (diff)
downloadforums-6695be87e82d294aa04d925b8ef880326b3352fb.tar
forums-6695be87e82d294aa04d925b8ef880326b3352fb.tar.gz
forums-6695be87e82d294aa04d925b8ef880326b3352fb.tar.bz2
forums-6695be87e82d294aa04d925b8ef880326b3352fb.tar.xz
forums-6695be87e82d294aa04d925b8ef880326b3352fb.zip
Moved signature attach toggle to DB run convert_sig to update after adding new field to DB
git-svn-id: file:///svn/phpbb/trunk@998 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/develop')
-rw-r--r--phpBB/develop/convert_sigs.php81
1 files changed, 81 insertions, 0 deletions
diff --git a/phpBB/develop/convert_sigs.php b/phpBB/develop/convert_sigs.php
new file mode 100644
index 0000000000..0ba2f22304
--- /dev/null
+++ b/phpBB/develop/convert_sigs.php
@@ -0,0 +1,81 @@
+
+<?
+
+$phpbb_root_path = "../";
+
+include($phpbb_root_path . 'extension.inc');
+include($phpbb_root_path . 'config.'.$phpEx);
+include($phpbb_root_path . 'includes/constants.'.$phpEx);
+include($phpbb_root_path . 'includes/db.'.$phpEx);
+
+$sql = "SELECT post_id, post_text
+ FROM " . POSTS_TEXT_TABLE;
+if( $result = $db->sql_query($sql) )
+{
+ $rowset = $db->sql_fetchrowset($result);
+
+ $attach_sql = "";
+ $non_attach_sql = "";
+
+ for($i = 0; $i < count($rowset); $i++)
+ {
+ if( ereg("\[addsig]$", $rowset[$i]['post_text']))
+ {
+ if( $attach_sql != "" )
+ {
+ $attach_sql .= ", ";
+ }
+ $attach_sql .= $rowset[$i]['post_id'];
+
+ $sql = "UPDATE " . POSTS_TEXT_TABLE . "
+ SET post_text = '" . addslashes(preg_replace("/\[addsig\]/is", "", $rowset[$i]['post_text'])) . "'
+ WHERE post_id = " . $rowset[$i]['post_id'];
+ if( !$result = $db->sql_query($sql) )
+ {
+ die("Couldn't update post_text - " . $i);
+ }
+
+ }
+ else
+ {
+ if( $non_attach_sql != "" )
+ {
+ $non_attach_sql .= ", ";
+ }
+ $non_attach_sql .= $rowset[$i]['post_id'];
+ }
+ }
+
+ echo "<BR>";
+
+ if( $attach_sql != "" )
+ {
+ echo $sql = "UPDATE " . POSTS_TABLE . "
+ SET enable_sig = 1
+ WHERE post_id IN ($attach_sql)";
+ if( !$result = $db->sql_query($sql) )
+ {
+ die("Couldn't update post table attach_sig - ");
+ }
+ }
+
+ echo "<BR>";
+
+ if( $non_attach_sql != "" )
+ {
+ echo $sql = "UPDATE " . POSTS_TABLE . "
+ SET enable_sig = 0
+ WHERE post_id IN ($non_attach_sql)";
+ if( !$result = $db->sql_query($sql) )
+ {
+ die("Couldn't update post table non_attach_sig - ");
+ }
+ }
+
+}
+
+$db->sql_close();
+
+ echo "<BR><BR>COMPLETE<BR>";
+
+?>