|
|
@@ -0,0 +1,34 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+declare(strict_types=1);
|
|
|
+
|
|
|
+const EXTENSION_TYPE = 'sixshop-extension';
|
|
|
+
|
|
|
+$dir = __DIR__;
|
|
|
+while (!is_file($dir . '/vendor/composer/installed.php')) {
|
|
|
+ $parent = dirname($dir);
|
|
|
+ if ($parent === $dir) {
|
|
|
+ fwrite(STDERR, "Unable to locate vendor/composer/installed.php\n");
|
|
|
+ exit(1);
|
|
|
+ }
|
|
|
+ $dir = $parent;
|
|
|
+}
|
|
|
+$vendorDir = $dir . '/vendor';
|
|
|
+
|
|
|
+$installed = require $vendorDir . '/composer/installed.php';
|
|
|
+
|
|
|
+$installedSixShopExtensions = [
|
|
|
+ 'root' => [],
|
|
|
+ 'versions' => [],
|
|
|
+];
|
|
|
+$referenceMap = [];
|
|
|
+foreach ($installed['versions'] as $name => $package) {
|
|
|
+ if (isset($package['type']) && $package['type'] === EXTENSION_TYPE) {
|
|
|
+ $installedSixShopExtensions['versions'][$name] = $package;
|
|
|
+ $referenceMap[$name] = $package['reference'];
|
|
|
+ }
|
|
|
+}
|
|
|
+$installedSixShopExtensions['root']['reference'] = hash('md5', json_encode($referenceMap));
|
|
|
+
|
|
|
+$filePath = $vendorDir . '/composer/installedSixShop.php';
|
|
|
+file_put_contents($filePath, '<?php return ' . var_export($installedSixShopExtensions, true) . ';');
|