1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2025-01-24 23:13:49 +01:00
vichan/tools/import_rules.php

18 lines
556 B
PHP
Raw Normal View History

2015-03-29 09:18:14 +08:00
<?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');
2015-03-28 19:39:54 -07:00
echo "Processing board $b...\n";
2015-03-29 09:18:14 +08:00
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);
2015-03-28 19:39:54 -07:00
$query->execute();
2015-03-29 09:18:14 +08:00
}
}