11<?php
22/**
3- * SigTool v1.0.0 (last modified: 2020.03.01 ).
3+ * SigTool v1.0.0 (last modified: 2020.03.07 ).
44 * Generates signatures for phpMussel using main.cvd and daily.cvd from ClamAV.
55 *
66 * Package location: GitHub <https://github.com/phpMussel/SigTool>.
@@ -15,7 +15,7 @@ class SigTool extends \Maikuolan\Common\YAML
1515 public $ Ver = '1.0.0 ' ;
1616
1717 /** Last modified date. */
18- public $ Modified = '2020.03.01 ' ;
18+ public $ Modified = '2020.03.07 ' ;
1919
2020 /** Script user agent. */
2121 public $ UA = 'SigTool v%s (https://github.com/phpMussel/SigTool) ' ;
@@ -412,6 +412,7 @@ public function fixPath($Path)
412412 echo $ L10N ['Done ' ] . sprintf ($ L10N ['Deleting ' ], $ Set );
413413 echo unlink ($ File ) ? $ L10N ['Done ' ] : $ L10N ['Failed ' ];
414414 }
415+
415416 /** Cleanup. */
416417 unset($ ThisFile , $ Files , $ Pad );
417418}
@@ -684,7 +685,7 @@ public function fixPath($Path)
684685 }
685686
686687 /** Helps to prevent "Compilation failed: number too big in {} quantifier ..." errors. */
687- if (preg_match ('/\{(?:\d{6,}|6[6-9]\d{3,}|65[6-9]\d{2,}|655[4-9]\d+|6553[6-9]),\} / ' , $ ThisLine )) {
688+ if (preg_match ('/\{(?:\d{6,}|6[6-9]\d{3,}|65[6-9]\d{2,}|655[4-9]\d+|6553[6-9])/ ' , $ ThisLine )) {
688689 continue ;
689690 }
690691
@@ -777,7 +778,7 @@ public function fixPath($Path)
777778 ], $ SigHex ));
778779
779780 /** Possible character range. */
780- $ CharRange = ['0 ' , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 'a ' , 'b ' , 'c ' , 'd ' , 'e ' , 'f ' ];
781+ $ CharRange = ['0 ' , ' 1 ' , ' 2 ' , ' 3 ' , ' 4 ' , ' 5 ' , ' 6 ' , ' 7 ' , ' 8 ' , ' 9 ' , 'a ' , 'b ' , 'c ' , 'd ' , 'e ' , 'f ' ];
781782
782783 /** Simplify all the (xx|xx|xx|xx...) stuff into something smaller and more readable. */
783784 foreach ($ CharRange as $ Char ) {
@@ -876,8 +877,10 @@ function ($Matches) use ($Char, $Length) {
876877 foreach ($ FileSets as $ FileSet => $ FileData ) {
877878 echo sprintf ($ L10N ['Writing ' ], $ FileSet );
878879 if (!empty ($ Meta [$ FileSet ]['Files ' ]['Checksum ' ][0 ]) && !empty ($ Meta [$ FileSet ]['Version ' ])) {
880+
879881 /** We use the format Y.z.B for signature file versioning. */
880882 $ Meta [$ FileSet ]['Version ' ] = date ('Y.z.B ' , time ());
883+
881884 $ Meta [$ FileSet ]['Files ' ]['Checksum ' ][0 ] = hash ('sha256 ' , $ FileData ) . ': ' . strlen ($ FileData );
882885 }
883886 file_put_contents ($ SigTool ->fixPath (__DIR__ . '/ ' . $ FileSet ), $ FileData );
0 commit comments