Exemple #1
0
 /**
  * 从服务器pull评论到本地
  * 
  * @param array $input
  */
 public function sync_log($input = array())
 {
     $syncLock = $this->plugin->getOption('sync_lock');
     //检查是否正在同步评论 同步完成后该值会置0
     if ($syncLock && $syncLock > time() - 300) {
         //正在或5分钟内发生过写回但没置0
         $this->response = array('code' => Duoshuo_Exception::SUCCESS, 'response' => '同步中,请稍候');
         return;
     }
     try {
         $this->response['affected'] = $this->plugin->syncLog();
         $this->response['last_log_id'] = $this->plugin->getOption('last_log_id');
     } catch (Exception $ex) {
         //$this->plugin->updateOption('sync_lock', $ex->getLine());
     }
     $this->response['code'] = Duoshuo_Exception::SUCCESS;
 }