From 700d4c9cecf661f6c1154f30c889a94d94a6a23e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Mon, 21 Sep 2020 17:13:18 +0200 Subject: [PATCH] Do not import non-forum channels as boards (vB 5) --- .../system/exporter/VB5xExporter.class.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/files/lib/system/exporter/VB5xExporter.class.php b/files/lib/system/exporter/VB5xExporter.class.php index 1983346..ffda3d8 100644 --- a/files/lib/system/exporter/VB5xExporter.class.php +++ b/files/lib/system/exporter/VB5xExporter.class.php @@ -402,20 +402,35 @@ class VB5xExporter extends AbstractExporter { * @param integer $limit */ public function exportBoards(/** @noinspection PhpUnusedParameterInspection */$offset, $limit) { - $sql = "SELECT node.* + $sql = "SELECT node.*, channel.guid FROM ".$this->databasePrefix."node node INNER JOIN (SELECT contenttypeid FROM ".$this->databasePrefix."contenttype WHERE class = ?) x ON x.contenttypeid = node.contenttypeid + INNER JOIN ".$this->databasePrefix."channel channel + ON channel.nodeid = node.nodeid + ORDER BY nodeid"; $statement = $this->database->prepareStatement($sql); $statement->execute(['Channel']); + + $boardRoot = 0; while ($row = $statement->fetchArray()) { $this->boardCache[$row['parentid']][] = $row; + if ($row['guid'] === 'vbulletin-4ecbdf567f2c35.70389590') { + $boardRoot = $row['nodeid']; + } + } + + if ($boardRoot !== 0) { + // Pretend that the subforums of the boardRoot do not have a parent board. + foreach ($this->boardCache[$boardRoot] as $board) { + $board['parentid'] = 0; + } } - $this->exportBoardsRecursively(); + $this->exportBoardsRecursively($boardRoot); } /** -- 2.20.1