Skip to content

Commit 16068cd

Browse files
committed
Add duplicate manifest check, fixes #3
1 parent 906de48 commit 16068cd

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/Commands/Publish.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public function run(array $params)
1515
{
1616
helper('inflector');
1717
$manifests = Services::manifests();
18+
$hashes = [];
1819

1920
$count = 0;
2021
foreach ($manifests->locate() as $path)
@@ -25,6 +26,13 @@ public function run(array $params)
2526
$this->displayMessages($manifests->getMessages());
2627
continue;
2728
}
29+
30+
// Check for duplicates
31+
$hash = md5_file($path);
32+
if (isset($hashes[$hash]))
33+
{
34+
continue;
35+
}
2836

2937
if (! $manifests->publish($manifest))
3038
{
@@ -33,6 +41,7 @@ public function run(array $params)
3341
continue;
3442
}
3543

44+
$hashes[$hash] = true;
3645
CLI::write('Published ' . basename($path));
3746
$count++;
3847
}

0 commit comments

Comments
 (0)