Skip to content
Commits auf Quelle (4)
  • Henning Leutz's avatar
    chore(phpstan): update phpstan version and clear phpstan baseline · 13b1adea
    verfasst von Henning Leutz
    Updated the version of `phpstan` in `.phive/phars.xml` to `1.*` and installed `1.12.13`. Removed
    the specific lines of ignored errors in `phpstan-baseline.neon` to keep it clean and avoid masking
    significant errors. Now, `phpstan` will provide better and more specific coding style issues and
    potential bugs.
    13b1adea
  • Henning Leutz's avatar
    refactor(phpcs): update type declaration syntax · dde17568
    verfasst von Henning Leutz
    This commit updates the type declaration syntax in the `ExecCrons.php` and `Manager.php` files to
    use a space around the `|` operator for better code readability. This change does not affect the
    functionality of the code. Minor structural change.
    dde17568
  • Henning Leutz's avatar
    fix(phpstan): improve cron execution and error handling · 73e00022
    verfasst von Henning Leutz
    Summary of changes:
    - Removed redundant PHPDoc from `ExecCrons` class.
    - Ensured the input `cronId` is cast to an integer before calling `runCron` in `ExecCrons` class.
    - Removed extraneous details from PHPDoc in `Manager` class.
    - Added more robust checking for parameters in `Manager` class.
    - Included method existence check for `deactivate` before calling it in `QuiqqerCrons` class.
    
    These changes contribute towards improving cron execution and handling potential errors more
    gracefully.
    
    Related: #57
    73e00022
  • Henning Leutz's avatar
    Merge branch 'next-2.x' into 'main' · 0911f050
    verfasst von Henning Leutz
    chore(phpstan): update phpstan version and clear phpstan baseline
    
    See merge request !23
    0911f050
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="phpstan" version="1.11.8" installed="1.11.8" location="./tools/phpstan" copy="false"/>
<phar name="phpstan" version="1.*" installed="1.12.13" location="./tools/phpstan" copy="false"/>
<phar name="phpunit" version="^10.5.20" installed="10.5.20" location="./tools/phpunit" copy="false"/>
<phar name="phpcs" version="^3.9.2" installed="3.9.2" location="./tools/phpcs" copy="false"/>
<phar name="phpcbf" version="^3.9.2" installed="3.9.2" location="./tools/phpcbf" copy="false"/>
......
parameters:
ignoreErrors:
-
message: "#^Parameter \\#1 \\$cronId of method QUI\\\\Cron\\\\Console\\\\ExecCrons\\:\\:runCron\\(\\) expects bool\\|int, string given\\.$#"
count: 1
path: src/QUI/Cron/Console/ExecCrons.php
-
message: "#^Access to an undefined property DOMNode\\:\\:\\$tagName\\.$#"
count: 1
path: src/QUI/Cron/Manager.php
-
message: "#^PHPDoc tag @return with type QUI\\\\Cron\\\\Manager is not subtype of native type static\\(QUI\\\\Cron\\\\Manager\\)\\.$#"
count: 1
path: src/QUI/Cron/Manager.php
-
message: "#^Call to an undefined method QUI\\\\Projects\\\\Site\\:\\:deactivate\\(\\)\\.$#"
count: 1
path: src/QUI/Cron/QuiqqerCrons.php
......@@ -22,8 +22,6 @@ class ExecCrons extends QUI\System\Console\Tool
}
/**
* (non-PHPdoc)
*
* @throws Exception
* @see \QUI\System\Console\Tool::execute()
*/
......@@ -101,7 +99,7 @@ class ExecCrons extends QUI\System\Console\Tool
$cronId = $this->readInput();
try {
$this->runCron($cronId);
$this->runCron((int)$cronId);
} catch (QUI\Exception $Exception) {
$this->writeLn($Exception->getMessage(), 'red');
$this->resetColor();
......
......@@ -410,9 +410,6 @@ class Manager
/**
* Execute a cron
*
* @param integer $cronId - ID of the cron
*
* @return Manager
* @throws QUI\Exception
*/
public function executeCron(int $cronId): static
......@@ -822,7 +819,11 @@ class Manager
for ($j = 0; $j < $Params->length; $j++) {
$ParamsNode = $Params->item($j);
if ($ParamsNode->parentNode && $ParamsNode->parentNode->tagName === 'cron') {
if (
$ParamsNode->parentNode
&& isset($ParamsNode->parentNode->tagName)
&& $ParamsNode->parentNode->tagName === 'cron'
) {
$CronParams = $ParamsNode->getElementsByTagName('param');
break;
}
......
......@@ -192,7 +192,10 @@ class QuiqqerCrons
foreach ($result as $entry) {
try {
$Site = $Project->get((int)$entry['id']);
if (method_exists($Site, 'deactivate')) {
$Site->deactivate();
}
$deactivate[] = (int)$entry['id'];
} catch (QUI\Exception $Exception) {
......