Fix some deprecation errors in the phpBB 3.0.x exporter
authorAlexander Ebert <ebert@woltlab.com>
Mon, 5 Aug 2024 14:24:26 +0000 (16:24 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 5 Aug 2024 14:24:26 +0000 (16:24 +0200)
See da0939c253270dcdadb860813e6c425fa1f6aa03
See 2762fb61dc66b06e3557b6617a306f5cbbdb3cce

files/lib/system/exporter/PhpBB3xExporter.class.php

index 87b39c74d360972231035f66d896e96ce3ce0d44..cfc9309e9df86156ae35c648c9abaa2d9215b4f1 100644 (file)
@@ -382,7 +382,7 @@ final class PhpBB3xExporter extends AbstractExporter
             ];
 
             $additionalData = [
-                'groupIDs' => \explode(',', $row['groupIDs']),
+                'groupIDs' => \explode(',', $row['groupIDs'] ?: ''),
                 'languages' => [$row['user_lang']],
                 'options' => $options,
             ];
@@ -782,7 +782,7 @@ final class PhpBB3xExporter extends AbstractExporter
         $statement->execute([0]);
         while ($row = $statement->fetchArray()) {
             if (!$row['isDraft']) {
-                $participants = \explode(',', $row['participants']);
+                $participants = \explode(',', $row['participants'] ?: '');
                 $participants[] = $row['author_id'];
                 $conversationID = $this->getConversationID($row['root_level'] ?: $row['msg_id'], $participants);
 
@@ -795,7 +795,7 @@ final class PhpBB3xExporter extends AbstractExporter
                 'subject' => StringUtil::decodeHTML($row['message_subject']),
                 'time' => $row['message_time'],
                 'userID' => $row['author_id'],
-                'username' => StringUtil::decodeHTML($row['username']) ?: '',
+                'username' => StringUtil::decodeHTML($row['username'] ?: ''),
                 'isDraft' => $row['isDraft'],
             ];
 
@@ -880,14 +880,14 @@ final class PhpBB3xExporter extends AbstractExporter
         $statement = $this->database->prepareStatement($sql, $limit, $offset);
         $statement->execute([1, 0]);
         while ($row = $statement->fetchArray()) {
-            $participants = \explode(',', $row['participants']);
+            $participants = \explode(',', $row['participants'] ?: '');
             $participants[] = $row['author_id'];
             $conversationID = $this->getConversationID($row['root_level'] ?: $row['msg_id'], $participants);
 
             $data = [
                 'conversationID' => $conversationID,
                 'userID' => $row['author_id'],
-                'username' => StringUtil::decodeHTML($row['username']) ?: '',
+                'username' => StringUtil::decodeHTML($row['username'] ?: ''),
                 'message' => self::fixBBCodes(StringUtil::decodeHTML($row['message_text']), $row['bbcode_uid']),
                 'time' => $row['message_time'],
                 'attachments' => $row['attachments'],
@@ -937,16 +937,16 @@ final class PhpBB3xExporter extends AbstractExporter
         $statement = $this->database->prepareStatement($sql, $limit, $offset);
         $statement->execute();
         while ($row = $statement->fetchArray()) {
-            $participants = \explode(',', $row['participants']);
+            $participants = \explode(',', $row['participants'] ?: '');
             $participants[] = $row['author_id'];
             $conversationID = $this->getConversationID($row['root_level'] ?: $row['msg_id'], $participants);
 
-            $bcc = \explode(':', $row['bcc_address']);
+            $bcc = \explode(':', $row['bcc_address'] ?: '');
 
             $data = [
                 'conversationID' => $conversationID,
                 'participantID' => $row['user_id'],
-                'username' => StringUtil::decodeHTML($row['username']) ?: '',
+                'username' => StringUtil::decodeHTML($row['username'] ?: ''),
                 'hideConversation' => $row['pm_deleted'],
                 'isInvisible' => \in_array('u_' . $row['user_id'], $bcc) ? 1 : 0,
                 'lastVisitTime' => $row['pm_new'] ? 0 : $row['message_time'],
@@ -1091,7 +1091,7 @@ final class PhpBB3xExporter extends AbstractExporter
                 'topic' => StringUtil::decodeHTML($row['topic_title']),
                 'time' => $row['topic_time'],
                 'userID' => $row['topic_poster'],
-                'username' => $row['topic_first_poster_name'],
+                'username' => $row['topic_first_poster_name'] ?: '',
                 'views' => $row['topic_views'],
                 'isAnnouncement' => ($row['topic_type'] == self::TOPIC_TYPE_ANNOUCEMENT || $row['topic_type'] == self::TOPIC_TYPE_GLOBAL) ? 1 : 0,
                 'isSticky' => $row['topic_type'] == self::TOPIC_TYPE_STICKY ? 1 : 0,
@@ -1155,8 +1155,8 @@ final class PhpBB3xExporter extends AbstractExporter
             $data = [
                 'threadID' => $row['topic_id'],
                 'userID' => $row['poster_id'],
-                'username' => $row['post_username'] ?: (StringUtil::decodeHTML($row['username']) ?: ''),
-                'subject' => StringUtil::decodeHTML($row['post_subject']),
+                'username' => $row['post_username'] ?: StringUtil::decodeHTML($row['username'] ?: ''),
+                'subject' => StringUtil::decodeHTML($row['post_subject'] ?: ''),
                 'message' => self::fixBBCodes(StringUtil::decodeHTML($row['post_text']), $row['bbcode_uid']),
                 'time' => $row['post_time'],
                 'isDisabled' => $row['post_approved'] ? 0 : 1,
@@ -1517,8 +1517,14 @@ final class PhpBB3xExporter extends AbstractExporter
             'm_approve' => ['canEnableThread'],
             'm_chgposter' => [],
             'm_delete' => [
-                'canDeleteThread', 'canReadDeletedThread', 'canRestoreThread', 'canDeleteThreadCompletely',
-                'canDeletePost', 'canReadDeletedPost', 'canRestorePost', 'canDeletePostCompletely',
+                'canDeleteThread',
+                'canReadDeletedThread',
+                'canRestoreThread',
+                'canDeleteThreadCompletely',
+                'canDeletePost',
+                'canReadDeletedPost',
+                'canRestorePost',
+                'canDeletePostCompletely',
             ],
             'm_edit' => ['canEditPost'],
             'm_info' => [],