Пример #1
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();
     }
 }
 protected function load_tweet($id = null)
 {
     if (!$id) {
         $id = $this->GetData('id');
     }
     $object = Tweet::find_by_id($id);
     if ($object) {
         return $object;
     } else {
         throw new Error404('Unable to find Tweet');
     }
 }