getTempStoragePath()); foreach ($users as $user) { $sessions = Storage::allDirectories($user); foreach ($sessions as $session) { $uploads = Storage::allDirectories($session); foreach ($uploads as $upload) { Log::channel('tracing')->info(basename($upload)); $basename = basename($upload); $video = StudioPlusVideo::where('video_url', 'LIKE', "%$basename%")->first(); if ($video) { Log::channel('tracing')->info('Inuse'); } else { Log::channel('tracing')->info('Can be safely deleted.'); Storage::deleteDirectory($upload); Log::channel('tracing')->info('Temp upload has been deleted.'); } Log::channel('tracing')->info('==========='); } } /*$object_name = Storage::get($file); $current_timestamp = Carbon::now()->timestamp; $timestamp = filemtime(storage_path("app/$file")); $time_passed = $current_timestamp - $timestamp; if ($time_passed > $this->expiration) { Log::channel('video-link-creation')->info("[Cleanup] Deleting $object_name"); $this->deleteTemporaryVideoLink($object_name); Storage::delete($file); Log::channel('video-link-creation')->info('[Cleanup] Deleted successfully.'); }*/ } } protected function getTempStoragePath() { return "CreatorStudio/temp/user"; } }