Show
Ignore:
Timestamp:
11/03/07 18:55:26 (6 years ago)
Author:
d0nut
Message:

updated tagging reloaded mainteance function

Files:
1 moved

Legend:

Unmodified
Added
Removed
  • taggingreloaded/optionals/de.easy-coding.wbb.taggingreloaded/files/lib/acp/action/UpdateTaggingReloadedAction.class.php

    r68 r77  
    1616        public $everything = true; 
    1717         
    18         protected function buildQuery() { 
     18        /** 
     19         * 
     20         * @param count 
     21         */ 
     22        protected function buildQuery($count=false) { 
    1923                if($this->everything) { 
    20                         $sql = "SELECT          postID, 
     24                        $columns = "            postID, 
    2125                                                threadID,  
    22                                                 message 
     26                                                message"; 
     27                         
     28                        $sql = "SELECT          ".($count?'COUNT(*) AS count':$columns)." 
    2329                                FROM            wbb".WBB_N."_post 
    2430                                ORDER BY        threadID ASC, 
     
    2733                                OFFSET          ".($this->limit * $this->loop); 
    2834                } else { 
    29                         $sql = "SELECT          p2.postID, 
     35                        $columns = "            p2.postID, 
    3036                                                p2.threadID,  
    31                                                 p2.message 
     37                                                p2.message"; 
     38 
     39                        $sql = "SELECT          ".($count?'COUNT(*) AS count':$columns)." 
    3240                                FROM            wbb".WBB_N."_post p 
    3341                                JOIN            wbb".WBB_N."_thread t 
     
    3745                                WHERE           p.systemTagged = 0 
    3846                                ORDER BY        p2.threadID ASC, 
    39                                                 p2.postID DESC"; 
     47                                                p2.postID DESC 
     48                                LIMIT           ".$this->limit." 
     49                                OFFSET          ".($this->limit * $this->loop); 
    4050                } 
    4151                 
     
    5060                $threadIDs = array(); 
    5161                $systemTaggerUserID = -1; 
     62                $text = ''; 
     63                 
     64                // count board 
     65                $sql = $this->buildQuery(true); 
     66                $row = WCF::getDB()->getFirstRow($sql); 
     67                $count = $row['count']; 
    5268                 
    5369                // get all posts 
     
    5975                                $threadID = $row['threadID']; 
    6076                                $threadIDs[] = $threadID; 
    61  
    6277                                $msg = TaggingReloadedUtil::bbcode2text($row['message']); 
    6378                                $text .= $msg; 
     
    6681                                $tags = TaggingReloadedUtil::text2tags($text); 
    6782                                $first_post = $row['postID']; 
    68                                  
     83 
    6984                                // CLEANUP system tags 
    7085                                $sql = "DELETE FROM     wbb".WBB_N."_taggingreloaded,  
    7186                                                        wcf".WCF_N."_taggingreloaded 
    72                                         USING           wbb".WBB_N."_taggingreloaded wbb 
    73                                         NATURAL JOIN    wcf".WCF_N."_taggingreloaded wcf 
    74                                         JOIN            wbb".WBB_N."_post p 
    75                                         ON              wbb.postID = p.postID 
    76                                         WHERE           userID = {$systemTaggerUserID} 
    77                                         AND             p.threadID = {$threadID};"; 
     87                                        USING           wbb".WBB_N."_taggingreloaded 
     88                                        NATURAL JOIN    wcf".WCF_N."_taggingreloaded 
     89                                        JOIN            wbb".WBB_N."_post 
     90                                        ON              wbb".WBB_N."_taggingreloaded.postID = wbb".WBB_N."_post.postID 
     91                                        WHERE           wcf".WCF_N."_taggingreloaded.userID = {$systemTaggerUserID} 
     92                                        AND             wbb".WBB_N."_post.threadID = {$threadID};"; 
    7893 
    79                                 WBBCore::getDB()->sendQuery($sql); 
    80  
     94                                WCF::getDB()->sendQuery($sql); 
    8195                                if(count($tags) > 0) { 
    8296                                        $sql = "SELECT          taggingID 
     
    94108                                                        VALUES          ({$first_post});"; 
    95109 
    96                                                 WBBCore::getDB()->sendQuery($sql); 
     110                                                WCF::getDB()->sendQuery($sql); 
    97111                                                $taggingID = WBBCore::getDB()->getInsertID(); 
    98112                                        } 
     
    109123                                        systemTagged = 1  
    110124                        WHERE           threadID IN (".implode(',', $threadIDs)."); "; 
    111                 WBBCore::getDB()->sendQuery($sql); 
     125                WCF::getDB()->sendQuery($sql); 
    112126 
    113127                $this->executed(); 
     128 
     129                if($this->everything) { 
    114130                 
    115                 if($this->everything) { 
    116131                        $this->calcProgress(($this->limit * $this->loop), $count); 
    117132                        $this->nextLoop();