public function tweets($reload = false)
 {
     if ($reload || !$this->tweets_cache) {
         $id = mysql_real_escape_string($id);
         $this->tweets_cache = Tweet::find_all("twitter_accounts.id = '{$id}'");
     }
     return $this->tweets_cache;
 }
Пример #2
0
 public static function process($script = null)
 {
     $tweets = Tweet::find_all("tweets.publish_at <= NOW() AND (tweets.message_id IS NULL OR tweets.message_id = '')", 'tweets.publish_at ASC, tweets.id ASC');
     foreach ($tweets as $tweet) {
         $tweet = Tweet::find_by_id($tweet->id);
         if ($tweet->locked || $tweet->message_id) {
             continue;
         }
         $tweet->lock();
         if ($script) {
             $script->addlog("Posting [{$tweet}] {$tweet->message}");
         }
         $tweet->post($script);
         $tweet->unlock();
     }
 }