/**
  * 将文章和评论内容同步到多说,用于以前的评论显示和垃圾评论过滤
  */
 public function export()
 {
     global $dsql;
     @set_time_limit(0);
     @ini_set('memory_limit', '256M');
     @ini_set('display_errors', $this->getOption('debug'));
     $progress = $this->getOption('synchronized');
     if (!$progress || is_numeric($progress)) {
         //	之前已经完成了导出流程
         $progress = 'thread/0';
     }
     list($type, $offset) = explode('/', $progress);
     try {
         switch ($type) {
             case 'thread':
                 $limit = 10;
                 $dsql->SetQuery("SELECT aid FROM `#@__feedback` where `aid` > {$offset} group by aid order by aid asc limit {$limit}");
                 $dsql->Execute();
                 $aidArray = array();
                 while ($row = $dsql->GetArray()) {
                     $aidArray[] = $row['aid'];
                 }
                 if (count($aidArray) > 0) {
                     $aids = implode(',', $aidArray);
                     $dsql->SetQuery("SELECT * FROM `#@__archives` where `id` in ({$aids})");
                     $dsql->Execute();
                     $threads = array();
                     while ($row = $dsql->GetArray()) {
                         $arc = new Archives($row['id']);
                         $arc->Fields['arcurl'] = $arc->GetTrueUrl(null);
                         $threads[] = $arc->Fields;
                     }
                     $count = $this->exportThreads($threads);
                     $maxid = $aidArray[count($aidArray) - 1];
                 } else {
                     $count = 0;
                 }
                 break;
             case 'post':
                 $limit = 50;
                 $dsql->SetQuery("SELECT cid FROM `duoshuo_commentmeta` group by cid");
                 $dsql->Execute();
                 $cidFromDuoshuo = array();
                 while ($row = $dsql->GetArray()) {
                     $cidFromDuoshuo[] = $row['cid'];
                 }
                 $dsql->SetQuery("SELECT * FROM `#@__feedback` order by id asc limit {$offset},{$limit} ");
                 $dsql->Execute();
                 $comments = array();
                 while ($row = $dsql->GetArray()) {
                     $comments[] = $row;
                 }
                 $count = $this->exportPosts($comments, $cidFromDuoshuo);
                 break;
             default:
         }
         if ($count == $limit) {
             switch ($type) {
                 case 'thread':
                     $progress = $type . '/' . $maxid;
                     break;
                 case 'post':
                     $progress = $type . '/' . ($offset + $limit);
                     break;
             }
         } elseif ($type == 'thread') {
             $progress = 'post/0';
         } elseif ($type == 'post') {
             $progress = time();
         }
         $this->updateOption('synchronized', $progress);
         $response = array('progress' => $progress, 'code' => 0);
         return $response;
     } catch (Duoshuo_Exception $e) {
         $this->updateOption('synchronized', $progress);
         $this->sendException($e);
     }
 }