summaryrefslogtreecommitdiff
path: root/tools/import_rules.php
blob: f583f035fa079795ddf57a4bf7b44ede40cb5d54 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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));
	} 
}