summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorAndrew Dolgov <fox@fakecake.org>2025-05-02 21:27:50 +0300
committerAndrew Dolgov <fox@fakecake.org>2025-05-02 21:27:50 +0300
commitb30f8c93a00ce1ae2c582ca4c7f1d5d8425220ee (patch)
tree59b05d952497b3fe832f17cee31c03c4b45ed0c4 /classes
parentdc6ea08ca490c889f4e85bd697e6bdffb95a22f4 (diff)
rename article mark/publish hooks
Diffstat (limited to 'classes')
-rw-r--r--classes/API.php4
-rw-r--r--classes/Article.php6
-rw-r--r--classes/Plugin.php7
-rw-r--r--classes/PluginHost.php8
-rw-r--r--classes/RPC.php8
-rw-r--r--classes/RSSUtils.php4
6 files changed, 20 insertions, 17 deletions
diff --git a/classes/API.php b/classes/API.php
index 83eaa22b8..6db05198a 100644
--- a/classes/API.php
+++ b/classes/API.php
@@ -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();
diff --git a/classes/Article.php b/classes/Article.php
index 6a3111892..c0d77123c 100644
--- a/classes/Article.php
+++ b/classes/Article.php
@@ -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) {
diff --git a/classes/Plugin.php b/classes/Plugin.php
index b66e2082c..3165d62f4 100644
--- a/classes/Plugin.php
+++ b/classes/Plugin.php
@@ -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);
}
}
diff --git a/classes/PluginHost.php b/classes/PluginHost.php
index 8bde8df3f..5cff4afcb 100644
--- a/classes/PluginHost.php
+++ b/classes/PluginHost.php
@@ -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;
diff --git a/classes/RPC.php b/classes/RPC.php
index 4d133c272..6ce2c12aa 100644
--- a/classes/RPC.php
+++ b/classes/RPC.php
@@ -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 {
diff --git a/classes/RSSUtils.php b/classes/RSSUtils.php
index eef0d8540..575a1eda1 100644
--- a/classes/RSSUtils.php
+++ b/classes/RSSUtils.php
@@ -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