mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-09-25 01:53:03 +02:00
Combine phpstan, cs-check, cs-fix into lint-php recipe; fix lint issues + test failures + duplicate detection bug
This commit is contained in:
+21
-8
@@ -43,13 +43,13 @@ class Database
|
||||
{
|
||||
// Add 'name' column to share_links if missing
|
||||
try {
|
||||
$this->pdo->exec("ALTER TABLE share_links ADD COLUMN name TEXT");
|
||||
$this->pdo->exec('ALTER TABLE share_links ADD COLUMN name TEXT');
|
||||
} catch (\PDOException $e) {
|
||||
// Column already exists — ignore
|
||||
}
|
||||
// Add 'locked_year' column to share_links if missing
|
||||
try {
|
||||
$this->pdo->exec("ALTER TABLE share_links ADD COLUMN locked_year INTEGER");
|
||||
$this->pdo->exec('ALTER TABLE share_links ADD COLUMN locked_year INTEGER');
|
||||
} catch (\PDOException $e) {
|
||||
// Column already exists — ignore
|
||||
}
|
||||
@@ -765,7 +765,7 @@ class Database
|
||||
*/
|
||||
public function getAllLanguages(): array
|
||||
{
|
||||
$stmt = $this->pdo->query("SELECT id, UPPER(SUBSTR(name,1,1)) || SUBSTR(name,2) as name, created_at FROM languages WHERE deleted_at IS NULL ORDER BY name");
|
||||
$stmt = $this->pdo->query('SELECT id, UPPER(SUBSTR(name,1,1)) || SUBSTR(name,2) as name, created_at FROM languages WHERE deleted_at IS NULL ORDER BY name');
|
||||
return $stmt->fetchAll();
|
||||
}
|
||||
|
||||
@@ -798,7 +798,9 @@ class Database
|
||||
$dedup = [];
|
||||
foreach ($langs as $l) {
|
||||
$g = $l['grp'];
|
||||
if (isset($seen[$g])) continue;
|
||||
if (isset($seen[$g])) {
|
||||
continue;
|
||||
}
|
||||
$seen[$g] = true;
|
||||
$dedup[] = [
|
||||
'id' => $l['id'],
|
||||
@@ -1100,6 +1102,7 @@ class Database
|
||||
JOIN thesis_authors ta2 ON ta2.thesis_id = t.id
|
||||
JOIN authors a2 ON a2.id = ta2.author_id
|
||||
WHERE t.year = ?
|
||||
AND t.deleted_at IS NULL
|
||||
AND LOWER(TRIM(a.name)) IN ({$ph})
|
||||
GROUP BY t.id"
|
||||
);
|
||||
@@ -2110,7 +2113,12 @@ class Database
|
||||
public function updateThesis(int $thesisId, array $data): void
|
||||
{
|
||||
require_once __DIR__ . '/Audit.php';
|
||||
Audit::log($this, Audit::actor(), 'UPDATE', 'theses', $thesisId,
|
||||
Audit::log(
|
||||
$this,
|
||||
Audit::actor(),
|
||||
'UPDATE',
|
||||
'theses',
|
||||
$thesisId,
|
||||
$this->fetchRow('theses', $thesisId)
|
||||
);
|
||||
|
||||
@@ -2225,8 +2233,8 @@ class Database
|
||||
!empty($data['subtitle']) ? $data['subtitle'] : null,
|
||||
(int)$data['year'],
|
||||
$orientation ? (int)$orientation : null,
|
||||
$ap ? (int)$ap : null,
|
||||
$finality ? (int)$finality : null,
|
||||
$ap ? (int)$ap : null,
|
||||
$finality ? (int)$finality : null,
|
||||
$data['synopsis'],
|
||||
!empty($data['context_note']) ? $data['context_note'] : null,
|
||||
!empty($data['baiu_link']) ? $data['baiu_link'] : null,
|
||||
@@ -2316,7 +2324,12 @@ class Database
|
||||
public function restoreThesis(int $thesisId): void
|
||||
{
|
||||
require_once __DIR__ . '/Audit.php';
|
||||
Audit::log($this, Audit::actor(), 'UPDATE', 'theses', $thesisId,
|
||||
Audit::log(
|
||||
$this,
|
||||
Audit::actor(),
|
||||
'UPDATE',
|
||||
'theses',
|
||||
$thesisId,
|
||||
$this->fetchRow('theses', $thesisId)
|
||||
);
|
||||
$this->pdo->prepare('UPDATE theses SET deleted_at = NULL WHERE id = ?')->execute([$thesisId]);
|
||||
|
||||
Reference in New Issue
Block a user