Minor regression in previous commit, performValidation()'s return type didn't match. Ideally we would rather switch to plain array's, but since performValidation()
is used in multiple areas (including plugins) we better opt for compatiblity now.
ref https://github.com/opnsense/core/pull/5711
Although our previous strategy should work according to how bind() and validation() are being implemented (https://github.com/phalcon/cphalcon/blob/4.2.x/phalcon/Validation.zep),
in reality it seems they aren't the same. Our previous attempt failed some validations (such as booleans) for no valid reasons.
Long term we should remove the phalcon dependency as these effects are highly unpredictable.
Since Validation() in 5 moves to Filter\Validation (https://docs.phalcon.io/5.0/en/upgrade#general-notes) and the class is used in strict parameter passing,
it will be difficult to import a situation which works both on 4 and 5.
To prevent future issues, but keep the current situation functional with minimal changes, we wrapped Validation() into a class of our own. When validators inherit from BaseValidator, these are assumed to
be less strict and bound to our own handling. Phalcon validations will follow the old path for now.
Migrating existing validations on our end, should be as simple as changing the following lines:
-use Phalcon\Validation\AbstractValidator;
-use Phalcon\Validation\ValidatorInterface;
-use Phalcon\Validation;
+use OPNsense\Base\BaseValidator;
-class CallbackValidator extends AbstractValidator implements ValidatorInterface
+class CallbackValidator extends BaseValidator
- public function validate(Validation $validator, $attribute): bool
+ public function validate($validator, $attribute): bool
Todo: choose the "correct" Validation() based on phalcon version.
Unbound host and domain sort order.
Host and domain names are case insensitive. Should be handled case insensitively. myHost comes before YourHost. Always.
Sort order should be:
myHost
YourHost
Not:
YourHost
myHost
When migration failed into 22.1.5, this patch in combination with `/usr/local/opnsense/mvc/script/run_migrations.php` should fix migration issues. No new model version is needed as
the previous version wasn't able to migrate in this case. closes https://github.com/opnsense/core/issues/5693
Change the structure a little to support reloading either all
dhcp-related services or only a certain address family through
optional parameter: "inet" for IPv4 and "inet6" for IPv6.
The issue with the original proposal was that although dhcpd6
was restarted we also need to restart radvd since it is affected
by the same bug #4691 and still seems to be happening in the wild
in FreeBSD 13.
While here expand to full path of pluginctl in an unrelated file.
Always prefer cpu temp as before, when not available consider the folowing options
o hw.acpi.thermal.tz0.temperature --> ACPI temp
o hw.temperature.CPU --> apparantly used for arm devices.