Parcourir la source

shell_exec does not work with some logs, replace with symfony/process

pull/10/head
datagutten il y a 4 ans
Parent
révision
268866df9e
3 fichiers modifiés avec 57 ajouts et 3 suppressions
  1. +2
    -1
      composer.json
  2. +50
    -1
      composer.lock
  3. +5
    -1
      src/Logchecker.php

+ 2
- 1
composer.json Voir le fichier

@@ -20,7 +20,8 @@
"ext-mbstring": "*",
"symfony/console": "^3.4",
"symfony/debug": "^3.4",
"symfony/yaml": "^3.4"
"symfony/yaml": "^3.4",
"symfony/process": "^5.0"
},
"bin": ["bin/logchecker"]
}

+ 50
- 1
composer.lock Voir le fichier

@@ -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": "9ad854c65da76498f6a2af058812e332",
"content-hash": "bda3c6cb822164941a9e71f909c7468a",
"packages": [
{
"name": "psr/log",
@@ -298,6 +298,55 @@
],
"time": "2019-02-06T07:57:58+00:00"
},
{
"name": "symfony/process",
"version": "v5.0.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
"reference": "fd4a86dd7e36437f2fc080d8c42c7415d828a0a8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/fd4a86dd7e36437f2fc080d8c42c7415d828a0a8",
"reference": "fd4a86dd7e36437f2fc080d8c42c7415d828a0a8",
"shasum": ""
},
"require": {
"php": "^7.2.5"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.0-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Process\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Process Component",
"homepage": "https://symfony.com",
"time": "2020-02-08T17:00:58+00:00"
},
{
"name": "symfony/yaml",
"version": "v3.4.28",


+ 5
- 1
src/Logchecker.php Voir le fichier

@@ -2,6 +2,7 @@

namespace OrpheusNET\Logchecker;

use Symfony\Component\Process\Process;
use Symfony\Component\Yaml\Yaml;
use Symfony\Component\Yaml\Exception\ParseException;

@@ -466,7 +467,10 @@ class Logchecker {
}

if (Util::commandExists($Command)) {
$Out = shell_exec("{$Command} ".escapeshellarg($this->LogPath));
$process = new Process([$Command, $this->LogPath]);
$process->run();
$Out = $process->getOutput();

if ($Out == null || Util::strposArray($Out, $BadStrings) !== false || strpos($Out, $GoodString) === false) {
$this->Checksum = false;
}


Chargement…
Annuler
Enregistrer