ENHANCEMENT: using symfony

main
Jeroen De Meerleer 3 months ago
parent b58e84b1c5
commit 92e74f0797
Signed by: JeroenED
GPG Key ID: 28CCCB8F62BFADD6
  1. 1
      composer.json
  2. 263
      composer.lock
  3. 3
      config/packages/doctrine.yaml
  4. 12
      src/Entity/Job.php
  5. 14
      src/Entity/Run.php
  6. 115
      src/Repository/JobRepository.php
  7. 3
      symfony.lock
  8. 8
      templates/mail-failed-runs.html.twig

@ -16,6 +16,7 @@
"guzzlehttp/guzzle": "~7.4.0",
"pentatrion/vite-bundle": "^1.2",
"phpseclib/phpseclib": "^3.0",
"scienta/doctrine-json-functions": "~5.0.0",
"symfony/console": "6.0.*",
"symfony/dotenv": "6.0.*",
"symfony/flex": "^2",

263
composer.lock generated

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "eb4193b83b30d6216812e31a83cb6e13",
"content-hash": "7f812eb1644c07f1064bc949657fc1f5",
"packages": [
{
"name": "doctrine/annotations",
@ -338,22 +338,22 @@
},
{
"name": "doctrine/dbal",
"version": "3.3.5",
"version": "3.3.6",
"source": {
"type": "git",
"url": "https://github.com/doctrine/dbal.git",
"reference": "719663b15983278227669c8595151586a2ff3327"
"reference": "9e7f76dd1cde81c62574fdffa5a9c655c847ad21"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/dbal/zipball/719663b15983278227669c8595151586a2ff3327",
"reference": "719663b15983278227669c8595151586a2ff3327",
"url": "https://api.github.com/repos/doctrine/dbal/zipball/9e7f76dd1cde81c62574fdffa5a9c655c847ad21",
"reference": "9e7f76dd1cde81c62574fdffa5a9c655c847ad21",
"shasum": ""
},
"require": {
"composer-runtime-api": "^2",
"doctrine/cache": "^1.11|^2.0",
"doctrine/deprecations": "^0.5.3",
"doctrine/deprecations": "^0.5.3|^1",
"doctrine/event-manager": "^1.0",
"php": "^7.3 || ^8.0",
"psr/cache": "^1|^2|^3",
@ -361,15 +361,15 @@
},
"require-dev": {
"doctrine/coding-standard": "9.0.0",
"jetbrains/phpstorm-stubs": "2021.1",
"phpstan/phpstan": "1.5.3",
"phpstan/phpstan-strict-rules": "^1.1",
"phpunit/phpunit": "9.5.16",
"jetbrains/phpstorm-stubs": "2022.1",
"phpstan/phpstan": "1.6.3",
"phpstan/phpstan-strict-rules": "^1.2",
"phpunit/phpunit": "9.5.20",
"psalm/plugin-phpunit": "0.16.1",
"squizlabs/php_codesniffer": "3.6.2",
"symfony/cache": "^5.2|^6.0",
"symfony/console": "^2.7|^3.0|^4.0|^5.0|^6.0",
"vimeo/psalm": "4.22.0"
"vimeo/psalm": "4.23.0"
},
"suggest": {
"symfony/console": "For helpful console commands such as SQL execution and import of files."
@ -429,7 +429,7 @@
],
"support": {
"issues": "https://github.com/doctrine/dbal/issues",
"source": "https://github.com/doctrine/dbal/tree/3.3.5"
"source": "https://github.com/doctrine/dbal/tree/3.3.6"
},
"funding": [
{
@ -445,29 +445,29 @@
"type": "tidelift"
}
],
"time": "2022-04-05T09:50:18+00:00"
"time": "2022-05-02T17:21:01+00:00"
},
{
"name": "doctrine/deprecations",
"version": "v0.5.3",
"version": "v1.0.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/deprecations.git",
"reference": "9504165960a1f83cc1480e2be1dd0a0478561314"
"reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/deprecations/zipball/9504165960a1f83cc1480e2be1dd0a0478561314",
"reference": "9504165960a1f83cc1480e2be1dd0a0478561314",
"url": "https://api.github.com/repos/doctrine/deprecations/zipball/0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de",
"reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de",
"shasum": ""
},
"require": {
"php": "^7.1|^8.0"
},
"require-dev": {
"doctrine/coding-standard": "^6.0|^7.0|^8.0",
"phpunit/phpunit": "^7.0|^8.0|^9.0",
"psr/log": "^1.0"
"doctrine/coding-standard": "^9",
"phpunit/phpunit": "^7.5|^8.5|^9.5",
"psr/log": "^1|^2|^3"
},
"suggest": {
"psr/log": "Allows logging deprecations via PSR-3 logger implementation"
@ -486,9 +486,9 @@
"homepage": "https://www.doctrine-project.org/",
"support": {
"issues": "https://github.com/doctrine/deprecations/issues",
"source": "https://github.com/doctrine/deprecations/tree/v0.5.3"
"source": "https://github.com/doctrine/deprecations/tree/v1.0.0"
},
"time": "2021-03-21T12:59:47+00:00"
"time": "2022-05-02T15:47:09+00:00"
},
{
"name": "doctrine/doctrine-bundle",
@ -1022,22 +1022,22 @@
},
{
"name": "doctrine/migrations",
"version": "3.5.0",
"version": "3.5.1",
"source": {
"type": "git",
"url": "https://github.com/doctrine/migrations.git",
"reference": "5713b45c933122e509d9b31c767b420c3dfed399"
"reference": "c0a01ddead0ccaf0282f3f4fcaa026d11918a481"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/migrations/zipball/5713b45c933122e509d9b31c767b420c3dfed399",
"reference": "5713b45c933122e509d9b31c767b420c3dfed399",
"url": "https://api.github.com/repos/doctrine/migrations/zipball/c0a01ddead0ccaf0282f3f4fcaa026d11918a481",
"reference": "c0a01ddead0ccaf0282f3f4fcaa026d11918a481",
"shasum": ""
},
"require": {
"composer-runtime-api": "^2",
"doctrine/dbal": "^3.3",
"doctrine/deprecations": "^0.5.3",
"doctrine/deprecations": "^0.5.3 || ^1",
"doctrine/event-manager": "^1.0",
"friendsofphp/proxy-manager-lts": "^1.0",
"php": "^7.4 || ^8.0",
@ -1045,10 +1045,13 @@
"symfony/console": "^4.4.16 || ^5.4 || ^6.0",
"symfony/stopwatch": "^4.4 || ^5.4 || ^6.0"
},
"conflict": {
"doctrine/orm": "<2.12"
},
"require-dev": {
"doctrine/coding-standard": "^9",
"doctrine/orm": "^2.6",
"doctrine/persistence": "^2.0",
"doctrine/orm": "^2.12",
"doctrine/persistence": "^2 || ^3",
"doctrine/sql-formatter": "^1.0",
"ergebnis/composer-normalize": "^2.9",
"ext-pdo_sqlite": "*",
@ -1057,7 +1060,7 @@
"phpstan/phpstan-phpunit": "^1.1",
"phpstan/phpstan-strict-rules": "^1.1",
"phpstan/phpstan-symfony": "^1.1",
"phpunit/phpunit": "^9.4",
"phpunit/phpunit": "^9.5",
"symfony/cache": "^4.4 || ^5.4 || ^6.0",
"symfony/process": "^4.4 || ^5.4 || ^6.0",
"symfony/yaml": "^4.4 || ^5.4 || ^6.0"
@ -1108,7 +1111,7 @@
],
"support": {
"issues": "https://github.com/doctrine/migrations/issues",
"source": "https://github.com/doctrine/migrations/tree/3.5.0"
"source": "https://github.com/doctrine/migrations/tree/3.5.1"
},
"funding": [
{
@ -1124,20 +1127,20 @@
"type": "tidelift"
}
],
"time": "2022-04-04T20:24:11+00:00"
"time": "2022-05-09T20:24:38+00:00"
},
{
"name": "doctrine/orm",
"version": "2.12.1",
"version": "2.12.2",
"source": {
"type": "git",
"url": "https://github.com/doctrine/orm.git",
"reference": "2e4a8722721b934149ff53b191522a6829b6d73b"
"reference": "8291a7f09b12d14783ed6537b4586583d155869e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/orm/zipball/2e4a8722721b934149ff53b191522a6829b6d73b",
"reference": "2e4a8722721b934149ff53b191522a6829b6d73b",
"url": "https://api.github.com/repos/doctrine/orm/zipball/8291a7f09b12d14783ed6537b4586583d155869e",
"reference": "8291a7f09b12d14783ed6537b4586583d155869e",
"shasum": ""
},
"require": {
@ -1146,7 +1149,7 @@
"doctrine/collections": "^1.5",
"doctrine/common": "^3.0.3",
"doctrine/dbal": "^2.13.1 || ^3.2",
"doctrine/deprecations": "^0.5.3",
"doctrine/deprecations": "^0.5.3 || ^1",
"doctrine/event-manager": "^1.1",
"doctrine/inflector": "^1.4 || ^2.0",
"doctrine/instantiator": "^1.3",
@ -1166,13 +1169,13 @@
"doctrine/annotations": "^1.13",
"doctrine/coding-standard": "^9.0",
"phpbench/phpbench": "^0.16.10 || ^1.0",
"phpstan/phpstan": "~1.4.10 || 1.5.0",
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.4",
"phpstan/phpstan": "~1.4.10 || 1.6.3",
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.5",
"psr/log": "^1 || ^2 || ^3",
"squizlabs/php_codesniffer": "3.6.2",
"symfony/cache": "^4.4 || ^5.4 || ^6.0",
"symfony/yaml": "^3.4 || ^4.0 || ^5.0 || ^6.0",
"vimeo/psalm": "4.22.0"
"vimeo/psalm": "4.23.0"
},
"suggest": {
"symfony/cache": "Provides cache support for Setup Tool with doctrine/cache 2.0",
@ -1221,22 +1224,22 @@
],
"support": {
"issues": "https://github.com/doctrine/orm/issues",
"source": "https://github.com/doctrine/orm/tree/2.12.1"
"source": "https://github.com/doctrine/orm/tree/2.12.2"
},
"time": "2022-04-22T17:46:03+00:00"
"time": "2022-05-02T19:10:07+00:00"
},
{
"name": "doctrine/persistence",
"version": "3.0.0",
"version": "3.0.2",
"source": {
"type": "git",
"url": "https://github.com/doctrine/persistence.git",
"reference": "e6103cb9e0982a4312e05ad94bb7be3f8e2d5869"
"reference": "25ec98a8cbd1f850e60fdb62c0ef77c162da8704"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/persistence/zipball/e6103cb9e0982a4312e05ad94bb7be3f8e2d5869",
"reference": "e6103cb9e0982a4312e05ad94bb7be3f8e2d5869",
"url": "https://api.github.com/repos/doctrine/persistence/zipball/25ec98a8cbd1f850e60fdb62c0ef77c162da8704",
"reference": "25ec98a8cbd1f850e60fdb62c0ef77c162da8704",
"shasum": ""
},
"require": {
@ -1308,7 +1311,7 @@
],
"support": {
"issues": "https://github.com/doctrine/persistence/issues",
"source": "https://github.com/doctrine/persistence/tree/3.0.0"
"source": "https://github.com/doctrine/persistence/tree/3.0.2"
},
"funding": [
{
@ -1324,7 +1327,7 @@
"type": "tidelift"
}
],
"time": "2022-04-15T10:39:55+00:00"
"time": "2022-05-06T06:10:05+00:00"
},
{
"name": "doctrine/sql-formatter",
@ -1448,16 +1451,16 @@
},
{
"name": "friendsofphp/proxy-manager-lts",
"version": "v1.0.10",
"version": "v1.0.12",
"source": {
"type": "git",
"url": "https://github.com/FriendsOfPHP/proxy-manager-lts.git",
"reference": "88dda72c48633326c81a01b861c8b6a923948f56"
"reference": "8419f0158715b30d4b99a5bd37c6a39671994ad7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/FriendsOfPHP/proxy-manager-lts/zipball/88dda72c48633326c81a01b861c8b6a923948f56",
"reference": "88dda72c48633326c81a01b861c8b6a923948f56",
"url": "https://api.github.com/repos/FriendsOfPHP/proxy-manager-lts/zipball/8419f0158715b30d4b99a5bd37c6a39671994ad7",
"reference": "8419f0158715b30d4b99a5bd37c6a39671994ad7",
"shasum": ""
},
"require": {
@ -1514,7 +1517,7 @@
],
"support": {
"issues": "https://github.com/FriendsOfPHP/proxy-manager-lts/issues",
"source": "https://github.com/FriendsOfPHP/proxy-manager-lts/tree/v1.0.10"
"source": "https://github.com/FriendsOfPHP/proxy-manager-lts/tree/v1.0.12"
},
"funding": [
{
@ -1526,7 +1529,7 @@
"type": "tidelift"
}
],
"time": "2022-05-01T10:41:21+00:00"
"time": "2022-05-05T09:31:05+00:00"
},
{
"name": "guzzlehttp/guzzle",
@ -2601,6 +2604,74 @@
},
"time": "2019-03-08T08:55:37+00:00"
},
{
"name": "scienta/doctrine-json-functions",
"version": "5.0.0",
"source": {
"type": "git",
"url": "https://github.com/ScientaNL/DoctrineJsonFunctions.git",
"reference": "a5a2309844cbb7fbf60d2aabcc6fb27418a431c5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ScientaNL/DoctrineJsonFunctions/zipball/a5a2309844cbb7fbf60d2aabcc6fb27418a431c5",
"reference": "a5a2309844cbb7fbf60d2aabcc6fb27418a431c5",
"shasum": ""
},
"require": {
"doctrine/dbal": "^3.0",
"doctrine/orm": "^2.0",
"ext-pdo": "*",
"php": "^7.3 || ^8.0"
},
"require-dev": {
"doctrine/annotations": "^1.13",
"doctrine/coding-standard": "^8.0 || ^9.0",
"phpunit/phpunit": "^8.0 || ^9.0"
},
"suggest": {
"dunglas/doctrine-json-odm": "To serialize / deserialize objects as JSON documents."
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.1-dev"
}
},
"autoload": {
"psr-4": {
"Scienta\\DoctrineJsonFunctions\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Doctrine Json Functions Contributors",
"homepage": "https://github.com/ScientaNL/DoctrineJsonFunctions/contributors"
}
],
"description": "A set of extensions to Doctrine 2 that add support for json query functions.",
"keywords": [
"database",
"doctrine",
"dql",
"json",
"mariadb",
"mysql",
"orm",
"postgres",
"postgresql",
"sqlite"
],
"support": {
"issues": "https://github.com/ScientaNL/DoctrineJsonFunctions/issues",
"source": "https://github.com/ScientaNL/DoctrineJsonFunctions/tree/5.0.0"
},
"time": "2022-01-12T10:14:59+00:00"
},
{
"name": "symfony/cache",
"version": "v6.0.8",
@ -3645,16 +3716,16 @@
},
{
"name": "symfony/flex",
"version": "v2.1.7",
"version": "v2.1.8",
"source": {
"type": "git",
"url": "https://github.com/symfony/flex.git",
"reference": "3eb57ba4b5d3f14cdaafe030936421c22e9f98a2"
"reference": "dcbe58c3fbafeaeb32f619bf94c3912c0c732b65"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/flex/zipball/3eb57ba4b5d3f14cdaafe030936421c22e9f98a2",
"reference": "3eb57ba4b5d3f14cdaafe030936421c22e9f98a2",
"url": "https://api.github.com/repos/symfony/flex/zipball/dcbe58c3fbafeaeb32f619bf94c3912c0c732b65",
"reference": "dcbe58c3fbafeaeb32f619bf94c3912c0c732b65",
"shasum": ""
},
"require": {
@ -3690,7 +3761,7 @@
"description": "Composer plugin for Symfony",
"support": {
"issues": "https://github.com/symfony/flex/issues",
"source": "https://github.com/symfony/flex/tree/v2.1.7"
"source": "https://github.com/symfony/flex/tree/v2.1.8"
},
"funding": [
{
@ -3706,7 +3777,7 @@
"type": "tidelift"
}
],
"time": "2022-04-15T08:20:43+00:00"
"time": "2022-05-02T10:23:41+00:00"
},
{
"name": "symfony/framework-bundle",
@ -6333,16 +6404,16 @@
},
{
"name": "twig/twig",
"version": "v3.3.10",
"version": "v3.4.0",
"source": {
"type": "git",
"url": "https://github.com/twigphp/Twig.git",
"reference": "8442df056c51b706793adf80a9fd363406dd3674"
"reference": "ed19f4bf9d19c4ef920b5d8243910bd32e85b9ba"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/8442df056c51b706793adf80a9fd363406dd3674",
"reference": "8442df056c51b706793adf80a9fd363406dd3674",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/ed19f4bf9d19c4ef920b5d8243910bd32e85b9ba",
"reference": "ed19f4bf9d19c4ef920b5d8243910bd32e85b9ba",
"shasum": ""
},
"require": {
@ -6357,7 +6428,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.3-dev"
"dev-master": "3.4-dev"
}
},
"autoload": {
@ -6393,7 +6464,7 @@
],
"support": {
"issues": "https://github.com/twigphp/Twig/issues",
"source": "https://github.com/twigphp/Twig/tree/v3.3.10"
"source": "https://github.com/twigphp/Twig/tree/v3.4.0"
},
"funding": [
{
@ -6405,22 +6476,22 @@
"type": "tidelift"
}
],
"time": "2022-04-06T06:47:41+00:00"
"time": "2022-05-15T06:25:28+00:00"
}
],
"packages-dev": [
{
"name": "monolog/monolog",
"version": "2.5.0",
"version": "2.6.0",
"source": {
"type": "git",
"url": "https://github.com/Seldaek/monolog.git",
"reference": "4192345e260f1d51b365536199744b987e160edc"
"reference": "247918972acd74356b0a91dfaa5adcaec069b6c0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/4192345e260f1d51b365536199744b987e160edc",
"reference": "4192345e260f1d51b365536199744b987e160edc",
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/247918972acd74356b0a91dfaa5adcaec069b6c0",
"reference": "247918972acd74356b0a91dfaa5adcaec069b6c0",
"shasum": ""
},
"require": {
@ -6433,18 +6504,23 @@
"require-dev": {
"aws/aws-sdk-php": "^2.4.9 || ^3.0",
"doctrine/couchdb": "~1.0@dev",
"elasticsearch/elasticsearch": "^7",
"elasticsearch/elasticsearch": "^7 || ^8",
"ext-json": "*",
"graylog2/gelf-php": "^1.4.2",
"guzzlehttp/guzzle": "^7.4",
"guzzlehttp/psr7": "^2.2",
"mongodb/mongodb": "^1.8",
"php-amqplib/php-amqplib": "~2.4 || ^3",
"php-console/php-console": "^3.1.3",
"phpspec/prophecy": "^1.6.1",
"phpspec/prophecy": "^1.15",
"phpstan/phpstan": "^0.12.91",
"phpunit/phpunit": "^8.5",
"phpunit/phpunit": "^8.5.14",
"predis/predis": "^1.1",
"rollbar/rollbar": "^1.3 || ^2 || ^3",
"ruflin/elastica": ">=0.90@dev",
"swiftmailer/swiftmailer": "^5.3|^6.0"
"ruflin/elastica": "^7",
"swiftmailer/swiftmailer": "^5.3|^6.0",
"symfony/mailer": "^5.4 || ^6",
"symfony/mime": "^5.4 || ^6"
},
"suggest": {
"aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB",
@ -6494,7 +6570,7 @@
],
"support": {
"issues": "https://github.com/Seldaek/monolog/issues",
"source": "https://github.com/Seldaek/monolog/tree/2.5.0"
"source": "https://github.com/Seldaek/monolog/tree/2.6.0"
},
"funding": [
{
@ -6506,7 +6582,7 @@
"type": "tidelift"
}
],
"time": "2022-04-08T15:43:54+00:00"
"time": "2022-05-10T09:36:00+00:00"
},
{
"name": "nikic/php-parser",
@ -6644,16 +6720,16 @@
},
{
"name": "symfony/maker-bundle",
"version": "v1.40.1",
"version": "v1.42.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/maker-bundle.git",
"reference": "adc846e4f852e3aa2cd84a433cd05ba23dd19c3f"
"reference": "fc9f6bcc0ef79fc9d0325c545ae0f030bb6c9d11"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/maker-bundle/zipball/adc846e4f852e3aa2cd84a433cd05ba23dd19c3f",
"reference": "adc846e4f852e3aa2cd84a433cd05ba23dd19c3f",
"url": "https://api.github.com/repos/symfony/maker-bundle/zipball/fc9f6bcc0ef79fc9d0325c545ae0f030bb6c9d11",
"reference": "fc9f6bcc0ef79fc9d0325c545ae0f030bb6c9d11",
"shasum": ""
},
"require": {
@ -6669,10 +6745,13 @@
"symfony/framework-bundle": "^5.4.7|^6.0",
"symfony/http-kernel": "^5.4.7|^6.0"
},
"conflict": {
"doctrine/orm": "<2.10"
},
"require-dev": {
"composer/semver": "^3.0",
"doctrine/doctrine-bundle": "^2.4",
"doctrine/orm": "^2.3",
"doctrine/orm": "^2.10.0",
"symfony/http-client": "^5.4.7|^6.0",
"symfony/phpunit-bridge": "^5.4.7|^6.0",
"symfony/polyfill-php80": "^1.16.0",
@ -6712,7 +6791,7 @@
],
"support": {
"issues": "https://github.com/symfony/maker-bundle/issues",
"source": "https://github.com/symfony/maker-bundle/tree/v1.40.1"
"source": "https://github.com/symfony/maker-bundle/tree/v1.42.0"
},
"funding": [
{
@ -6728,7 +6807,7 @@
"type": "tidelift"
}
],
"time": "2022-04-23T19:42:13+00:00"
"time": "2022-05-09T19:36:10+00:00"
},
{
"name": "symfony/monolog-bridge",
@ -6815,20 +6894,20 @@
},
{
"name": "symfony/monolog-bundle",
"version": "v3.7.1",
"version": "v3.8.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/monolog-bundle.git",
"reference": "fde12fc628162787a4e53877abadc30047fd868b"
"reference": "a41bbcdc1105603b6d73a7d9a43a3788f8e0fb7d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/monolog-bundle/zipball/fde12fc628162787a4e53877abadc30047fd868b",
"reference": "fde12fc628162787a4e53877abadc30047fd868b",
"url": "https://api.github.com/repos/symfony/monolog-bundle/zipball/a41bbcdc1105603b6d73a7d9a43a3788f8e0fb7d",
"reference": "a41bbcdc1105603b6d73a7d9a43a3788f8e0fb7d",
"shasum": ""
},
"require": {
"monolog/monolog": "~1.22 || ~2.0",
"monolog/monolog": "^1.22 || ^2.0 || ^3.0",
"php": ">=7.1.3",
"symfony/config": "~4.4 || ^5.0 || ^6.0",
"symfony/dependency-injection": "^4.4 || ^5.0 || ^6.0",
@ -6876,7 +6955,7 @@
],
"support": {
"issues": "https://github.com/symfony/monolog-bundle/issues",
"source": "https://github.com/symfony/monolog-bundle/tree/v3.7.1"
"source": "https://github.com/symfony/monolog-bundle/tree/v3.8.0"
},
"funding": [
{
@ -6892,7 +6971,7 @@
"type": "tidelift"
}
],
"time": "2021-11-05T10:34:29+00:00"
"time": "2022-05-10T14:24:36+00:00"
},
{
"name": "symfony/web-profiler-bundle",

@ -9,6 +9,9 @@ doctrine:
auto_generate_proxy_classes: true
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
auto_mapping: true
dql:
string_functions:
JSON_VALUE: Scienta\DoctrineJsonFunctions\Query\AST\Functions\Mariadb\JsonValue
mappings:
App:
is_bundle: false

@ -3,6 +3,7 @@
namespace App\Entity;
use App\Repository\JobRepository;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: JobRepository::class)]
@ -52,6 +53,17 @@ class Job
#[ORM\Column(type: "integer")]
private int $running;
/**
* @var Collection
*/
#[ORM\OneToMany(targetEntity: "App\Entity\Run", mappedBy: "job")]
private Collection $runs;
public function __construct()
{
$this->runs = new ArrayCollection();
}
/**
* @return int|null
*/

@ -3,6 +3,8 @@
namespace App\Entity;
use App\Repository\RunRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection as CollectionAlias;
use Doctrine\ORM\Mapping as ORM;
/**
@ -19,11 +21,11 @@ class Run
#[ORM\Column(type: "integer")]
private ?int $id;
/**
* @var Job
* @ORM\Column(type="string")
*/
#[ORM\ManyToOne(targetEntity: "Job")]
#[ORM\ManyToOne(targetEntity: "App\Entity\Job", inversedBy: "runs")]
#[ORM\JoinColumn(name: "job_id", referencedColumnName: "id")]
private Job $job;
@ -76,18 +78,18 @@ class Run
}
/**
* @return Job
* @return CollectionAlias
*/
public function getJob(): Job
public function getJob(): CollectionAlias
{
return $this->job;
}
/**
* @param Job $job
* @param CollectionAlias $job
* @return Run
*/
public function setJob(Job $job): Run
public function setJob(CollectionAlias $job): Run
{
$this->job = $job;
return $this;

@ -9,6 +9,7 @@ use App\Entity\Run;
use App\Service\Secret;
use DateTime;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\Query;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\GuzzleException;
use phpseclib3\Crypt\PublicKeyLoader;
@ -19,80 +20,43 @@ class JobRepository extends EntityRepository
public function getFailingJobs()
{
$runRepo = $this->getEntityManager()->getRepository(Run::class);
/** @var Job[] $jobs */
$jobs = $this->getAllJobs();
$jobsSql = "SELECT * FROM job";
$jobsStmt = $this->getEntityManager()->getConnection()->prepare($jobsSql);
$jobsRslt = $jobsStmt->executeQuery();
$jobs = $jobsRslt->fetchAllAssociative();
foreach ($jobs as $key=>&$job) {
$job['data'] = json_decode($job['data'], true);
$job['host-displayname'] = $job['data']['host'];
$job['host'] = $job['data']['host'];
$job['service'] = $job['data']['service'] ?? '';
$failedruns = $runRepo->getRunsForJob($job['id'], true, $job['data']['fail-days']);
$failed = count($failedruns);
$all = count($runRepo->getRunsForJob($job['id'], false, $job['data']['fail-days']));
$job['lastfail'] = $failedruns[0] ?? NULL;
$job['needschecking'] = $all > 0 && (($failed / $all) * 100) > $job['data']['fail-pct'];
if(!empty($job['data']['containertype']) && $job['data']['containertype'] != 'none') {
$job['host-displayname'] = $job['data']['service'] . ' on ' . $job['data']['host'];
$return = [];
foreach($jobs as $job) {
if($job->getData()['needschecking']) {
$return[] = $job;
}
if($job['needschecking']) $failingjobs[] = $job;
}
if(empty($failingjobs)) return [];
array_multisort(
array_column($failingjobs, 'name'), SORT_ASC,
array_column($failingjobs, 'host'), SORT_ASC,
array_column($failingjobs, 'service'), SORT_ASC,
$failingjobs);
return $failingjobs;
return $return;
}
public function getRunningJobs(bool $idiskey = false)
public function getRunningJobs(bool $idiskey = false): array
{
$runRepo = $this->getEntityManager()->getRepository(Run::class);
$qb = $this->createQueryBuilder('job');
return $qb->where('job.running != 0')->getQuery()->getResult();
}
$jobsSql = "SELECT * FROM job WHERE running != 0;";
$jobsStmt = $this->getEntityManager()->getConnection()->prepare($jobsSql);
$jobsRslt = $jobsStmt->executeQuery();
$jobs = $jobsRslt->fetchAllAssociative();
$returnbyid = [];
foreach ($jobs as $key=>&$job) {
$job['data'] = json_decode($job['data'], true);
$job['host-displayname'] = $job['data']['host'];
$job['host'] = $job['data']['host'];
$job['service'] = $job['data']['service'] ?? '';
$job['norun'] = isset($job['lastrun']) && $job['nextrun'] > $job['lastrun'];
$job['running'] = $job['running'] != 0;
$failed = count($runRepo->getRunsForJob($job['id'], true, $job['data']['fail-days']));
$all = count($runRepo->getRunsForJob($job['id'], false, $job['data']['fail-days']));
$job['needschecking'] = $all > 0 && (($failed / $all) * 100) > $job['data']['fail-pct'];
if(!empty($job['data']['containertype']) && $job['data']['containertype'] != 'none') {
$job['host-displayname'] = $job['data']['service'] . ' on ' . $job['data']['host'];
}
if($idiskey) $returnbyid[$job['id']] = $job;
}
public function getAllJobs(bool $idiskey = false)
{
$qb = $this->createQueryBuilder('job');
if($idiskey) return $returnbyid;
array_multisort(
array_column($jobs, 'name'), SORT_ASC,
array_column($jobs, 'host'), SORT_ASC,
array_column($jobs, 'service'), SORT_ASC,
$jobs);
return $jobs;
/** @var Job[] $jobs */
$jobs = $qb
->orderBy('job.name')
->where('job.id = job.id')
->addOrderBy("JSON_VALUE(job.data, '$.host')")
->addOrderBy("JSON_VALUE(job.data, '$.service')")
->getQuery()->getResult();
return $this->parseJobs($jobs);
}
public function getAllJobs(bool $idiskey = false)
public function parseJobs(array $jobs): array
{
$runRepo = $this->getEntityManager()->getRepository(Run::class);
/** @var Job[] $jobs */
$jobs = parent::findAll();
$returnbyid = [];
$names = [];
$hosts = [];
$services = [];
foreach ($jobs as $key=>&$job) {
$jobData = $job->getData();
$job->addData('host-displayname', $jobData['host']);
@ -100,42 +64,19 @@ class JobRepository extends EntityRepository
$job->addData('service', $jobData['service'] ?? '');
$job->addData('norun', $job->getLastrun() !== null && $job->getNextrun() > $job->getLastrun());
$job->addData('running', $job->getRunning() != 0);
$failed = count($runRepo->getRunsForJob($job->getId(), true, $jobData['fail-days']));
$failedruns = $runRepo->getRunsForJob($job->getId(), true, $jobData['fail-days']);
$failed = count($failedruns);
$all = count($runRepo->getRunsForJob($job->getId(), false, $jobData['fail-days']));
$job->addData('lastfail', $failedruns[0] ?? NULL);
$job->addData('needschecking', $all > 0 && (($failed / $all) * 100) > $jobData['fail-pct']);
if(!empty($jobData['containertype']) && $jobData['containertype'] != 'none') {
$job->addData('host-displayname', $jobData['service'] . ' on ' . $jobData['host']);
}
$names[] = $job->getName();
$hosts[] = $job->getData()['host'];;
$services[] = $job->getData()['service'];
if($idiskey) $returnbyid[$job->getId()] = $job;
}
if($idiskey) return $returnbyid;
array_multisort(
$names, SORT_ASC,
$hosts, SORT_ASC,
$services, SORT_ASC,
$jobs);
return $jobs;
}
public function getErrorRatio(int $jobId): bool
{
$errorSql = "SELECT count(*) as count FROM job WHERE id = :id";
$errorStmt = $this->getEntityManager()->getConnection()->prepare($errorSql);
$errorRslt = $errorStmt->executeQuery([':timestamp' => time(), ':timestamplastrun' => time(), ':timestamprun' => time()]);
$error = $errorRslt->fetchAllAssociative();
$errorSql = "SELECT count(*) as count FROM job WHERE id = :id";
$errorStmt = $this->getEntityManager()->getConnection()->prepare($errorSql);
$errorRslt = $errorStmt->executeQuery([':timestamp' => time(), ':timestamplastrun' => time(), ':timestamprun' => time()]);
$error = $errorRslt->fetchAllAssociative();
}
public function getJobsDue()
{
$jobsSql = "SELECT id, running

@ -143,6 +143,9 @@
"ralouphie/getallheaders": {
"version": "3.0.3"
},
"scienta/doctrine-json-functions": {
"version": "4.4.0"
},
"symfony/cache": {
"version": "v6.0.6"
},

@ -7,10 +7,10 @@
<body>
<p>Some cronjobs are failing</p>
{% for job in jobs %}
<h2>{{ job.name }} ({{ attribute(job, 'host-displayname') }})</h2>
<p>Last failed on {{ job.lastfail.timestamp | date("d/m/Y H:i:s") }}</p>
{% if job.lastfail.output is not empty %}
<pre>{{ job.lastfail.output }}</pre>
<h2>{{ job.name }} ({{ attribute(job.data, 'host-displayname') }})</h2>
<p>Last failed on {{ job.data.lastfail.timestamp | date("d/m/Y H:i:s") }}</p>
{% if job.data.lastfail.output is not empty %}
<pre>{{ job.data.lastfail.output }}</pre>
{% endif %}
{% endfor %}
</body>

Loading…
Cancel
Save