Changeset 1487

Show
Ignore:
Timestamp:
08/14/11 16:34:02 (22 months ago)
Author:
Torben Brodt
Message:

cure failcount

Location:
twitter
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • twitter/files/lib/system/cronjob/TwitterUpdateJob.class.php

    r1339 r1487  
    1616         */ 
    1717        public function execute($data) { 
     18 
     19                // with every run decreaes fail count 
     20                $sql = "UPDATE          wcf".WCF_N."_twitter_feed 
     21                        SET             failcount = failcount - 1 
     22                        WHERE           failcount > 0"; 
     23                WCF::getDB()->sendQuery($sql); 
     24 
     25                // get active feeds 
    1826                $sql = "SELECT          * 
    1927                        FROM            wcf".WCF_N."_twitter_feed ti 
    2028                        INNER JOIN      wcf".WCF_N."_twitter_account ta ON ti.accountID = ta.accountID 
    2129                        INNER JOIN      wcf".WCF_N."_user_to_twitter utt ON utt.accountID = ta.accountID 
    22                         WHERE           ti.failcount < 5"; 
     30                        WHERE           ti.failcount < 4"; 
    2331                $result = WCF::getDB()->sendQuery($sql); 
    2432                $i = 0; 
     
    2836                } 
    2937 
    30                 // try to active system user feeds 
     38                // try to activate system user feeds 
    3139                if($i == 0) { 
    3240                        $user = $this->getSystemUser(); 
    3341                        if($user) { 
    34                                 $sql = "INSERT INTO 
     42                                $sql = "INSERT IGNORE INTO 
    3543                                                        wcf".WCF_N."_twitter_feed 
    3644                                                        (accountID, action) 
    3745                                        VALUES          (".intval($user['accountID']).", 'user_timeline'), 
    38                                                         (".intval($user['accountID']).", 'mentions') 
    39                                         ON DUPLICATE KEY UPDATE 
    40                                                         failcount = IF(failcount > 1, failcount - 1, 0)"; 
     46                                                        (".intval($user['accountID']).", 'mentions')"; 
    4147                                $result = WCF::getDB()->sendQuery($sql); 
    4248                        } 
     
    106112                        // increase fail count and stop 
    107113                        $sql = 'UPDATE  wcf'.WCF_N.'_twitter_feed 
    108                                 SET     failcount = failcount + 1 
     114                                SET     failcount = failcount + 3 
    109115                                WHERE   feedID = '.intval($me['feedID']); 
    110116                        WCF::getDB()->sendQuery($sql); 
     
    137143                        $sql = 'UPDATE  wcf'.WCF_N.'_twitter_feed 
    138144                                SET     since_id = '.intval($maxid + 1).', 
    139                                         failcount = IF(failcount > 1, failcount - 1, 0) 
     145                                        failcount = 0 
     146                                WHERE   feedID = '.intval($me['feedID']); 
     147                        WCF::getDB()->sendQuery($sql); 
     148                } 
     149                 
     150                else if($me['failcount']) { 
     151 
     152                        // reset fail count, if everything is ok 
     153                        $sql = 'UPDATE  wcf'.WCF_N.'_twitter_feed 
     154                                SET     failcount = 0 
    140155                                WHERE   feedID = '.intval($me['feedID']); 
    141156                        WCF::getDB()->sendQuery($sql); 
  • twitter/package.xml

    r1458 r1487  
    44                <packagename><![CDATA[Twitter (WCF)]]></packagename> 
    55                <packagedescription><![CDATA[Twitter is a service for friends, family, and co–workers to communicate and stay connected through the exchange of quick, frequent answers to one simple question: What are you doing?]]></packagedescription> 
    6                 <version>2.3.0</version> 
     6                <version>2.3.1</version> 
    77                <date>DATE</date> 
    88                <isunique>1</isunique> 
     
    4242                <languages languagecode="de-informal">de.xml</languages> 
    4343                <languages languagecode="en">en.xml</languages> 
     44        </instructions> 
     45        <instructions type="update" fromversion="2.3.0"> 
     46                <files>files.tar</files> 
    4447        </instructions> 
    4548        <instructions type="update" fromversion="2.2.3">