Skip to content

Commit

Permalink
fix: matching posts also needs table prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
imorland committed Aug 2, 2023
1 parent 3c07d2e commit cbec0d1
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/Repositories/FileRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,11 +287,7 @@ public function downloadedEntry(File $file, DownloadCommand $command)

public function matchFilesForPost(Post $post): void
{
$prfx = (new File())->getConnection()->getTablePrefix();
$table = (new File())->getTable();

// join the prefix to the table name (if it exists)
$table = $prfx.$table;
$table = $this->getTable();

$db = (new File())->getConnection();

Expand All @@ -312,7 +308,7 @@ public function matchFilesForPost(Post $post): void

public function matchPosts(): int
{
$table = (new File())->getTable();
$table = $this->getTable();
$db = (new File())->getConnection();

$changes = 0;
Expand Down Expand Up @@ -369,4 +365,17 @@ public function cleanUp(Carbon $before, callable $confirm = null): int

return $count;
}

protected function getTable(): string
{
$file = new File();

$prfx = $file->getConnection()->getTablePrefix();
$table = $file->getTable();

// join the prefix to the table name (if it exists)
$table = $prfx.$table;

return $table;
}
}

0 comments on commit cbec0d1

Please sign in to comment.