summaryrefslogtreecommitdiff
path: root/tools/import_rules.php
diff options
context:
space:
mode:
authorAppleman1234 <applemansigloo@gmail.com>2016-12-15 18:25:42 +0900
committerGitHub <noreply@github.com>2016-12-15 18:25:42 +0900
commitcae526e65a20f3da2d8884c4d8e8978c54120000 (patch)
tree2954153dd49f616f5018490058ff4bfbd17300d3 /tools/import_rules.php
parentb58fab98147a92c8e6d22f15d23684508b6bb811 (diff)
parent5feae402cb55d49963bfd2c6f5a33d10690ecbc1 (diff)
Merge pull request #79 from lainchan/clean_prod_vichan_update
Merge vichan changes from upstream and changes directly applied to the site.
Diffstat (limited to 'tools/import_rules.php')
-rw-r--r--tools/import_rules.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/import_rules.php b/tools/import_rules.php
new file mode 100644
index 00000000..f583f035
--- /dev/null
+++ b/tools/import_rules.php
@@ -0,0 +1,16 @@
+<?php
+// This script imports rules.txt files from the old system into the new ``pages`` table.
+
+require dirname(__FILE__) . '/inc/cli.php';
+
+$boards = listBoards(TRUE);
+
+foreach ($boards as $i => $b) {
+ $rules = @file_get_contents($b.'/rules.txt');
+ if ($rules && !empty(trim($rules))) {
+ $query = prepare('INSERT INTO ``pages``(name, title, type, board, content) VALUES("rules", "Rules", "html", :board, :content)');
+ $query->bindValue(':board', $b);
+ $query->bindValue(':content', $rules);
+ $query->execute() or error(db_error($query));
+ }
+}