This repository was archived by the owner on Aug 10, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ #!/usr/bin/env php
2+ <?php
3+ /**
4+ * Script used to generate hashes for release packages
5+ *
6+ * Usage: php build/hash_generator.php
7+ *
8+ * @package Joomla.Plugin
9+ * @subpackage Installer.webinstaller
10+ *
11+ * @copyright Copyright (C) 2013 - 2018 Open Source Matters, Inc. All rights reserved.
12+ * @license GNU General Public License version 2 or later; see LICENSE
13+ */
14+
15+ $ packageDir = __DIR__ . '/packages ' ;
16+
17+ $ hashes = array ();
18+
19+ /** @var DirectoryIterator $file */
20+ foreach (new DirectoryIterator ($ packageDir ) as $ file )
21+ {
22+ if ($ file ->isDir () || $ file ->isDot ())
23+ {
24+ continue ;
25+ }
26+
27+ $ hashes [$ file ->getFilename ()] = array (
28+ 'sha256 ' => hash_file ('sha256 ' , $ file ->getPathname ()),
29+ 'sha384 ' => hash_file ('sha384 ' , $ file ->getPathname ()),
30+ 'sha512 ' => hash_file ('sha512 ' , $ file ->getPathname ()),
31+ );
32+ }
33+
34+ $ jsonOptions = PHP_VERSION_ID >= 50400 ? JSON_PRETTY_PRINT : 0 ;
35+
36+ @file_put_contents ($ packageDir . '/checksums.json ' , json_encode ($ hashes , $ jsonOptions ));
37+
38+ echo 'Checksums file generated ' . PHP_EOL . PHP_EOL ;
You can’t perform that action at this time.
0 commit comments