本文整理汇总了PHP中comments::remoteSerialize方法的典型用法代码示例。如果您正苦于以下问题:PHP comments::remoteSerialize方法的具体用法?PHP comments::remoteSerialize怎么用?PHP comments::remoteSerialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类comments
的用法示例。
在下文中一共展示了comments::remoteSerialize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: runJob
//.........这里部分代码省略.........
$id = $cObj->add($story);
// update comments table with new contentids
$cObj->updateCommentsTable($data[contentid], $id);
if ($data[date] > $lastItemTime) {
$lastItemTime = $data[date];
}
echo 'story added' . $id . '<br><br/>';
}
$this->db->update("cronJobs", "lastItemTime='{$lastItemTime}'", "id={$job->id}");
}
break;
case 'syncComments':
// bring comments from stories in this cloud from NewsCloud over to remote site
require_once 'content.class.php';
$cObj = new content($this->db);
$idList = $cObj->fetchRecentStoryList(14, 99, true);
$this->db->log('syncComments - stories to check for.', PATH_SYNCLOGFILE);
$this->db->log($idList, PATH_SYNCLOGFILE);
if ($idList != '') {
require_once 'comments.class.php';
$commentsObj = new comments($this->db);
require_once 'apiCloud.class.php';
$apiObj = new apiCloud($this->db, $this->apiKey);
$result = $apiObj->syncComments($this->cloudid, $idList, $this->timeStrToUnixModB($job->lastItemTime));
$itemlist = $result[items];
$this->db->log($itemlist, PATH_SYNCLOGFILE);
// update comment thread for each story
if (count($itemlist) > 0) {
$lastItemTime = date('Y-m-d H:i:s', time() - 6 * 30 * 24 * 3600);
// set to six months earlier
foreach ($itemlist as $data) {
$temp = 'Bring over contentid' . $data[contentid] . ' Commentid' . $data[commentid] . '<br />';
// to do: if external story, then check for local userid and set here
$comment = $commentsObj->remoteSerialize($data);
if ($data[date] > $lastItemTime) {
$lastItemTime = $data[date];
}
$id = $commentsObj->add($comment);
echo $temp . '<br />';
var_dump($comment);
$this->db->log($temp, PATH_SYNCLOGFILE);
$this->db->log($comment, PATH_SYNCLOGFILE);
}
}
$this->db->update("cronJobs", "lastItemTime='{$lastItemTime}'", "id={$job->id}");
}
break;
case 'syncScores':
require_once 'content.class.php';
$cObj = new content($this->db);
$idList = $cObj->fetchRecentStoryList(14, 99, true);
if ($idList != '') {
require_once 'apiCloud.class.php';
$apiObj = new apiCloud($this->db, $this->apiKey);
$resp = $apiObj->syncScores($this->cloudid, $idList, $this->timeStrToUnixModB($job->lastStart));
$itemlist = $resp[items];
//var_dump($resp);
if (count($itemlist) > 0) {
// update the score for each story with new votes
foreach ($itemlist as $data) {
$this->db->update("Content", "score={$data['score']}", "contentid={$data['contentid']}");
$temp = 'Set score of contentid:' . $data[contentid] . 'to ' . $data[score];
echo $temp . '<br />';
$this->db->log($temp, PATH_SYNCLOGFILE);
}
}