Skip to content

Commit

Permalink
fix: refactor code to make it compatible with latest version of pumukit
Browse files Browse the repository at this point in the history
  • Loading branch information
Yurujai committed Oct 31, 2024
1 parent 44f4b1c commit 3e97556
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Services/ExpiredVideoDeleteService.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
use MongoDB\BSON\ObjectId;
use Pumukit\NotificationBundle\Services\SenderService;
use Pumukit\SchemaBundle\Document\Material;
use Pumukit\SchemaBundle\Document\MediaType\Track;
use Pumukit\SchemaBundle\Document\MultimediaObject;
use Pumukit\SchemaBundle\Document\Pic;
use Pumukit\SchemaBundle\Document\Series;
use Pumukit\SchemaBundle\Document\Track;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Finder\Finder;
use Symfony\Contracts\Translation\TranslatorInterface;
Expand Down Expand Up @@ -155,8 +155,8 @@ private function removeTracks(MultimediaObject $multimediaObject): void
foreach ($tracks as $track) {
if ($track instanceof Track) {
$isUsedOnAnotherMedia = $this->checkMedia($track);
if (!$isUsedOnAnotherMedia && $fileSystem->exists($track->getPath())) {
$this->removeFileFromDisk($track->getPath());
if (!$isUsedOnAnotherMedia && $fileSystem->exists($track->storage()->path()->path())) {
$this->removeFileFromDisk($track->storage()->path()->path());
}
}
}
Expand Down Expand Up @@ -195,7 +195,7 @@ private function removePics(MultimediaObject $multimediaObject): void
private function checkMedia(Track $track): bool
{
$multimediaObjects = $this->documentManager->getRepository(MultimediaObject::class)->findBy([
'tracks.path' => $track->getPath(),
'tracks.storage.path' => $track->storage()->path(),
]);

return count($multimediaObjects) > 1;
Expand Down

0 comments on commit 3e97556

Please sign in to comment.