'com.woltlab.wbb.poll' => 'Polls',
'com.woltlab.wbb.poll.option.vote' => 'PollOptionVotes',
'com.woltlab.wbb.like' => 'Likes',
+ 'com.woltlab.gallery.category' => 'GalleryCategories',
+ 'com.woltlab.gallery.album' => 'GalleryAlbums',
+ 'com.woltlab.gallery.image' => 'GalleryImages',
];
/**
'com.woltlab.wcf.conversation' => [
'com.woltlab.wcf.conversation.attachment',
],
+ 'com.woltlab.gallery.image' => [
+ 'com.woltlab.gallery.category',
+ 'com.woltlab.gallery.album',
+ ],
];
}
\in_array('com.woltlab.wcf.user.avatar', $this->selectedData)
|| \in_array('com.woltlab.wbb.attachment', $this->selectedData)
|| \in_array('com.woltlab.wcf.conversation.attachment', $this->selectedData)
+ || \in_array('com.woltlab.gallery.image', $this->selectedData)
) {
if (empty($this->fileSystemPath) || !@\file_exists($this->fileSystemPath . 'conf_global.php')) {
return false;
}
}
+ // gallery
+ if (\in_array('com.woltlab.gallery.image', $this->selectedData)) {
+ if (\in_array('com.woltlab.gallery.category', $this->selectedData)) {
+ $queue[] = 'com.woltlab.gallery.category';
+ }
+ if (\in_array('com.woltlab.gallery.album', $this->selectedData)) {
+ $queue[] = 'com.woltlab.gallery.album';
+ }
+ $queue[] = 'com.woltlab.gallery.image';
+ }
+
return $queue;
}
}
}
+ /**
+ * Counts gallery categories.
+ */
+ public function countGalleryCategories()
+ {
+ $sql = "SELECT COUNT(*) AS count
+ FROM " . $this->databasePrefix . "gallery_categories";
+ $statement = $this->database->prepareStatement($sql);
+ $statement->execute();
+ $row = $statement->fetchArray();
+
+ return $row['count'];
+ }
+
+ /**
+ * Exports gallery categories.
+ *
+ * @param integer $offset
+ * @param integer $limit
+ */
+ public function exportGalleryCategories($offset, $limit)
+ {
+ $sql = "SELECT *
+ FROM " . $this->databasePrefix . "gallery_categories
+ ORDER BY category_id";
+ $statement = $this->database->prepareStatement($sql, $limit, $offset);
+ $statement->execute();
+ while ($row = $statement->fetchArray()) {
+ $data = [
+ 'title' => $row['category_name'],
+ 'description' => $row['category_description'],
+ 'parentCategoryID' => $row['category_parent_id'],
+ ];
+
+ ImportHandler::getInstance()
+ ->getImporter('com.woltlab.gallery.category')
+ ->import($row['category_id'], $data);
+ }
+ }
+
+ /**
+ * Counts gallery albums.
+ */
+ public function countGalleryAlbums()
+ {
+ return $this->__getMaxID($this->databasePrefix . "gallery_albums", 'album_id');
+ }
+
+ /**
+ * Exports gallery albums.
+ *
+ * @param integer $offset
+ * @param integer $limit
+ */
+ public function exportGalleryAlbums($offset, $limit)
+ {
+ $sql = "SELECT albums.*, members.name AS username
+ FROM " . $this->databasePrefix . "gallery_albums albums
+ LEFT JOIN " . $this->databasePrefix . "members members
+ ON members.member_id = albums.album_owner_id
+ WHERE albums.album_id BETWEEN ? AND ?
+ ORDER BY albums.album_id";
+ $statement = $this->database->prepareStatement($sql);
+ $statement->execute([$offset + 1, $offset + $limit]);
+ while ($row = $statement->fetchArray()) {
+ $data = [
+ 'userID' => $row['album_owner_id'],
+ 'username' => $row['username'] ?: '',
+ 'title' => $row['album_name'],
+ 'description' => StringUtil::stripHTML($row['album_description']),
+ 'lastUpdateTime' => $row['album_last_img_date'],
+ ];
+
+ ImportHandler::getInstance()
+ ->getImporter('com.woltlab.gallery.album')
+ ->import($row['album_id'], $data);
+ }
+ }
+
+ /**
+ * Counts gallery images.
+ */
+ public function countGalleryImages()
+ {
+ return $this->__getMaxID($this->databasePrefix . "gallery_images", 'image_id');
+ }
+
+ /**
+ * Exports gallery images.
+ *
+ * @param integer $offset
+ * @param integer $limit
+ */
+ public function exportGalleryImages($offset, $limit)
+ {
+ $sql = "SELECT images.*, members.name AS username
+ FROM " . $this->databasePrefix . "gallery_images images
+ LEFT JOIN " . $this->databasePrefix . "members members
+ ON members.member_id = images.image_member_id
+ WHERE image_id BETWEEN ? AND ?
+ ORDER BY image_id";
+ $statement = $this->database->prepareStatement($sql);
+ $statement->execute([$offset + 1, $offset + $limit]);
+ while ($row = $statement->fetchArray()) {
+ $fileLocation = $this->fileSystemPath . 'uploads/' . $row['image_directory'] . '/' . $row['image_masked_file_name'];
+ if (!\file_exists($fileLocation)) {
+ continue;
+ }
+
+ $data = [
+ 'userID' => $row['image_member_id'] ?: null,
+ 'username' => $row['username'] ?: '',
+ 'albumID' => $row['image_album_id'] ?: null,
+ 'title' => $row['image_caption'],
+ 'description' => self::fixMessage($row['image_description']),
+ 'filename' => $row['image_file_name'],
+ 'fileExtension' => \pathinfo($row['image_file_name'], \PATHINFO_EXTENSION),
+ 'views' => $row['image_views'],
+ 'uploadTime' => $row['image_date'],
+ 'creationTime' => $row['image_date'],
+ ];
+
+ $additionalData = [
+ 'fileLocation' => $fileLocation,
+ ];
+ $additionalData['categories'] = [$row['image_category_id']];
+
+ ImportHandler::getInstance()
+ ->getImporter('com.woltlab.gallery.image')
+ ->import(
+ $row['image_id'],
+ $data,
+ $additionalData
+ );
+ }
+ }
+
/**
* Returns the data of tags.
*