Skip to content
This repository has been archived by the owner on Dec 20, 2024. It is now read-only.

Commit

Permalink
Fix compatibility with Flysystem 3
Browse files Browse the repository at this point in the history
  • Loading branch information
mzur committed Feb 16, 2022
1 parent 7de9e1a commit fee66e2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/Support/Import/ArchiveManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,11 @@ public function delete($token)
*/
public function prune()
{
$files = $this->disk->listContents();
$files = $this->disk->listContents('/');
$limit = Carbon::now()->subWeek()->getTimestamp();
foreach ($files as $metadata) {
if ($metadata['timestamp'] < $limit) {
$this->disk->delete($metadata['path']);
foreach ($files as $file) {
if ($file->lastModified() < $limit) {
$this->disk->delete($file->path());
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions tests/Support/Import/ArchiveManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function testStoreUserExportNotAllowed()
$this->assertFalse(true);
} catch (Exception $e) {
$this->assertStringContainsString('User imports are not allowed', $e->getMessage());
$this->assertEmpty(Storage::disk('test')->listContents());
$this->assertEmpty(Storage::disk('test')->listContents('/')->toArray());
}
}

Expand Down Expand Up @@ -83,7 +83,7 @@ public function testStoreLabelTreeExportNotAllowed()
$this->assertFalse(true);
} catch (Exception $e) {
$this->assertStringContainsString('Label tree imports are not allowed', $e->getMessage());
$this->assertEmpty(Storage::disk('test')->listContents());
$this->assertEmpty(Storage::disk('test')->listContents('/')->toArray());
}
}

Expand Down Expand Up @@ -113,7 +113,7 @@ public function testStoreVolumeExportNotAllowed()
$this->assertFalse(true);
} catch (Exception $e) {
$this->assertStringContainsString('Volume imports are not allowed', $e->getMessage());
$this->assertEmpty(Storage::disk('test')->listContents());
$this->assertEmpty(Storage::disk('test')->listContents('/')->toArray());
}
}

Expand Down Expand Up @@ -175,7 +175,7 @@ public function testPrune()

$manager = new ArchiveManager;
$token = $manager->store($file);
$path = Storage::disk('test')->getAdapter()->applyPathPrefix($token);
$path = storage_path("framework/testing/disks/test/{$token}");

$manager->prune();
$this->assertTrue($manager->has($token));
Expand Down

0 comments on commit fee66e2

Please sign in to comment.