Ejemplo n.º 1
0
 private function iterateSaveMessages()
 {
     $old = clone $this->state;
     $newest = intval($this->state->messages_newest);
     $stub = new Yammer_notice_stub();
     if ($newest) {
         $stub->whereAdd('id > ' . $newest);
     }
     $stub->limit(20);
     $stub->orderBy('id');
     $stub->find();
     if ($stub->N == 0) {
         common_log(LOG_INFO, "Finished saving Yammer messages; import complete!");
         $this->state->state = 'done';
     } else {
         while ($stub->fetch()) {
             $item = $stub->getData();
             $notice = $this->importer->importNotice($item);
             common_log(LOG_INFO, "Imported Yammer notice " . $item['id'] . " as {$notice->id}");
             $newest = $item['id'];
         }
         $this->state->messages_newest = $newest;
     }
     $this->state->modified = common_sql_now();
     $this->state->update($old);
     return true;
 }