本文整理汇总了PHP中content::updateCommentsTable方法的典型用法代码示例。如果您正苦于以下问题:PHP content::updateCommentsTable方法的具体用法?PHP content::updateCommentsTable怎么用?PHP content::updateCommentsTable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类content
的用法示例。
在下文中一共展示了content::updateCommentsTable方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: runJob
//.........这里部分代码省略.........
$apiObj = new apiCloud($this->db, $this->apiKey);
// request server ask for log
$resp = $apiObj->requestSyncLog($this->cloudid, URL_HOME, $this->timeStrToUnixModB($job->lastStart));
// get result of log sync
$logResult = $resp[items][0][log];
require_once PATH_CORE . "/classes/log.class.php";
$logObj = new log($this->db);
// process results from sync operation
$result = $logObj->receive($logResult);
echo $result;
break;
case 'syncContent':
// bring content from NewsCloud for this cloud to the remote site
require_once 'apiCloud.class.php';
$apiObj = new apiCloud($this->db, $this->apiKey);
$resp = $apiObj->syncContent($this->cloudid, $this->timeStrToUnixModB($job->lastItemTime));
$itemlist = $resp[items];
if (count($itemlist) > 0) {
require_once 'content.class.php';
$cObj = new content($this->db);
// to do : set this to actual time
$lastItemTime = date('Y-m-d H:i:s', time() - 6 * 30 * 24 * 3600);
// set to six months earlier
foreach ($itemlist as $data) {
echo 'Contentid' . $data[contentid] . '<br />';
// to do: before we can do this below, we need to be syncing ncuid when new users register
// to do: get userid from ncUid
// lookup userid in user table where ncuid=submitbyid
// if not found make it 0
// to do: if external story, then check for local userid and set here
$story = $cObj->serialize($data[contentid], $data[title], $data[description], '', $data[webpage], $data[permalink], $data[submitbyid], $data[submit_member], $data[userid], $data[date], $data[avgrank], 0, $data[imageid]);
$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) {