Export watched threads (SMF)
authorTim Düsterhus <timwolla@bastelstu.be>
Sat, 14 Sep 2013 15:06:09 +0000 (17:06 +0200)
committerTim Düsterhus <timwolla@bastelstu.be>
Sat, 14 Sep 2013 15:06:09 +0000 (17:06 +0200)
files/lib/system/exporter/SMF2xExporter.class.php

index 681372a1aac710e72239c5d3150c5f3aa0587279..f8209b60096337e4d4206eaaa1795b4e26ea5a06 100644 (file)
@@ -92,9 +92,9 @@ class SMF2xExporter extends AbstractExporter {
                        'com.woltlab.wbb.board' => array(
                                /*'com.woltlab.wbb.acl',
                                'com.woltlab.wbb.attachment',
-                               'com.woltlab.wbb.poll',
+                               'com.woltlab.wbb.poll',*/
                                'com.woltlab.wbb.watchedThread',
-                               'com.woltlab.wbb.like'*/
+                               /*'com.woltlab.wbb.like'*/
                        ),
                        'com.woltlab.wcf.conversation' => array(
                                'com.woltlab.wcf.conversation.label'
@@ -166,9 +166,9 @@ class SMF2xExporter extends AbstractExporter {
                        $queue[] = 'com.woltlab.wbb.post';
                        
                        /*if (in_array('com.woltlab.wbb.acl', $this->selectedData)) $queue[] = 'com.woltlab.wbb.acl';
-                       if (in_array('com.woltlab.wbb.attachment', $this->selectedData)) $queue[] = 'com.woltlab.wbb.attachment';
+                       if (in_array('com.woltlab.wbb.attachment', $this->selectedData)) $queue[] = 'com.woltlab.wbb.attachment';*/
                        if (in_array('com.woltlab.wbb.watchedThread', $this->selectedData)) $queue[] = 'com.woltlab.wbb.watchedThread';
-                       if (in_array('com.woltlab.wbb.poll', $this->selectedData)) {
+                       /*if (in_array('com.woltlab.wbb.poll', $this->selectedData)) {
                                $queue[] = 'com.woltlab.wbb.poll';
                                $queue[] = 'com.woltlab.wbb.poll.option';
                                $queue[] = 'com.woltlab.wbb.poll.option.vote';
@@ -719,6 +719,39 @@ class SMF2xExporter extends AbstractExporter {
                }
        }
        
+       /**
+        * Counts watched threads.
+        */
+       public function countWatchedThreads() {
+               $sql = "SELECT  COUNT(*) AS count
+                       FROM    ".$this->databasePrefix."log_notify
+                       WHERE           id_topic <> ?
+                               AND     id_board = ?";
+               $statement = $this->database->prepareStatement($sql);
+               $statement->execute(array(0, 0));
+               $row = $statement->fetchArray();
+               return $row['count'];
+       }
+       
+       /**
+        * Exports watched threads.
+        */
+       public function exportWatchedThreads($offset, $limit) {
+               $sql = "SELECT          *
+                       FROM            ".$this->databasePrefix."log_notify
+                       WHERE                   id_topic <> ?
+                                       AND     id_board = ?
+                       ORDER BY        id_member ASC, id_topic ASC";
+               $statement = $this->database->prepareStatement($sql, $limit, $offset);
+               $statement->execute(array(0, 0));
+               while ($row = $statement->fetchArray()) {
+                       ImportHandler::getInstance()->getImporter('com.woltlab.wbb.watchedThread')->import(0, array(
+                               'objectID' => $row['id_topic'],
+                               'userID' => $row['id_member']
+                       ));
+               }
+       }
+       
        private static function fixBBCodes($message) {
                $message = str_replace(array(
                        '<br />',