@@ -89,9 +89,9 @@ public function getQueue()
8989 }
9090 if (\in_array ('dev.hanashi.wsdb.links.comment ' , $ this ->selectedData )) {
9191 $ queue [] = 'dev.hanashi.wsdb.links.comment ' ;
92- }
93- if ( \in_array ( 'dev.hanashi.wsdb.links.comment.response ' , $ this -> selectedData )) {
94- $ queue [] = ' dev.hanashi.wsdb.links.comment.response ' ;
92+ if ( \in_array ( ' dev.hanashi.wsdb.links.comment.response ' , $ this -> selectedData )) {
93+ $ queue [] = 'dev.hanashi.wsdb.links.comment.response ' ;
94+ }
9595 }
9696 }
9797 }
@@ -533,6 +533,118 @@ public function exportOptionValues(int $offset, int $limit): void
533533 }
534534 }
535535
536+ public function countComments (): int
537+ {
538+ $ objectType = ObjectTypeCache::getInstance ()->getObjectTypeByName (
539+ 'com.woltlab.wcf.comment.commentableContent ' ,
540+ 'de.pehbeh.links.linkEntryComment '
541+ );
542+ if ($ objectType === null ) {
543+ return 0 ;
544+ }
545+
546+ $ sql = "SELECT COUNT(*)
547+ FROM wcf1_comment
548+ WHERE objectTypeID = ? " ;
549+ $ statement = $ this ->database ->prepare ($ sql );
550+ $ statement ->execute ([$ objectType ->objectTypeID ]);
551+
552+ return $ statement ->fetchSingleColumn ();
553+ }
554+
555+ public function exportComments (int $ offset , int $ limit ): void
556+ {
557+ $ objectType = ObjectTypeCache::getInstance ()->getObjectTypeByName (
558+ 'com.woltlab.wcf.comment.commentableContent ' ,
559+ 'de.pehbeh.links.linkEntryComment '
560+ );
561+ if ($ objectType === null ) {
562+ return ;
563+ }
564+
565+ $ sql = "SELECT *
566+ FROM wcf1_comment
567+ WHERE objectTypeID = ?
568+ ORDER BY commentID " ;
569+ $ statement = $ this ->database ->prepare ($ sql , $ limit , $ offset );
570+ $ statement ->execute ([$ objectType ->objectTypeID ]);
571+ while ($ row = $ statement ->fetchArray ()) {
572+ $ data = [
573+ 'objectID ' => $ row ['objectID ' ],
574+ 'userID ' => $ row ['userID ' ],
575+ 'username ' => $ row ['username ' ],
576+ 'message ' => $ row ['message ' ],
577+ 'time ' => $ row ['time ' ],
578+ 'enableHtml ' => (isset ($ row ['enableHtml ' ])) ? $ row ['enableHtml ' ] : 0 ,
579+ 'isDisabled ' => (isset ($ row ['isDisabled ' ])) ? $ row ['isDisabled ' ] : 0 ,
580+ ];
581+
582+ ImportHandler::getInstance ()
583+ ->getImporter ('dev.hanashi.wsdb.links.comment ' )
584+ ->import ($ row ['commentID ' ], $ data );
585+ }
586+ }
587+
588+ public function countCommentResponses (): int
589+ {
590+ $ objectType = ObjectTypeCache::getInstance ()->getObjectTypeByName (
591+ 'com.woltlab.wcf.comment.commentableContent ' ,
592+ 'de.pehbeh.links.linkEntryComment '
593+ );
594+ if ($ objectType === null ) {
595+ return 0 ;
596+ }
597+
598+ $ sql = "SELECT COUNT(*) AS count
599+ FROM wcf1_comment_response
600+ WHERE commentID IN (
601+ SELECT commentID
602+ FROM wcf1_comment
603+ WHERE objectTypeID = ?
604+ ) " ;
605+ $ statement = $ this ->database ->prepare ($ sql );
606+ $ statement ->execute ([$ objectType ->objectTypeID ]);
607+
608+ return $ statement ->fetchSingleColumn ();
609+ }
610+
611+ public function exportCommentResponses (int $ offset , int $ limit ): void
612+ {
613+ $ objectType = ObjectTypeCache::getInstance ()->getObjectTypeByName (
614+ 'com.woltlab.wcf.comment.commentableContent ' ,
615+ 'de.pehbeh.links.linkEntryComment '
616+ );
617+ if ($ objectType === null ) {
618+ return ;
619+ }
620+
621+ $ sql = "SELECT *
622+ FROM wcf1_comment_response
623+ WHERE commentID IN (
624+ SELECT commentID
625+ FROM wcf1_comment
626+ WHERE objectTypeID = ?
627+ )
628+ ORDER BY responseID " ;
629+ $ statement = $ this ->database ->prepareUnmanaged ($ sql , $ limit , $ offset );
630+ $ statement ->execute ([$ objectType ->objectTypeID ]);
631+ while ($ row = $ statement ->fetchArray ()) {
632+ $ data = [
633+ 'commentID ' => $ row ['commentID ' ],
634+ 'time ' => $ row ['time ' ],
635+ 'userID ' => $ row ['userID ' ],
636+ 'username ' => $ row ['username ' ],
637+ 'message ' => $ row ['message ' ],
638+ 'enableHtml ' => (isset ($ row ['enableHtml ' ])) ? $ row ['enableHtml ' ] : 0 ,
639+ 'isDisabled ' => (isset ($ row ['isDisabled ' ])) ? $ row ['isDisabled ' ] : 0 ,
640+ ];
641+
642+ ImportHandler::getInstance ()
643+ ->getImporter ('dev.hanashi.wsdb.links.comment.response ' )
644+ ->import ($ row ['responseID ' ], $ data );
645+ }
646+ }
647+
536648 /**
537649 * @return array<int, string[]>
538650 */
0 commit comments