Skip to content

Commit 7fcaca6

Browse files
committed
v2.0.1
Changelog excerpt: - Synced the YAML class to its latest version and fixed some missing headers to be appended to certain generated signature files.
1 parent fb52dd5 commit 7fcaca6

File tree

5 files changed

+178
-109
lines changed

5 files changed

+178
-109
lines changed

.github/workflows/php-cs-fixer.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ jobs:
2424

2525
- name: PHP-CS-Fixer Check
2626
run: |
27-
php-cs-fixer fix -v --dry-run ./SigTool.php --rules=@PSR12
28-
php-cs-fixer fix -v --dry-run ./Cvd.php --rules=@PSR12
27+
php-cs-fixer fix -v --dry-run ./SigTool.php --rules=@PSR12,-blank_line_after_opening_tag
28+
php-cs-fixer fix -v --dry-run ./Cvd.php --rules=@PSR12,-blank_line_after_opening_tag

Changelog.txt

+12
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,20 @@ Versioning guidelines for SemVer can be found at: https://semver.org/
77

88
=== Changes made since last versioned release ===
99

10+
(none)
11+
12+
=== Version/Release 2.0.1 ===
13+
PATCH RELEASE.
14+
1015
- [2024.11.06; Maikuolan]: Added PHP 8.4 to workflows.
1116

17+
- [2025.03.20; Maikuolan]: Synced the YAML class to its latest version and
18+
fixed some missing headers to be appended to certain generated signature
19+
files.
20+
21+
Caleb M (Maikuolan),
22+
March 20, 2025.
23+
1224
=== Version/Release 2.0.0 ===
1325
MAJOR RELEASE (BACKWARDS INCOMPATIBLE).
1426

CommonAbstract.php

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<?php
2+
/**
3+
* Common abstract for the common classes package (last modified: 2024.09.20).
4+
*
5+
* This file is a part of the "common classes package", utilised by a number of
6+
* packages and projects, including CIDRAM and phpMussel.
7+
* @link https://github.com/Maikuolan/Common
8+
*
9+
* License: GNU/GPLv2
10+
* @see LICENSE.txt
11+
*
12+
* "COMMON CLASSES PACKAGE" COPYRIGHT 2019 and beyond by Caleb Mazalevskis.
13+
*/
14+
15+
namespace Maikuolan\Common;
16+
17+
abstract class CommonAbstract
18+
{
19+
/**
20+
* @var string Common Classes Package tag/release version.
21+
* @link https://github.com/Maikuolan/Common/tags
22+
*/
23+
public const VERSION = '2.12.3';
24+
25+
/**
26+
* Traverse data path.
27+
*
28+
* @param mixed $Data The data to traverse.
29+
* @param string|array $Path The path to traverse.
30+
* @param bool $AllowNonScalar Whether to allow non-scalar returns.
31+
* @param bool $AllowMethodCalls Whether to allow method calls.
32+
* @return mixed The traversed data, or an empty string on failure.
33+
*/
34+
public function dataTraverse(&$Data, $Path = [], bool $AllowNonScalar = false, bool $AllowMethodCalls = false)
35+
{
36+
if (!is_array($Path)) {
37+
$Path = preg_split('~(?<!\\\\)\\.~', $Path) ?: [];
38+
}
39+
$Segment = array_shift($Path);
40+
if ($Segment === null || strlen($Segment) === 0) {
41+
return $AllowNonScalar || is_scalar($Data) ? $Data : '';
42+
}
43+
$Segment = str_replace('\.', '.', $Segment);
44+
if (is_array($Data)) {
45+
return isset($Data[$Segment]) ? $this->dataTraverse($Data[$Segment], $Path, $AllowNonScalar, $AllowMethodCalls) : '';
46+
}
47+
if (is_object($Data)) {
48+
if (property_exists($Data, $Segment)) {
49+
return $this->dataTraverse($Data->$Segment, $Path, $AllowNonScalar, $AllowMethodCalls);
50+
}
51+
if ($AllowMethodCalls && method_exists($Data, $Segment)) {
52+
$Working = $Data->{$Segment}(...$Path);
53+
return $this->dataTraverse($Working, [], $AllowNonScalar);
54+
}
55+
}
56+
if (is_string($Data)) {
57+
if (preg_match('~^(?:trim|str(?:tolower|toupper|len))\\(\\)~i', $Segment)) {
58+
$Segment = substr($Segment, 0, -2);
59+
$Data = $Segment($Data);
60+
}
61+
}
62+
return $this->dataTraverse($Data, $Path, $AllowNonScalar, $AllowMethodCalls);
63+
}
64+
}

SigTool.php

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* SigTool v2.0.0 (last modified: 2022.02.12).
3+
* SigTool v2.0.1 (last modified: 2025.03.20).
44
* @link https://github.com/phpMussel/SigTool
55
*
66
* Generates signatures for phpMussel using main.cvd and daily.cvd from ClamAV.
@@ -10,6 +10,7 @@
1010

1111
namespace phpMussel\SigTool;
1212

13+
require __DIR__ . '/CommonAbstract.php';
1314
require __DIR__ . '/YAML.php';
1415
require __DIR__ . '/Cvd.php';
1516

@@ -19,12 +20,12 @@ class SigTool extends \Maikuolan\Common\YAML
1920
* @var string Script version.
2021
* @link https://github.com/phpMussel/SigTool/tags
2122
*/
22-
public const VERSION = '2.0.0';
23+
public const VERSION = '2.0.1';
2324

2425
/**
2526
* @var string Last modified date.
2627
*/
27-
public const MODIFIED = '2021.07.22';
28+
public const MODIFIED = '2025.03.20';
2829

2930
/**
3031
* @var int Safe file chunk size for when reading files.
@@ -518,12 +519,12 @@ private function formatSize(int $Size): string
518519

519520
/** All the signature files that we're generating from our clamav.ndb file. */
520521
$FileSets = [
521-
'clamav.db' => "phpMussel0\n>!\$fileswitch>pefile>-1\n",
522-
'clamav_regex.db' => "phpMussel@\n>!\$fileswitch>pefile>-1\n",
522+
'clamav.db' => "phpMussel0\n>!\$fileswitch>pefile>-1\n>\$fileswitch>infectable>-1\n",
523+
'clamav_regex.db' => "phpMussel@\n>!\$fileswitch>pefile>-1\n>\$fileswitch>infectable>-1\n",
523524
'clamav.htdb' => "phpMusselp\n>\$is_html>1>-1\n",
524525
'clamav_regex.htdb' => "phpMussel\x80\n>\$is_html>1>-1\n",
525-
'clamav.ndb' => "phpMusselP\n>!\$fileswitch>pefile>-1\n",
526-
'clamav_regex.ndb' => "phpMussel`\n>!\$fileswitch>pefile>-1\n",
526+
'clamav.ndb' => "phpMusselP\n>!\$fileswitch>pefile>-1\n>\$fileswitch>infectable>-1\n",
527+
'clamav_regex.ndb' => "phpMussel`\n>!\$fileswitch>pefile>-1\n>\$fileswitch>infectable>-1\n",
527528
'clamav_elf.db' => "phpMussel0\n>\$is_elf>1>-1\n",
528529
'clamav_elf_regex.db' => "phpMussel@\n>\$is_elf>1>-1\n",
529530
'clamav_email.db' => "phpMussel0\n>\$is_email>1>-1\n",

0 commit comments

Comments
 (0)