Fix prefix (fix #3)

pull/37/head
Varun Patil 2022-08-17 23:56:14 +00:00
parent 68b28ed2ec
commit 833ce737b7
1 changed files with 18 additions and 18 deletions

View File

@ -81,7 +81,7 @@ class Util {
// Check if need to update // Check if need to update
$sql = 'SELECT COUNT(*) as e $sql = 'SELECT COUNT(*) as e
FROM oc_polaroid FROM *PREFIX*polaroid
WHERE file_id = ? AND user_id = ? AND mtime = ? AND timeline = ?'; WHERE file_id = ? AND user_id = ? AND mtime = ? AND timeline = ?';
$exists = $this->connection->executeQuery($sql, [ $exists = $this->connection->executeQuery($sql, [
$fileId, $user, $mtime, $timeline, $fileId, $user, $mtime, $timeline,
@ -98,7 +98,7 @@ class Util {
$dateTaken = gmdate('Y-m-d H:i:s', $dateTaken); $dateTaken = gmdate('Y-m-d H:i:s', $dateTaken);
$sql = 'INSERT $sql = 'INSERT
INTO oc_polaroid (day_id, date_taken, is_video, timeline, mtime, user_id, file_id) INTO *PREFIX*polaroid (day_id, date_taken, is_video, timeline, mtime, user_id, file_id)
VALUES (?, ?, ?, ?, ?, ?, ?) VALUES (?, ?, ?, ?, ?, ?, ?)
ON DUPLICATE KEY UPDATE ON DUPLICATE KEY UPDATE
day_id = ?, date_taken = ?, is_video = ?, timeline = ?, mtime = ?'; day_id = ?, date_taken = ?, is_video = ?, timeline = ?, mtime = ?';
@ -115,7 +115,7 @@ class Util {
public function deleteFile(File $file) { public function deleteFile(File $file) {
$sql = 'DELETE $sql = 'DELETE
FROM oc_polaroid FROM *PREFIX*polaroid
WHERE file_id = ?'; WHERE file_id = ?';
$this->connection->executeStatement($sql, [$file->getId()], [\PDO::PARAM_INT]); $this->connection->executeStatement($sql, [$file->getId()], [\PDO::PARAM_INT]);
} }
@ -132,7 +132,7 @@ class Util {
string $user, string $user,
): array { ): array {
$sql = 'SELECT day_id, COUNT(file_id) AS count $sql = 'SELECT day_id, COUNT(file_id) AS count
FROM `oc_polaroid` FROM `*PREFIX*polaroid`
WHERE user_id=? WHERE user_id=?
GROUP BY day_id GROUP BY day_id
ORDER BY day_id DESC'; ORDER BY day_id DESC';
@ -144,10 +144,10 @@ class Util {
public function getDaysFolder(int $folderId) { public function getDaysFolder(int $folderId) {
$sql = 'SELECT day_id, COUNT(file_id) AS count $sql = 'SELECT day_id, COUNT(file_id) AS count
FROM `oc_polaroid` FROM `*PREFIX*polaroid`
INNER JOIN `oc_filecache` INNER JOIN `*PREFIX*filecache`
ON `oc_polaroid`.`file_id` = `oc_filecache`.`fileid` ON `*PREFIX*polaroid`.`file_id` = `*PREFIX*filecache`.`fileid`
AND (`oc_filecache`.`parent`=? OR `oc_filecache`.`fileid`=?) AND (`*PREFIX*filecache`.`parent`=? OR `*PREFIX*filecache`.`fileid`=?)
GROUP BY day_id GROUP BY day_id
ORDER BY day_id DESC'; ORDER BY day_id DESC';
$rows = $this->connection->executeQuery($sql, [$folderId, $folderId], [ $rows = $this->connection->executeQuery($sql, [$folderId, $folderId], [
@ -171,10 +171,10 @@ class Util {
string $user, string $user,
int $dayId, int $dayId,
): array { ): array {
$sql = 'SELECT file_id, oc_filecache.etag, is_video $sql = 'SELECT file_id, *PREFIX*filecache.etag, is_video
FROM oc_polaroid FROM *PREFIX*polaroid
LEFT JOIN oc_filecache LEFT JOIN *PREFIX*filecache
ON oc_filecache.fileid = oc_polaroid.file_id ON *PREFIX*filecache.fileid = *PREFIX*polaroid.file_id
WHERE user_id = ? AND day_id = ? WHERE user_id = ? AND day_id = ?
ORDER BY date_taken DESC'; ORDER BY date_taken DESC';
$rows = $this->connection->executeQuery($sql, [$user, $dayId], [ $rows = $this->connection->executeQuery($sql, [$user, $dayId], [
@ -187,12 +187,12 @@ class Util {
int $folderId, int $folderId,
int $dayId, int $dayId,
): array { ): array {
$sql = 'SELECT file_id, oc_filecache.etag, is_video $sql = 'SELECT file_id, *PREFIX*filecache.etag, is_video
FROM `oc_polaroid` FROM `*PREFIX*polaroid`
INNER JOIN `oc_filecache` INNER JOIN `*PREFIX*filecache`
ON `oc_polaroid`.`day_id`=? ON `*PREFIX*polaroid`.`day_id`=?
AND `oc_polaroid`.`file_id` = `oc_filecache`.`fileid` AND `*PREFIX*polaroid`.`file_id` = `*PREFIX*filecache`.`fileid`
AND (`oc_filecache`.`parent`=? OR `oc_filecache`.`fileid`=?);'; AND (`*PREFIX*filecache`.`parent`=? OR `*PREFIX*filecache`.`fileid`=?);';
$rows = $this->connection->executeQuery($sql, [$dayId, $folderId, $folderId], [ $rows = $this->connection->executeQuery($sql, [$dayId, $folderId, $folderId], [
\PDO::PARAM_INT, \PDO::PARAM_INT, \PDO::PARAM_INT, \PDO::PARAM_INT, \PDO::PARAM_INT, \PDO::PARAM_INT,
])->fetchAll(); ])->fetchAll();