add feed cursor helper

This commit is contained in:
Jean-Christian Paul Denis 2023-05-13 00:11:39 +02:00
parent 46098a85a7
commit e95c267530
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951

View File

@ -116,7 +116,7 @@ class ZoneclearFeedServer
throw new Exception(__('No such ID')); throw new Exception(__('No such ID'));
} }
$cur->setField('feed_upddt', date('Y-m-d H:i:s')); $this->getFeedCursor($cur);
$cur->update(sprintf( $cur->update(sprintf(
"WHERE feed_id = %s AND blog_id = '%s' ", "WHERE feed_id = %s AND blog_id = '%s' ",
@ -150,9 +150,8 @@ class ZoneclearFeedServer
$cur->setField('feed_id', $this->getNextId()); $cur->setField('feed_id', $this->getNextId());
$cur->setField('blog_id', dcCore::app()->con->escapeStr((string) dcCore::app()->blog?->id)); $cur->setField('blog_id', dcCore::app()->con->escapeStr((string) dcCore::app()->blog?->id));
$cur->setField('feed_creadt', date('Y-m-d H:i:s')); $cur->setField('feed_creadt', date('Y-m-d H:i:s'));
$cur->setField('feed_upddt', date('Y-m-d H:i:s'));
//add getFeedCursor here $this->getFeedCursor($cur);
$cur->insert(); $cur->insert();
dcCore::app()->con->unlock(); dcCore::app()->con->unlock();
@ -171,6 +170,14 @@ class ZoneclearFeedServer
return $id; return $id;
} }
protected function getFeedCursor(Cursor $cur): void
{
if ($cur->isField('feed_get_tags')) {
$cur->setField('feed_get_tags', is_numeric($cur->getField('feed_get_tags')) ? (int) $cur->getField('feed_get_tags') : 0);
}
$cur->setField('feed_upddt', date('Y-m-d H:i:s'));
}
/** /**
* Quick enable / disable feed. * Quick enable / disable feed.
* *
@ -255,7 +262,7 @@ class ZoneclearFeedServer
My::META_PREFIX . 'id', My::META_PREFIX . 'id',
])); ]));
if (!is_null($post_id)) { if (!is_null($id)) {
$sql->and('post_id = ' . $id); $sql->and('post_id = ' . $id);
} }