forked from robrotheram/phpbb_to_flarum
-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathxenforo_fof_ignore_users.php
33 lines (23 loc) · 1.09 KB
/
xenforo_fof_ignore_users.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
require_once 'xenforo_connection.php';
echo '<h1>XenForo to Flarum Ignored Users</h1>';
$connection = new Database();
$exportDbConnection = $connection->connectExport();
$importDbConnection = $connection->connectImport();
echo '<h2>Importing Ignored Users</h2>';
echo "<p>This script requires the <a href='https://packagist.org/packages/fof/ignore-users'>fof/ignore-users</a> extension.</p>";
$result = $exportDbConnection->query('SELECT user_id, ignored_user_id FROM '.$connection->exportDBPrefix.'user_ignored');
$totalIgnores = $result->num_rows;
if ($totalIgnores) {
while ($row = $result->fetch_assoc()) {
$user_id = $row['user_id'];
$ignored_user_id = $row['ignored_user_id'];
$query = 'INSERT INTO '.$connection->importDBPrefix."ignored_user (user_id, ignored_user_id, ignored_at) VALUES ( $user_id, $ignored_user_id, CURDATE())";
$importDbConnection->query($query);
}
echo '<p><b>Success.</b> '.$totalIgnores.' ignores imported.</p>';
} else {
echo '<p>No ignore results found.</p>';
}
$exportDbConnection->close();
$importDbConnection->close();