从 couchbase 到 MySql 的 Drupal cronjob 不工作

Drupal cronjob from couchbase to MySql not working

我正在尝试使用 Drupal cronjob

执行从 Couchbase 服务器到 MySql 的同步

我正在尝试将文档从 Couchbase 同步到 MySql,但我做不到 上述操作是通过 cronjob (Drupal)

function drupal_cron()
 {
   $cluster = new CouchbaseCluster("couchbase://localhost");
   $cluster->authenticateAs('Admin', 'password');
   $bucket = $cluster->openBucket("default");
   $query = CouchbaseViewQuery::from('drupal', 'id')->reduce(false)->order(CouchbaseViewQuery::ORDER_DESCENDING);
   var_dump($query); // getting data till here
   $results = $bucket->query($query); // not going past this
   var_dump($results); // no data here
   foreach($results->rows as $row) //not going in the foreach loop because no data in $results
     { 
      $doc_id = $row->id;
      $doc = $bucket->get($doc_id);

      // $doc = json_decode($doc->value);

      $doc = $doc->value;
      if ($doc->drupal_status == 'pending')
        {
          sync_code_here
        }
   }
 }

var_dump($query)

的输出
object(Couchbase\ViewQuery)#108 (3) 
{ 
  ["designDocumentName"]=> string(8) "drupal"
  ["viewName"]=> string(2) "id"
  ["options"]=> array(2)
    {
      ["reduce"]=> string(5) "false"
      ["descending"]=> string(4) "true"
    }
 }

请帮忙

我该如何解决这个问题?

我需要在 Couchbase Server 中创建一个名为 "Drupal" 的新设计文档和一个名为 "id" 的新视图来匹配和验证此

 $query = CouchbaseViewQuery::from('drupal', 'id')->reduce(false)->order(CouchbaseViewQuery::ORDER_DESCENDING);

在那之后,它就像一个魅力。