@ -4,6 +4,7 @@
* See LICENSE and AUTHORS files for details */
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
declare(strict_types=1);
namespace JKingWeb\Arsse;
namespace JKingWeb\Arsse;
use JKingWeb\DrUUID\UUID;
use JKingWeb\DrUUID\UUID;
@ -280,7 +281,7 @@ class Database {
}
}
/** Renames a user
/** Renames a user
*
*
* This does not have an effect on their numeric ID, but has a cascading effect on many tables
* This does not have an effect on their numeric ID, but has a cascading effect on many tables
*/
*/
public function userRename(string $user, string $name): bool {
public function userRename(string $user, string $name): bool {
@ -337,7 +338,7 @@ class Database {
}
}
/** Retrieves any metadata associated with a user
/** Retrieves any metadata associated with a user
*
*
* @param string $user The user whose metadata is to be retrieved
* @param string $user The user whose metadata is to be retrieved
* @param bool $includeLarge Whether to include values which can be arbitrarily large text
* @param bool $includeLarge Whether to include values which can be arbitrarily large text
*/
*/
@ -855,8 +856,8 @@ class Database {
sum(case when \"read\" = 1 and hidden = 0 then 1 else 0 end) as marked
sum(case when \"read\" = 1 and hidden = 0 then 1 else 0 end) as marked
from arsse_marks group by subscription
from arsse_marks group by subscription
) as mark_stats on mark_stats.subscription = s.id",
) as mark_stats on mark_stats.subscription = s.id",
["str", "int"],
["str", "int"],
[$user, $folder]
[$user, $folder]
);
);
$q->setWhere("s.owner = ?", ["str"], [$user]);
$q->setWhere("s.owner = ?", ["str"], [$user]);
$nocase = $this->db->sqlToken("nocase");
$nocase = $this->db->sqlToken("nocase");
@ -1613,26 +1614,26 @@ class Database {
}
}
// ensure any used array-type context options contain at least one member
// ensure any used array-type context options contain at least one member
foreach ([
foreach ([
"articles",
"articles",
"editions",
"editions",
"subscriptions",
"subscriptions",
"folders",
"folders",
"foldersShallow",
"foldersShallow",
"labels",
"labels",
"labelNames",
"labelNames",
"tags",
"tags",
"tagNames",
"tagNames",
"searchTerms",
"searchTerms",
"titleTerms",
"titleTerms",
"authorTerms",
"authorTerms",
"annotationTerms",
"annotationTerms",
"modifiedRanges",
"modifiedRanges",
"markedRanges",
"markedRanges",
] as $m) {
] as $m) {
if ($context->$m() & & !$context->$m) {
if ($context->$m() & & !$context->$m) {
throw new Db\ExceptionInput("tooShort", ['field' => $m, 'action' => $this->caller(), 'min' => 1]);
throw new Db\ExceptionInput("tooShort", ['field' => $m, 'action' => $this->caller(), 'min' => 1]);
}
}
}
}
// next compute the context, supplying the query to manipulate directly
// next compute the context, supplying the query to manipulate directly
$this->articleFilter($context, $q);
$this->articleFilter($context, $q);
}
}
@ -1921,8 +1922,8 @@ class Database {
touched = 1
touched = 1
where
where
article in (select article from target_articles)
article in (select article from target_articles)
and subscription in (select distinct subscription from target_articles)",
and subscription in (select distinct subscription from target_articles)",
[$subq->getTypes(), "bool"],
[$subq->getTypes(), "bool"],
[$subq->getValues(), $data['read']]
[$subq->getValues(), $data['read']]
);
);
$this->db->prepare($q->getQuery(), $q->getTypes())->run($q->getValues());
$this->db->prepare($q->getQuery(), $q->getTypes())->run($q->getValues());
@ -1952,7 +1953,7 @@ class Database {
where
where
article in (select article from target_articles)
article in (select article from target_articles)
and subscription in (select distinct subscription from target_articles)",
and subscription in (select distinct subscription from target_articles)",
[$subq->getTypes(), $setTypes],
[$subq->getTypes(), $setTypes],
[$subq->getValues(), $setValues]
[$subq->getValues(), $setValues]
);
);
$this->db->prepare($q->getQuery(), $q->getTypes())->run($q->getValues());
$this->db->prepare($q->getQuery(), $q->getTypes())->run($q->getValues());