mirror of
https://git.tt-rss.org/fox/tt-rss.git
synced 2025-08-06 14:17:27 +02:00
rename article mark/publish hooks
This commit is contained in:
parent
dc6ea08ca4
commit
b30f8c93a0
@ -285,10 +285,10 @@ class API extends Handler {
|
||||
$sth->execute([...$article_ids, $_SESSION['uid']]);
|
||||
|
||||
if ($field == 'marked')
|
||||
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_ARTICLES_MARKED, $article_ids);
|
||||
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_ARTICLES_MARK_TOGGLED, $article_ids);
|
||||
|
||||
if ($field == 'published')
|
||||
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_ARTICLES_PUBLISHED, $article_ids);
|
||||
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_ARTICLES_PUBLISH_TOGGLED, $article_ids);
|
||||
|
||||
$num_updated = $sth->rowCount();
|
||||
|
||||
|
@ -98,7 +98,7 @@ class Article extends Handler_Protected {
|
||||
int_id = ? AND owner_uid = ?");
|
||||
$sth->execute([$int_id, $owner_uid]);
|
||||
|
||||
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_ARTICLES_PUBLISHED, [$ref_id]);
|
||||
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_ARTICLES_PUBLISH_TOGGLED, [$ref_id]);
|
||||
|
||||
} else {
|
||||
|
||||
@ -109,7 +109,7 @@ class Article extends Handler_Protected {
|
||||
(?, '', NULL, NULL, ?, true, '', '', NOW(), '', false, NOW())");
|
||||
$sth->execute([$ref_id, $owner_uid]);
|
||||
|
||||
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_ARTICLES_PUBLISHED, [$ref_id]);
|
||||
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_ARTICLES_PUBLISH_TOGGLED, [$ref_id]);
|
||||
}
|
||||
|
||||
if (count($labels) != 0) {
|
||||
@ -148,7 +148,7 @@ class Article extends Handler_Protected {
|
||||
(?, '', NULL, NULL, ?, true, '', '', NOW(), '', false, NOW())");
|
||||
$sth->execute([$ref_id, $owner_uid]);
|
||||
|
||||
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_ARTICLES_PUBLISHED, [$ref_id]);
|
||||
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_ARTICLES_PUBLISH_TOGGLED, [$ref_id]);
|
||||
|
||||
if (count($labels) != 0) {
|
||||
foreach ($labels as $label) {
|
||||
|
@ -714,22 +714,25 @@ abstract class Plugin {
|
||||
}
|
||||
|
||||
/** Invoked after passed article IDs were either marked (i.e. starred) or unmarked.
|
||||
*
|
||||
* **Note** resulting state of the articles is not passed to this function (because
|
||||
* tt-rss may do invert operation on ID range), you will need to get this from the database.
|
||||
* @param array<int> $article_ids ref_ids
|
||||
* @return void
|
||||
*/
|
||||
function hook_articles_marked(array $article_ids) {
|
||||
function hook_articles_mark_toggled(array $article_ids) {
|
||||
user_error("Dummy method invoked.", E_USER_ERROR);
|
||||
}
|
||||
|
||||
/** Invoked after passed article IDs were either published or unpublished.
|
||||
*
|
||||
* **Note** resulting state of the articles is not passed to this function (because
|
||||
* tt-rss may do invert operation on ID range), you will need to get this from the database.
|
||||
*
|
||||
* @param array<int> $article_ids ref_ids
|
||||
* @return void
|
||||
*/
|
||||
function hook_articles_published(array $article_ids) {
|
||||
function hook_articles_publish_toggled(array $article_ids) {
|
||||
user_error("Dummy method invoked.", E_USER_ERROR);
|
||||
}
|
||||
}
|
||||
|
@ -202,11 +202,11 @@ class PluginHost {
|
||||
/** @see Plugin::hook_validate_session() */
|
||||
const HOOK_VALIDATE_SESSION = "hook_validate_session";
|
||||
|
||||
/** @see Plugin::hook_articles_marked() */
|
||||
const HOOK_ARTICLES_MARKED = "hook_articles_marked";
|
||||
/** @see Plugin::hook_articles_mark_toggled() */
|
||||
const HOOK_ARTICLES_MARK_TOGGLED = "hook_articles_mark_toggled";
|
||||
|
||||
/** @see Plugin::hook_articles_published() */
|
||||
const HOOK_ARTICLES_PUBLISHED = "hook_articles_published";
|
||||
/** @see Plugin::hook_articles_publish_toggled() */
|
||||
const HOOK_ARTICLES_PUBLISH_TOGGLED = "hook_articles_publish_toggled";
|
||||
|
||||
const KIND_ALL = 1;
|
||||
const KIND_SYSTEM = 2;
|
||||
|
@ -69,7 +69,7 @@ class RPC extends Handler_Protected {
|
||||
|
||||
$sth->execute([$mark, $id, $_SESSION['uid']]);
|
||||
|
||||
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_ARTICLES_MARKED, [$id]);
|
||||
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_ARTICLES_MARK_TOGGLED, [$id]);
|
||||
|
||||
print json_encode(array("message" => "UPDATE_COUNTERS"));
|
||||
}
|
||||
@ -95,7 +95,7 @@ class RPC extends Handler_Protected {
|
||||
|
||||
$sth->execute([$pub, $id, $_SESSION['uid']]);
|
||||
|
||||
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_ARTICLES_PUBLISHED, [$id]);
|
||||
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_ARTICLES_PUBLISH_TOGGLED, [$id]);
|
||||
|
||||
print json_encode(array("message" => "UPDATE_COUNTERS"));
|
||||
}
|
||||
@ -273,7 +273,7 @@ class RPC extends Handler_Protected {
|
||||
|
||||
$sth->execute([...$ids, $_SESSION['uid']]);
|
||||
|
||||
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_ARTICLES_MARKED, $ids);
|
||||
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_ARTICLES_MARK_TOGGLED, $ids);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -299,7 +299,7 @@ class RPC extends Handler_Protected {
|
||||
|
||||
$sth->execute([...$ids, $_SESSION['uid']]);
|
||||
|
||||
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_ARTICLES_PUBLISHED, $ids);
|
||||
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_ARTICLES_PUBLISH_TOGGLED, $ids);
|
||||
}
|
||||
|
||||
function log(): void {
|
||||
|
@ -1126,10 +1126,10 @@ class RSSUtils {
|
||||
$published, $score]);
|
||||
|
||||
if ($marked)
|
||||
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_ARTICLES_MARKED, [$ref_id]);
|
||||
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_ARTICLES_MARK_TOGGLED, [$ref_id]);
|
||||
|
||||
if ($published)
|
||||
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_ARTICLES_PUBLISHED, [$ref_id]);
|
||||
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_ARTICLES_PUBLISH_TOGGLED, [$ref_id]);
|
||||
|
||||
$sth = $pdo->prepare("SELECT int_id FROM ttrss_user_entries WHERE
|
||||
ref_id = ? AND owner_uid = ? AND
|
||||
|
Loading…
Reference in New Issue
Block a user