Assembla home | Assembla project page
 

Changeset 230

Show
Ignore:
Timestamp:
04/13/08 22:13:20 (7 months ago)
Author:
Slynderdale
Message:

More bug fixes, yay! Raised the usleep value in streams to be less resource intensive. Fixed Sed and Seen so they don't produce fatal errors if the database/queries is invalid.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Phergie/Driver/Streams.php

    r223 r230  
    196196                        $plugin->onTick(); 
    197197                    } 
    198                     usleep(1000); 
     198                    usleep(10000); 
    199199                } 
    200200            } 
  • trunk/Phergie/Plugin/Sed.php

    r223 r230  
    2727     * @return void 
    2828     */ 
    29     public function init() 
     29    public function onConnect() 
    3030    { 
    3131        try { 
     
    102102                ':offset' => $offset 
    103103            ); 
    104             $this->select->execute($params); 
    105             $log = $this->select->fetch(); 
     104 
     105            try { 
     106                $this->select->execute($params); 
     107                $log = $this->select->fetch(); 
     108            } catch (PDOException $e) { } 
    106109 
    107110            if ($log) { 
  • trunk/Phergie/Plugin/Seen.php

    r227 r230  
    6969     * @return void 
    7070     */ 
    71     public function init() 
     71    public function onConnect() 
    7272    { 
    7373        try { 
     
    187187        ); 
    188188 
    189         $this->search->execute($params); 
    190         $rows = $this->search->fetchAll(PDO::FETCH_ASSOC); 
     189        try { 
     190            $this->search->execute($params); 
     191            $rows = $this->search->fetchAll(PDO::FETCH_ASSOC); 
     192        } catch (PDOException $e) { } 
    191193 
    192194        if (count($rows) <= 0) { 
     
    249251        ); 
    250252 
    251         $this->seen->execute($params); 
    252         $row = $this->seen->fetch(PDO::FETCH_ASSOC); 
     253        try { 
     254            $this->seen->execute($params); 
     255            $row = $this->seen->fetch(PDO::FETCH_ASSOC); 
     256        } catch (PDOException $e) { } 
    253257 
    254258        // Send the last action if available 
     
    309313        ); 
    310314 
    311         $this->heard->execute($params); 
    312         $row = $this->heard->fetch(PDO::FETCH_ASSOC); 
     315        try { 
     316            $this->heard->execute($params); 
     317            $row = $this->heard->fetch(PDO::FETCH_ASSOC); 
     318        } catch (PDOException $e) { } 
    313319 
    314320        // Send the last action if available 
     
    375381        ); 
    376382 
    377         $this->willsee->execute($params); 
    378         $prediction = $this->willsee->fetchColumn(); 
     383        try { 
     384            $this->willsee->execute($params); 
     385            $prediction = $this->willsee->fetchColumn(); 
     386        } catch (PDOException $e) { } 
    379387 
    380388        // Return if no results are found 
     
    442450        ); 
    443451 
    444         $this->quote->execute($params); 
    445         $row = $this->quote->fetch(PDO::FETCH_ASSOC); 
     452        try { 
     453            $this->quote->execute($params); 
     454            $row = $this->quote->fetch(PDO::FETCH_ASSOC); 
     455        } catch (PDOException $e) { } 
    446456 
    447457        // Send the last action if available 
  • trunk/Phergie/Plugin/Url.php

    r228 r230  
    119119 
    120120    /** 
     121     * Initializes settings 
     122     * 
     123     * @return void 
     124     */ 
     125    public function onConnect() 
     126    { 
     127        // Get a list of valid TLDs 
     128        if (!is_array($this->tldList) || count($this->tldList) <= 6) { 
     129            if ($this->pluginLoaded('Tld')) { 
     130                $this->tldList = Phergie_Plugin_Tld::getTlds(); 
     131                if (is_array($this->tldList)) { 
     132                    $this->tldList = array_keys($this->tldList); 
     133                } 
     134            } 
     135            if (!is_array($this->tldList) || count($this->tldList) <= 0) { 
     136                $this->tldList = array('com', 'org', 'net', 'gov', 'us', 'uk'); 
     137            } 
     138            rsort($this->tldList); 
     139        } 
     140    } 
     141 
     142    /** 
    121143     * Checks an incoming message for the presence of a URL and, if one is 
    122144     * found, responds with its title if it is an HTML document and the 
     
    142164            $this->updateSetting('title_length', 'titleLength', true); 
    143165            $this->updateSetting('show_errors', 'showErrors'); 
    144             // Update the valid TLD list 
    145             $this->updateTldList(); 
    146166 
    147167            $responses = array(); 
     
    544564    } 
    545565 
    546     /** 
    547      * Updates the list of TLDs from the TLD plugin 
    548      * 
    549      * @return void 
    550      */ 
    551     protected function updateTldList() 
    552     { 
    553         // Get a list of valid TLDs 
    554         if (!is_array($this->tldList) || count($this->tldList) <= 6) { 
    555             if ($this->pluginLoaded('Tld')) { 
    556                 $this->tldList = Phergie_Plugin_Tld::getTlds(); 
    557                 if (is_array($this->tldList)) { 
    558                     $this->tldList = array_keys($this->tldList); 
    559                 } 
    560             } 
    561             if (!is_array($this->tldList) || count($this->tldList) <= 0) { 
    562                 $this->tldList = array('com', 'org', 'net', 'gov', 'us', 'uk'); 
    563             } 
    564             rsort($this->tldList); 
    565         } 
    566     } 
    567  
    568566    /* 
    569567     * Updates the given variable with the setting