diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php new file mode 100644 index 0000000..5fd203d --- /dev/null +++ b/.php-cs-fixer.php @@ -0,0 +1,20 @@ +in(__DIR__) + ->name('*.php'); + +$config = new Config(); + +$rules = [ + '@PER-CS2.0' => true, + 'trailing_comma_in_multiline' => ['elements' => ['arguments', 'array_destructuring', 'arrays']], // For PHP 7.4 compatibility +]; + +return $config + ->setRules($rules) + ->setFinder($finder) + ->setUsingCache(false); diff --git a/ajax/agent.php b/ajax/agent.php index 8ce4a5e..16da5e9 100644 --- a/ajax/agent.php +++ b/ajax/agent.php @@ -41,6 +41,7 @@ $agent = new Agent(); if (!$agent->getFromDB($_POST['id'])) { Response::sendError(404, 'Unable to load agent #' . $_POST['id']); + return; }; $answer = []; diff --git a/composer.json b/composer.json index 6f36318..d5f084b 100644 --- a/composer.json +++ b/composer.json @@ -3,10 +3,10 @@ "php": ">=7.4" }, "require-dev": { + "friendsofphp/php-cs-fixer": "^3.64", "glpi-project/tools": "^0.7.3", "php-parallel-lint/php-parallel-lint": "^1.4", - "phpstan/phpstan": "^1.12", - "squizlabs/php_codesniffer": "^3.10" + "phpstan/phpstan": "^1.12" }, "config": { "optimize-autoloader": true, diff --git a/composer.lock b/composer.lock index 716035c..3207044 100644 --- a/composer.lock +++ b/composer.lock @@ -4,205 +4,323 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "9d574d428e2e035c25f4e1f17d056fbf", + "content-hash": "69c34dca7bbce24bdf22afdabc711f78", "packages": [], "packages-dev": [ { - "name": "glpi-project/tools", - "version": "0.7.3", + "name": "clue/ndjson-react", + "version": "v1.3.0", "source": { "type": "git", - "url": "https://github.com/glpi-project/tools.git", - "reference": "a076482b057a727a9dcf155af40dac6c26a7b7c6" + "url": "https://github.com/clue/reactphp-ndjson.git", + "reference": "392dc165fce93b5bb5c637b67e59619223c931b0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/glpi-project/tools/zipball/a076482b057a727a9dcf155af40dac6c26a7b7c6", - "reference": "a076482b057a727a9dcf155af40dac6c26a7b7c6", + "url": "https://api.github.com/repos/clue/reactphp-ndjson/zipball/392dc165fce93b5bb5c637b67e59619223c931b0", + "reference": "392dc165fce93b5bb5c637b67e59619223c931b0", "shasum": "" }, "require": { - "symfony/console": "^5.4 || ^6.0", - "twig/twig": "^3.3" + "php": ">=5.3", + "react/stream": "^1.2" }, "require-dev": { - "nikic/php-parser": "^4.13", - "phpstan/phpstan-src": "^1.10" + "phpunit/phpunit": "^9.5 || ^5.7 || ^4.8.35", + "react/event-loop": "^1.2" }, - "bin": [ - "bin/extract-locales", - "bin/licence-headers-check", - "tools/plugin-release" - ], "type": "library", "autoload": { "psr-4": { - "GlpiProject\\Tools\\": "src/" + "Clue\\React\\NDJson\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "GPL-3.0-or-later" + "MIT" ], "authors": [ { - "name": "Teclib'", - "email": "glpi@teclib.com", - "homepage": "http://teclib-group.com" + "name": "Christian Lück", + "email": "christian@clue.engineering" } ], - "description": "Various tools for GLPI and its plugins", + "description": "Streaming newline-delimited JSON (NDJSON) parser and encoder for ReactPHP.", + "homepage": "https://github.com/clue/reactphp-ndjson", "keywords": [ - "glpi", - "plugins", - "tools" + "NDJSON", + "json", + "jsonlines", + "newline", + "reactphp", + "streaming" ], "support": { - "issues": "https://github.com/glpi-project/tools/issues", - "source": "https://github.com/glpi-project/tools" + "issues": "https://github.com/clue/reactphp-ndjson/issues", + "source": "https://github.com/clue/reactphp-ndjson/tree/v1.3.0" }, - "time": "2024-06-20T08:36:22+00:00" + "funding": [ + { + "url": "https://clue.engineering/support", + "type": "custom" + }, + { + "url": "https://github.com/clue", + "type": "github" + } + ], + "time": "2022-12-23T10:58:28+00:00" }, { - "name": "php-parallel-lint/php-parallel-lint", - "version": "v1.4.0", + "name": "composer/pcre", + "version": "3.3.1", "source": { "type": "git", - "url": "https://github.com/php-parallel-lint/PHP-Parallel-Lint.git", - "reference": "6db563514f27e19595a19f45a4bf757b6401194e" + "url": "https://github.com/composer/pcre.git", + "reference": "63aaeac21d7e775ff9bc9d45021e1745c97521c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-parallel-lint/PHP-Parallel-Lint/zipball/6db563514f27e19595a19f45a4bf757b6401194e", - "reference": "6db563514f27e19595a19f45a4bf757b6401194e", + "url": "https://api.github.com/repos/composer/pcre/zipball/63aaeac21d7e775ff9bc9d45021e1745c97521c4", + "reference": "63aaeac21d7e775ff9bc9d45021e1745c97521c4", "shasum": "" }, "require": { - "ext-json": "*", - "php": ">=5.3.0" + "php": "^7.4 || ^8.0" }, - "replace": { - "grogy/php-parallel-lint": "*", - "jakub-onderka/php-parallel-lint": "*" + "conflict": { + "phpstan/phpstan": "<1.11.10" }, "require-dev": { - "nette/tester": "^1.3 || ^2.0", - "php-parallel-lint/php-console-highlighter": "0.* || ^1.0", - "squizlabs/php_codesniffer": "^3.6" + "phpstan/phpstan": "^1.11.10", + "phpstan/phpstan-strict-rules": "^1.1", + "phpunit/phpunit": "^8 || ^9" }, - "suggest": { - "php-parallel-lint/php-console-highlighter": "Highlight syntax in code snippet" + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.x-dev" + }, + "phpstan": { + "includes": [ + "extension.neon" + ] + } }, - "bin": [ - "parallel-lint" + "autoload": { + "psr-4": { + "Composer\\Pcre\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "PCRE wrapping library that offers type-safe preg_* replacements.", + "keywords": [ + "PCRE", + "preg", + "regex", + "regular expression" + ], + "support": { + "issues": "https://github.com/composer/pcre/issues", + "source": "https://github.com/composer/pcre/tree/3.3.1" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } ], + "time": "2024-08-27T18:44:43+00:00" + }, + { + "name": "composer/semver", + "version": "3.4.2", + "source": { + "type": "git", + "url": "https://github.com/composer/semver.git", + "reference": "c51258e759afdb17f1fd1fe83bc12baaef6309d6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/semver/zipball/c51258e759afdb17f1fd1fe83bc12baaef6309d6", + "reference": "c51258e759afdb17f1fd1fe83bc12baaef6309d6", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^1.4", + "symfony/phpunit-bridge": "^4.2 || ^5" + }, "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.x-dev" + } + }, "autoload": { - "classmap": [ - "./src/" - ] + "psr-4": { + "Composer\\Semver\\": "src" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-2-Clause" + "MIT" ], "authors": [ { - "name": "Jakub Onderka", - "email": "ahoj@jakubonderka.cz" + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + }, + { + "name": "Rob Bast", + "email": "rob.bast@gmail.com", + "homepage": "http://robbast.nl" } ], - "description": "This tool checks the syntax of PHP files about 20x faster than serial check.", - "homepage": "https://github.com/php-parallel-lint/PHP-Parallel-Lint", + "description": "Semver library that offers utilities, version constraint parsing and validation.", "keywords": [ - "lint", - "static analysis" + "semantic", + "semver", + "validation", + "versioning" ], "support": { - "issues": "https://github.com/php-parallel-lint/PHP-Parallel-Lint/issues", - "source": "https://github.com/php-parallel-lint/PHP-Parallel-Lint/tree/v1.4.0" + "irc": "ircs://irc.libera.chat:6697/composer", + "issues": "https://github.com/composer/semver/issues", + "source": "https://github.com/composer/semver/tree/3.4.2" }, - "time": "2024-03-27T12:14:49+00:00" + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2024-07-12T11:35:52+00:00" }, { - "name": "phpstan/phpstan", - "version": "1.12.0", + "name": "composer/xdebug-handler", + "version": "3.0.5", "source": { "type": "git", - "url": "https://github.com/phpstan/phpstan.git", - "reference": "384af967d35b2162f69526c7276acadce534d0e1" + "url": "https://github.com/composer/xdebug-handler.git", + "reference": "6c1925561632e83d60a44492e0b344cf48ab85ef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/384af967d35b2162f69526c7276acadce534d0e1", - "reference": "384af967d35b2162f69526c7276acadce534d0e1", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/6c1925561632e83d60a44492e0b344cf48ab85ef", + "reference": "6c1925561632e83d60a44492e0b344cf48ab85ef", "shasum": "" }, "require": { - "php": "^7.2|^8.0" + "composer/pcre": "^1 || ^2 || ^3", + "php": "^7.2.5 || ^8.0", + "psr/log": "^1 || ^2 || ^3" }, - "conflict": { - "phpstan/phpstan-shim": "*" + "require-dev": { + "phpstan/phpstan": "^1.0", + "phpstan/phpstan-strict-rules": "^1.1", + "phpunit/phpunit": "^8.5 || ^9.6 || ^10.5" }, - "bin": [ - "phpstan", - "phpstan.phar" - ], "type": "library", "autoload": { - "files": [ - "bootstrap.php" - ] + "psr-4": { + "Composer\\XdebugHandler\\": "src" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], - "description": "PHPStan - PHP Static Analysis Tool", + "authors": [ + { + "name": "John Stevenson", + "email": "john-stevenson@blueyonder.co.uk" + } + ], + "description": "Restarts a process without Xdebug.", "keywords": [ - "dev", - "static analysis" + "Xdebug", + "performance" ], "support": { - "docs": "https://phpstan.org/user-guide/getting-started", - "forum": "https://github.com/phpstan/phpstan/discussions", - "issues": "https://github.com/phpstan/phpstan/issues", - "security": "https://github.com/phpstan/phpstan/security/policy", - "source": "https://github.com/phpstan/phpstan-src" + "irc": "ircs://irc.libera.chat:6697/composer", + "issues": "https://github.com/composer/xdebug-handler/issues", + "source": "https://github.com/composer/xdebug-handler/tree/3.0.5" }, "funding": [ { - "url": "https://github.com/ondrejmirtes", - "type": "github" + "url": "https://packagist.com", + "type": "custom" }, { - "url": "https://github.com/phpstan", + "url": "https://github.com/composer", "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" } ], - "time": "2024-08-27T09:18:05+00:00" + "time": "2024-05-06T16:37:16+00:00" }, { - "name": "psr/container", - "version": "1.1.2", + "name": "evenement/evenement", + "version": "v3.0.2", "source": { "type": "git", - "url": "https://github.com/php-fig/container.git", - "reference": "513e0666f7216c7459170d56df27dfcefe1689ea" + "url": "https://github.com/igorw/evenement.git", + "reference": "0a16b0d71ab13284339abb99d9d2bd813640efbc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea", - "reference": "513e0666f7216c7459170d56df27dfcefe1689ea", + "url": "https://api.github.com/repos/igorw/evenement/zipball/0a16b0d71ab13284339abb99d9d2bd813640efbc", + "reference": "0a16b0d71ab13284339abb99d9d2bd813640efbc", "shasum": "" }, "require": { - "php": ">=7.4.0" + "php": ">=7.0" + }, + "require-dev": { + "phpunit/phpunit": "^9 || ^6" }, "type": "library", "autoload": { "psr-4": { - "Psr\\Container\\": "src/" + "Evenement\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -211,158 +329,1524 @@ ], "authors": [ { - "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" + "name": "Igor Wiedler", + "email": "igor@wiedler.ch" } ], - "description": "Common Container Interface (PHP FIG PSR-11)", - "homepage": "https://github.com/php-fig/container", + "description": "Événement is a very simple event dispatching library for PHP", "keywords": [ - "PSR-11", - "container", - "container-interface", - "container-interop", - "psr" + "event-dispatcher", + "event-emitter" ], "support": { - "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/1.1.2" + "issues": "https://github.com/igorw/evenement/issues", + "source": "https://github.com/igorw/evenement/tree/v3.0.2" }, - "time": "2021-11-05T16:50:12+00:00" + "time": "2023-08-08T05:53:35+00:00" }, { - "name": "squizlabs/php_codesniffer", - "version": "3.10.2", + "name": "fidry/cpu-core-counter", + "version": "1.2.0", "source": { "type": "git", - "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "86e5f5dd9a840c46810ebe5ff1885581c42a3017" + "url": "https://github.com/theofidry/cpu-core-counter.git", + "reference": "8520451a140d3f46ac33042715115e290cf5785f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/86e5f5dd9a840c46810ebe5ff1885581c42a3017", - "reference": "86e5f5dd9a840c46810ebe5ff1885581c42a3017", + "url": "https://api.github.com/repos/theofidry/cpu-core-counter/zipball/8520451a140d3f46ac33042715115e290cf5785f", + "reference": "8520451a140d3f46ac33042715115e290cf5785f", "shasum": "" }, "require": { - "ext-simplexml": "*", - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": ">=5.4.0" + "php": "^7.2 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4" + "fidry/makefile": "^0.2.0", + "fidry/php-cs-fixer-config": "^1.1.2", + "phpstan/extension-installer": "^1.2.0", + "phpstan/phpstan": "^1.9.2", + "phpstan/phpstan-deprecation-rules": "^1.0.0", + "phpstan/phpstan-phpunit": "^1.2.2", + "phpstan/phpstan-strict-rules": "^1.4.4", + "phpunit/phpunit": "^8.5.31 || ^9.5.26", + "webmozarts/strict-phpunit": "^7.5" }, - "bin": [ - "bin/phpcbf", - "bin/phpcs" - ], "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.x-dev" + "autoload": { + "psr-4": { + "Fidry\\CpuCoreCounter\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Greg Sherwood", - "role": "Former lead" + "name": "Théo FIDRY", + "email": "theo.fidry@gmail.com" + } + ], + "description": "Tiny utility to get the number of CPU cores.", + "keywords": [ + "CPU", + "core" + ], + "support": { + "issues": "https://github.com/theofidry/cpu-core-counter/issues", + "source": "https://github.com/theofidry/cpu-core-counter/tree/1.2.0" + }, + "funding": [ + { + "url": "https://github.com/theofidry", + "type": "github" + } + ], + "time": "2024-08-06T10:04:20+00:00" + }, + { + "name": "friendsofphp/php-cs-fixer", + "version": "v3.64.0", + "source": { + "type": "git", + "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", + "reference": "58dd9c931c785a79739310aef5178928305ffa67" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/58dd9c931c785a79739310aef5178928305ffa67", + "reference": "58dd9c931c785a79739310aef5178928305ffa67", + "shasum": "" + }, + "require": { + "clue/ndjson-react": "^1.0", + "composer/semver": "^3.4", + "composer/xdebug-handler": "^3.0.3", + "ext-filter": "*", + "ext-json": "*", + "ext-tokenizer": "*", + "fidry/cpu-core-counter": "^1.0", + "php": "^7.4 || ^8.0", + "react/child-process": "^0.6.5", + "react/event-loop": "^1.0", + "react/promise": "^2.0 || ^3.0", + "react/socket": "^1.0", + "react/stream": "^1.0", + "sebastian/diff": "^4.0 || ^5.0 || ^6.0", + "symfony/console": "^5.4 || ^6.0 || ^7.0", + "symfony/event-dispatcher": "^5.4 || ^6.0 || ^7.0", + "symfony/filesystem": "^5.4 || ^6.0 || ^7.0", + "symfony/finder": "^5.4 || ^6.0 || ^7.0", + "symfony/options-resolver": "^5.4 || ^6.0 || ^7.0", + "symfony/polyfill-mbstring": "^1.28", + "symfony/polyfill-php80": "^1.28", + "symfony/polyfill-php81": "^1.28", + "symfony/process": "^5.4 || ^6.0 || ^7.0", + "symfony/stopwatch": "^5.4 || ^6.0 || ^7.0" + }, + "require-dev": { + "facile-it/paraunit": "^1.3 || ^2.3", + "infection/infection": "^0.29.5", + "justinrainbow/json-schema": "^5.2", + "keradus/cli-executor": "^2.1", + "mikey179/vfsstream": "^1.6.11", + "php-coveralls/php-coveralls": "^2.7", + "php-cs-fixer/accessible-object": "^1.1", + "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.5", + "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.5", + "phpunit/phpunit": "^9.6.19 || ^10.5.21 || ^11.2", + "symfony/var-dumper": "^5.4 || ^6.0 || ^7.0", + "symfony/yaml": "^5.4 || ^6.0 || ^7.0" + }, + "suggest": { + "ext-dom": "For handling output formats in XML", + "ext-mbstring": "For handling non-UTF8 characters." + }, + "bin": [ + "php-cs-fixer" + ], + "type": "application", + "autoload": { + "psr-4": { + "PhpCsFixer\\": "src/" }, + "exclude-from-classmap": [ + "src/Fixer/Internal/*" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ { - "name": "Juliette Reinders Folmer", - "role": "Current lead" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" }, { - "name": "Contributors", - "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer/graphs/contributors" + "name": "Dariusz Rumiński", + "email": "dariusz.ruminski@gmail.com" } ], - "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", - "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer", + "description": "A tool to automatically fix PHP code style", "keywords": [ - "phpcs", + "Static code analysis", + "fixer", "standards", "static analysis" ], "support": { - "issues": "https://github.com/PHPCSStandards/PHP_CodeSniffer/issues", - "security": "https://github.com/PHPCSStandards/PHP_CodeSniffer/security/policy", - "source": "https://github.com/PHPCSStandards/PHP_CodeSniffer", - "wiki": "https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki" + "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.64.0" + }, + "funding": [ + { + "url": "https://github.com/keradus", + "type": "github" + } + ], + "time": "2024-08-30T23:09:38+00:00" + }, + { + "name": "glpi-project/tools", + "version": "0.7.3", + "source": { + "type": "git", + "url": "https://github.com/glpi-project/tools.git", + "reference": "a076482b057a727a9dcf155af40dac6c26a7b7c6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/glpi-project/tools/zipball/a076482b057a727a9dcf155af40dac6c26a7b7c6", + "reference": "a076482b057a727a9dcf155af40dac6c26a7b7c6", + "shasum": "" + }, + "require": { + "symfony/console": "^5.4 || ^6.0", + "twig/twig": "^3.3" + }, + "require-dev": { + "nikic/php-parser": "^4.13", + "phpstan/phpstan-src": "^1.10" + }, + "bin": [ + "bin/extract-locales", + "bin/licence-headers-check", + "tools/plugin-release" + ], + "type": "library", + "autoload": { + "psr-4": { + "GlpiProject\\Tools\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-3.0-or-later" + ], + "authors": [ + { + "name": "Teclib'", + "email": "glpi@teclib.com", + "homepage": "http://teclib-group.com" + } + ], + "description": "Various tools for GLPI and its plugins", + "keywords": [ + "glpi", + "plugins", + "tools" + ], + "support": { + "issues": "https://github.com/glpi-project/tools/issues", + "source": "https://github.com/glpi-project/tools" + }, + "time": "2024-06-20T08:36:22+00:00" + }, + { + "name": "php-parallel-lint/php-parallel-lint", + "version": "v1.4.0", + "source": { + "type": "git", + "url": "https://github.com/php-parallel-lint/PHP-Parallel-Lint.git", + "reference": "6db563514f27e19595a19f45a4bf757b6401194e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-parallel-lint/PHP-Parallel-Lint/zipball/6db563514f27e19595a19f45a4bf757b6401194e", + "reference": "6db563514f27e19595a19f45a4bf757b6401194e", + "shasum": "" + }, + "require": { + "ext-json": "*", + "php": ">=5.3.0" + }, + "replace": { + "grogy/php-parallel-lint": "*", + "jakub-onderka/php-parallel-lint": "*" + }, + "require-dev": { + "nette/tester": "^1.3 || ^2.0", + "php-parallel-lint/php-console-highlighter": "0.* || ^1.0", + "squizlabs/php_codesniffer": "^3.6" + }, + "suggest": { + "php-parallel-lint/php-console-highlighter": "Highlight syntax in code snippet" + }, + "bin": [ + "parallel-lint" + ], + "type": "library", + "autoload": { + "classmap": [ + "./src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "authors": [ + { + "name": "Jakub Onderka", + "email": "ahoj@jakubonderka.cz" + } + ], + "description": "This tool checks the syntax of PHP files about 20x faster than serial check.", + "homepage": "https://github.com/php-parallel-lint/PHP-Parallel-Lint", + "keywords": [ + "lint", + "static analysis" + ], + "support": { + "issues": "https://github.com/php-parallel-lint/PHP-Parallel-Lint/issues", + "source": "https://github.com/php-parallel-lint/PHP-Parallel-Lint/tree/v1.4.0" + }, + "time": "2024-03-27T12:14:49+00:00" + }, + { + "name": "phpstan/phpstan", + "version": "1.12.0", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan.git", + "reference": "384af967d35b2162f69526c7276acadce534d0e1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/384af967d35b2162f69526c7276acadce534d0e1", + "reference": "384af967d35b2162f69526c7276acadce534d0e1", + "shasum": "" + }, + "require": { + "php": "^7.2|^8.0" + }, + "conflict": { + "phpstan/phpstan-shim": "*" + }, + "bin": [ + "phpstan", + "phpstan.phar" + ], + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPStan - PHP Static Analysis Tool", + "keywords": [ + "dev", + "static analysis" + ], + "support": { + "docs": "https://phpstan.org/user-guide/getting-started", + "forum": "https://github.com/phpstan/phpstan/discussions", + "issues": "https://github.com/phpstan/phpstan/issues", + "security": "https://github.com/phpstan/phpstan/security/policy", + "source": "https://github.com/phpstan/phpstan-src" + }, + "funding": [ + { + "url": "https://github.com/ondrejmirtes", + "type": "github" + }, + { + "url": "https://github.com/phpstan", + "type": "github" + } + ], + "time": "2024-08-27T09:18:05+00:00" + }, + { + "name": "psr/container", + "version": "1.1.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea", + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea", + "shasum": "" + }, + "require": { + "php": ">=7.4.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "support": { + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/1.1.2" + }, + "time": "2021-11-05T16:50:12+00:00" + }, + { + "name": "psr/event-dispatcher", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/event-dispatcher.git", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", + "shasum": "" + }, + "require": { + "php": ">=7.2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\EventDispatcher\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Standard interfaces for event handling.", + "keywords": [ + "events", + "psr", + "psr-14" + ], + "support": { + "issues": "https://github.com/php-fig/event-dispatcher/issues", + "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" + }, + "time": "2019-01-08T18:20:26+00:00" + }, + { + "name": "psr/log", + "version": "1.1.4", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "support": { + "source": "https://github.com/php-fig/log/tree/1.1.4" + }, + "time": "2021-05-03T11:20:27+00:00" + }, + { + "name": "react/cache", + "version": "v1.2.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/cache.git", + "reference": "d47c472b64aa5608225f47965a484b75c7817d5b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/cache/zipball/d47c472b64aa5608225f47965a484b75c7817d5b", + "reference": "d47c472b64aa5608225f47965a484b75c7817d5b", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "react/promise": "^3.0 || ^2.0 || ^1.1" + }, + "require-dev": { + "phpunit/phpunit": "^9.5 || ^5.7 || ^4.8.35" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Async, Promise-based cache interface for ReactPHP", + "keywords": [ + "cache", + "caching", + "promise", + "reactphp" + ], + "support": { + "issues": "https://github.com/reactphp/cache/issues", + "source": "https://github.com/reactphp/cache/tree/v1.2.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2022-11-30T15:59:55+00:00" + }, + { + "name": "react/child-process", + "version": "v0.6.5", + "source": { + "type": "git", + "url": "https://github.com/reactphp/child-process.git", + "reference": "e71eb1aa55f057c7a4a0d08d06b0b0a484bead43" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/child-process/zipball/e71eb1aa55f057c7a4a0d08d06b0b0a484bead43", + "reference": "e71eb1aa55f057c7a4a0d08d06b0b0a484bead43", + "shasum": "" + }, + "require": { + "evenement/evenement": "^3.0 || ^2.0 || ^1.0", + "php": ">=5.3.0", + "react/event-loop": "^1.2", + "react/stream": "^1.2" + }, + "require-dev": { + "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.35", + "react/socket": "^1.8", + "sebastian/environment": "^5.0 || ^3.0 || ^2.0 || ^1.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\ChildProcess\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Event-driven library for executing child processes with ReactPHP.", + "keywords": [ + "event-driven", + "process", + "reactphp" + ], + "support": { + "issues": "https://github.com/reactphp/child-process/issues", + "source": "https://github.com/reactphp/child-process/tree/v0.6.5" + }, + "funding": [ + { + "url": "https://github.com/WyriHaximus", + "type": "github" + }, + { + "url": "https://github.com/clue", + "type": "github" + } + ], + "time": "2022-09-16T13:41:56+00:00" + }, + { + "name": "react/dns", + "version": "v1.13.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/dns.git", + "reference": "eb8ae001b5a455665c89c1df97f6fb682f8fb0f5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/dns/zipball/eb8ae001b5a455665c89c1df97f6fb682f8fb0f5", + "reference": "eb8ae001b5a455665c89c1df97f6fb682f8fb0f5", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "react/cache": "^1.0 || ^0.6 || ^0.5", + "react/event-loop": "^1.2", + "react/promise": "^3.2 || ^2.7 || ^1.2.1" + }, + "require-dev": { + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36", + "react/async": "^4.3 || ^3 || ^2", + "react/promise-timer": "^1.11" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Dns\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Async DNS resolver for ReactPHP", + "keywords": [ + "async", + "dns", + "dns-resolver", + "reactphp" + ], + "support": { + "issues": "https://github.com/reactphp/dns/issues", + "source": "https://github.com/reactphp/dns/tree/v1.13.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2024-06-13T14:18:03+00:00" + }, + { + "name": "react/event-loop", + "version": "v1.5.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/event-loop.git", + "reference": "bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/event-loop/zipball/bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354", + "reference": "bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36" + }, + "suggest": { + "ext-pcntl": "For signal handling support when using the StreamSelectLoop" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\EventLoop\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "ReactPHP's core reactor event loop that libraries can use for evented I/O.", + "keywords": [ + "asynchronous", + "event-loop" + ], + "support": { + "issues": "https://github.com/reactphp/event-loop/issues", + "source": "https://github.com/reactphp/event-loop/tree/v1.5.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2023-11-13T13:48:05+00:00" + }, + { + "name": "react/promise", + "version": "v3.2.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/promise.git", + "reference": "8a164643313c71354582dc850b42b33fa12a4b63" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/promise/zipball/8a164643313c71354582dc850b42b33fa12a4b63", + "reference": "8a164643313c71354582dc850b42b33fa12a4b63", + "shasum": "" + }, + "require": { + "php": ">=7.1.0" + }, + "require-dev": { + "phpstan/phpstan": "1.10.39 || 1.4.10", + "phpunit/phpunit": "^9.6 || ^7.5" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "React\\Promise\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "A lightweight implementation of CommonJS Promises/A for PHP", + "keywords": [ + "promise", + "promises" + ], + "support": { + "issues": "https://github.com/reactphp/promise/issues", + "source": "https://github.com/reactphp/promise/tree/v3.2.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2024-05-24T10:39:05+00:00" + }, + { + "name": "react/socket", + "version": "v1.16.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/socket.git", + "reference": "23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/socket/zipball/23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1", + "reference": "23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1", + "shasum": "" + }, + "require": { + "evenement/evenement": "^3.0 || ^2.0 || ^1.0", + "php": ">=5.3.0", + "react/dns": "^1.13", + "react/event-loop": "^1.2", + "react/promise": "^3.2 || ^2.6 || ^1.2.1", + "react/stream": "^1.4" + }, + "require-dev": { + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36", + "react/async": "^4.3 || ^3.3 || ^2", + "react/promise-stream": "^1.4", + "react/promise-timer": "^1.11" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Socket\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Async, streaming plaintext TCP/IP and secure TLS socket server and client connections for ReactPHP", + "keywords": [ + "Connection", + "Socket", + "async", + "reactphp", + "stream" + ], + "support": { + "issues": "https://github.com/reactphp/socket/issues", + "source": "https://github.com/reactphp/socket/tree/v1.16.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2024-07-26T10:38:09+00:00" + }, + { + "name": "react/stream", + "version": "v1.4.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/stream.git", + "reference": "1e5b0acb8fe55143b5b426817155190eb6f5b18d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/stream/zipball/1e5b0acb8fe55143b5b426817155190eb6f5b18d", + "reference": "1e5b0acb8fe55143b5b426817155190eb6f5b18d", + "shasum": "" + }, + "require": { + "evenement/evenement": "^3.0 || ^2.0 || ^1.0", + "php": ">=5.3.8", + "react/event-loop": "^1.2" + }, + "require-dev": { + "clue/stream-filter": "~1.2", + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Stream\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Event-driven readable and writable streams for non-blocking I/O in ReactPHP", + "keywords": [ + "event-driven", + "io", + "non-blocking", + "pipe", + "reactphp", + "readable", + "stream", + "writable" + ], + "support": { + "issues": "https://github.com/reactphp/stream/issues", + "source": "https://github.com/reactphp/stream/tree/v1.4.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2024-06-11T12:45:25+00:00" + }, + { + "name": "sebastian/diff", + "version": "4.0.6", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/ba01945089c3a293b01ba9badc29ad55b106b0bc", + "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3", + "symfony/process": "^4.2 || ^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff", + "udiff", + "unidiff", + "unified diff" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/diff/issues", + "source": "https://github.com/sebastianbergmann/diff/tree/4.0.6" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-02T06:30:58+00:00" + }, + { + "name": "symfony/console", + "version": "v5.4.42", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "cef62396a0477e94fc52e87a17c6e5c32e226b7f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/cef62396a0477e94fc52e87a17c6e5c32e226b7f", + "reference": "cef62396a0477e94fc52e87a17c6e5c32e226b7f", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php73": "^1.9", + "symfony/polyfill-php80": "^1.16", + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/string": "^5.1|^6.0" + }, + "conflict": { + "psr/log": ">=3", + "symfony/dependency-injection": "<4.4", + "symfony/dotenv": "<5.1", + "symfony/event-dispatcher": "<4.4", + "symfony/lock": "<4.4", + "symfony/process": "<4.4" + }, + "provide": { + "psr/log-implementation": "1.0|2.0" + }, + "require-dev": { + "psr/log": "^1|^2", + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/event-dispatcher": "^4.4|^5.0|^6.0", + "symfony/lock": "^4.4|^5.0|^6.0", + "symfony/process": "^4.4|^5.0|^6.0", + "symfony/var-dumper": "^4.4|^5.0|^6.0" + }, + "suggest": { + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/lock": "", + "symfony/process": "" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Console\\": "" + }, + "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": "Eases the creation of beautiful and testable command line interfaces", + "homepage": "https://symfony.com", + "keywords": [ + "cli", + "command-line", + "console", + "terminal" + ], + "support": { + "source": "https://github.com/symfony/console/tree/v5.4.42" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-07-26T12:21:55+00:00" + }, + { + "name": "symfony/deprecation-contracts", + "version": "v2.5.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "80d075412b557d41002320b96a096ca65aa2c98d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/80d075412b557d41002320b96a096ca65aa2c98d", + "reference": "80d075412b557d41002320b96a096ca65aa2c98d", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "files": [ + "function.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "A generic function and convention to trigger deprecation notices", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.3" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-01-24T14:02:46+00:00" + }, + { + "name": "symfony/event-dispatcher", + "version": "v5.4.40", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "a54e2a8a114065f31020d6a89ede83e34c3b27a4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/a54e2a8a114065f31020d6a89ede83e34c3b27a4", + "reference": "a54e2a8a114065f31020d6a89ede83e34c3b27a4", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/event-dispatcher-contracts": "^2|^3", + "symfony/polyfill-php80": "^1.16" + }, + "conflict": { + "symfony/dependency-injection": "<4.4" + }, + "provide": { + "psr/event-dispatcher-implementation": "1.0", + "symfony/event-dispatcher-implementation": "2.0" + }, + "require-dev": { + "psr/log": "^1|^2|^3", + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/error-handler": "^4.4|^5.0|^6.0", + "symfony/expression-language": "^4.4|^5.0|^6.0", + "symfony/http-foundation": "^4.4|^5.0|^6.0", + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/stopwatch": "^4.4|^5.0|^6.0" + }, + "suggest": { + "symfony/dependency-injection": "", + "symfony/http-kernel": "" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\EventDispatcher\\": "" + }, + "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": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/event-dispatcher/tree/v5.4.40" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-05-31T14:33:22+00:00" + }, + { + "name": "symfony/event-dispatcher-contracts", + "version": "v2.5.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher-contracts.git", + "reference": "540f4c73e87fd0c71ca44a6aa305d024ac68cb73" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/540f4c73e87fd0c71ca44a6aa305d024ac68cb73", + "reference": "540f4c73e87fd0c71ca44a6aa305d024ac68cb73", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "psr/event-dispatcher": "^1" + }, + "suggest": { + "symfony/event-dispatcher-implementation": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\EventDispatcher\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to dispatching event", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v2.5.3" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-01-23T13:51:25+00:00" + }, + { + "name": "symfony/filesystem", + "version": "v5.4.41", + "source": { + "type": "git", + "url": "https://github.com/symfony/filesystem.git", + "reference": "6d29dd9340b372fa603f04e6df4dd76bb808591e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/6d29dd9340b372fa603f04e6df4dd76bb808591e", + "reference": "6d29dd9340b372fa603f04e6df4dd76bb808591e", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-mbstring": "~1.8", + "symfony/polyfill-php80": "^1.16" + }, + "require-dev": { + "symfony/process": "^5.4|^6.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Filesystem\\": "" + }, + "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": "Provides basic utilities for the filesystem", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/filesystem/tree/v5.4.41" }, "funding": [ { - "url": "https://github.com/PHPCSStandards", - "type": "github" + "url": "https://symfony.com/sponsor", + "type": "custom" }, { - "url": "https://github.com/jrfnl", + "url": "https://github.com/fabpot", "type": "github" }, { - "url": "https://opencollective.com/php_codesniffer", - "type": "open_collective" + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" } ], - "time": "2024-07-21T23:26:44+00:00" + "time": "2024-06-28T09:36:24+00:00" }, { - "name": "symfony/console", - "version": "v5.4.42", + "name": "symfony/finder", + "version": "v5.4.43", "source": { "type": "git", - "url": "https://github.com/symfony/console.git", - "reference": "cef62396a0477e94fc52e87a17c6e5c32e226b7f" + "url": "https://github.com/symfony/finder.git", + "reference": "ae25a9145a900764158d439653d5630191155ca0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/cef62396a0477e94fc52e87a17c6e5c32e226b7f", - "reference": "cef62396a0477e94fc52e87a17c6e5c32e226b7f", + "url": "https://api.github.com/repos/symfony/finder/zipball/ae25a9145a900764158d439653d5630191155ca0", + "reference": "ae25a9145a900764158d439653d5630191155ca0", "shasum": "" }, "require": { "php": ">=7.2.5", "symfony/deprecation-contracts": "^2.1|^3", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php73": "^1.9", - "symfony/polyfill-php80": "^1.16", - "symfony/service-contracts": "^1.1|^2|^3", - "symfony/string": "^5.1|^6.0" - }, - "conflict": { - "psr/log": ">=3", - "symfony/dependency-injection": "<4.4", - "symfony/dotenv": "<5.1", - "symfony/event-dispatcher": "<4.4", - "symfony/lock": "<4.4", - "symfony/process": "<4.4" - }, - "provide": { - "psr/log-implementation": "1.0|2.0" - }, - "require-dev": { - "psr/log": "^1|^2", - "symfony/config": "^4.4|^5.0|^6.0", - "symfony/dependency-injection": "^4.4|^5.0|^6.0", - "symfony/event-dispatcher": "^4.4|^5.0|^6.0", - "symfony/lock": "^4.4|^5.0|^6.0", - "symfony/process": "^4.4|^5.0|^6.0", - "symfony/var-dumper": "^4.4|^5.0|^6.0" - }, - "suggest": { - "psr/log": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/lock": "", - "symfony/process": "" + "symfony/polyfill-php80": "^1.16" }, "type": "library", "autoload": { "psr-4": { - "Symfony\\Component\\Console\\": "" + "Symfony\\Component\\Finder\\": "" }, "exclude-from-classmap": [ "/Tests/" @@ -382,16 +1866,10 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Eases the creation of beautiful and testable command line interfaces", + "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", - "keywords": [ - "cli", - "command-line", - "console", - "terminal" - ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.42" + "source": "https://github.com/symfony/finder/tree/v5.4.43" }, "funding": [ { @@ -407,38 +1885,35 @@ "type": "tidelift" } ], - "time": "2024-07-26T12:21:55+00:00" + "time": "2024-08-13T14:03:51+00:00" }, { - "name": "symfony/deprecation-contracts", - "version": "v2.5.3", + "name": "symfony/options-resolver", + "version": "v5.4.40", "source": { "type": "git", - "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "80d075412b557d41002320b96a096ca65aa2c98d" + "url": "https://github.com/symfony/options-resolver.git", + "reference": "bd1afbde6613a8d6b956115e0e14b196191fd0c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/80d075412b557d41002320b96a096ca65aa2c98d", - "reference": "80d075412b557d41002320b96a096ca65aa2c98d", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/bd1afbde6613a8d6b956115e0e14b196191fd0c4", + "reference": "bd1afbde6613a8d6b956115e0e14b196191fd0c4", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-php73": "~1.0", + "symfony/polyfill-php80": "^1.16" }, "type": "library", - "extra": { - "branch-alias": { - "dev-main": "2.5-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" - } - }, "autoload": { - "files": [ - "function.php" + "psr-4": { + "Symfony\\Component\\OptionsResolver\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -447,18 +1922,23 @@ ], "authors": [ { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "A generic function and convention to trigger deprecation notices", + "description": "Provides an improved replacement for the array_replace PHP function", "homepage": "https://symfony.com", + "keywords": [ + "config", + "configuration", + "options" + ], "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.3" + "source": "https://github.com/symfony/options-resolver/tree/v5.4.40" }, "funding": [ { @@ -474,7 +1954,7 @@ "type": "tidelift" } ], - "time": "2023-01-24T14:02:46+00:00" + "time": "2024-05-31T14:33:22+00:00" }, { "name": "symfony/polyfill-ctype", @@ -950,6 +2430,144 @@ ], "time": "2024-05-31T15:07:36+00:00" }, + { + "name": "symfony/polyfill-php81", + "version": "v1.31.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php81.git", + "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", + "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "type": "library", + "extra": { + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php81\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php81/tree/v1.31.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-09T11:45:10+00:00" + }, + { + "name": "symfony/process", + "version": "v5.4.40", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "deedcb3bb4669cae2148bc920eafd2b16dc7c046" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/deedcb3bb4669cae2148bc920eafd2b16dc7c046", + "reference": "deedcb3bb4669cae2148bc920eafd2b16dc7c046", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/polyfill-php80": "^1.16" + }, + "type": "library", + "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": "Executes commands in sub-processes", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/process/tree/v5.4.40" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-05-31T14:33:22+00:00" + }, { "name": "symfony/service-contracts", "version": "v2.5.3", @@ -1033,6 +2651,68 @@ ], "time": "2023-04-21T15:04:16+00:00" }, + { + "name": "symfony/stopwatch", + "version": "v5.4.40", + "source": { + "type": "git", + "url": "https://github.com/symfony/stopwatch.git", + "reference": "0e9daf3b7c805c747638b2cc48f1649e594f9625" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/0e9daf3b7c805c747638b2cc48f1649e594f9625", + "reference": "0e9daf3b7c805c747638b2cc48f1649e594f9625", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/service-contracts": "^1|^2|^3" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Stopwatch\\": "" + }, + "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": "Provides a way to profile code", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/stopwatch/tree/v5.4.40" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-05-31T14:33:22+00:00" + }, { "name": "symfony/string", "version": "v5.4.42", diff --git a/front/computergroup.form.php b/front/computergroup.form.php index f0d3c87..03d7a5a 100644 --- a/front/computergroup.form.php +++ b/front/computergroup.form.php @@ -32,29 +32,29 @@ include('../../../inc/includes.php'); -Session::checkRight("config", READ); +Session::checkRight('config', READ); -if (!isset($_GET["id"])) { - $_GET["id"] = ""; +if (!isset($_GET['id'])) { + $_GET['id'] = ''; } -if (!isset($_GET["withtemplate"])) { - $_GET["withtemplate"] = ""; +if (!isset($_GET['withtemplate'])) { + $_GET['withtemplate'] = ''; } -$computergroup = new PluginDatabaseinventoryComputerGroup(); +$computergroup = new PluginDatabaseinventoryComputerGroup(); $computergroupstatic = new PluginDatabaseinventoryComputerGroupStatic(); -if (isset($_POST["add"])) { +if (isset($_POST['add'])) { // Add a new computergroup $computergroup->check(-1, CREATE, $_POST); if ($newID = $computergroup->add($_POST)) { Event::log( $newID, - "PluginDatabaseinventoryComputerGroup", + 'PluginDatabaseinventoryComputerGroup', 4, - "inventory", - sprintf(__('%1$s adds the item %2$s'), $_SESSION["glpiname"], $_POST["name"]) + 'inventory', + sprintf(__('%1$s adds the item %2$s'), $_SESSION['glpiname'], $_POST['name']), ); if ($_SESSION['glpibackcreated']) { @@ -62,7 +62,7 @@ } } Html::back(); -} elseif (isset($_POST["add_staticcomputer"])) { +} elseif (isset($_POST['add_staticcomputer'])) { if (!$_POST['computers_id']) { Session::addMessageAfterRedirect(__('Please select a computer', 'databaseinventory'), false, ERROR); Html::back(); @@ -72,10 +72,10 @@ if ($newID = $computergroupstatic->add($_POST)) { Event::log( $newID, - "PluginDatabaseinventoryComputerGroupStatic", + 'PluginDatabaseinventoryComputerGroupStatic', 4, - "inventory", - sprintf(__('%1$s adds the item %2$s'), $_SESSION["glpiname"], $computergroupstatic::getTypeName(0)) + 'inventory', + sprintf(__('%1$s adds the item %2$s'), $_SESSION['glpiname'], $computergroupstatic::getTypeName(0)), ); if ($_SESSION['glpibackcreated']) { @@ -84,31 +84,31 @@ } } Html::back(); -} elseif (isset($_POST["purge"])) { +} elseif (isset($_POST['purge'])) { // purge a computergroup $computergroup->check($_POST['id'], PURGE); if ($computergroup->delete($_POST, 1)) { Event::log( - $_POST["id"], - "PluginDatabaseinventoryComputerGroup", + $_POST['id'], + 'PluginDatabaseinventoryComputerGroup', 4, - "inventory", + 'inventory', //TRANS: %s is the user login - sprintf(__('%s purges an item'), $_SESSION["glpiname"]) + sprintf(__('%s purges an item'), $_SESSION['glpiname']), ); } $computergroup->redirectToList(); -} elseif (isset($_POST["update"])) { +} elseif (isset($_POST['update'])) { // update a computergroup $computergroup->check($_POST['id'], UPDATE); $computergroup->update($_POST); Event::log( - $_POST["id"], - "PluginDatabaseinventoryComputerGroup", + $_POST['id'], + 'PluginDatabaseinventoryComputerGroup', 4, - "inventory", + 'inventory', //TRANS: %s is the user login - sprintf(__('%s updates an item'), $_SESSION["glpiname"]) + sprintf(__('%s updates an item'), $_SESSION['glpiname']), ); Html::back(); } else { @@ -116,32 +116,32 @@ $computergroup_dynamic = new PluginDatabaseinventoryComputerGroupDynamic(); // save search parameters for dynamic group - if (isset($_GET["save"])) { - $input = ['plugin_databaseinventory_computergroups_id' => $_GET['plugin_databaseinventory_computergroups_id']]; + if (isset($_GET['save'])) { + $input = ['plugin_databaseinventory_computergroups_id' => $_GET['plugin_databaseinventory_computergroups_id']]; $search = serialize([ - 'is_deleted' => isset($_GET['is_deleted']) ? $_GET['is_deleted'] : 0 , - 'as_map' => isset($_GET['as_map']) ? $_GET['as_map'] : 0, + 'is_deleted' => isset($_GET['is_deleted']) ? $_GET['is_deleted'] : 0 , + 'as_map' => isset($_GET['as_map']) ? $_GET['as_map'] : 0, 'criteria' => $_GET['criteria'], - 'metacriteria' => isset($_GET['metacriteria']) ? $_GET['metacriteria'] : [] + 'metacriteria' => isset($_GET['metacriteria']) ? $_GET['metacriteria'] : [], ]); if (!$computergroup_dynamic->getFromDBByCrit($input)) { $input['search'] = $search; $computergroup_dynamic->add($input); } else { - $input = $computergroup_dynamic->fields; + $input = $computergroup_dynamic->fields; $input['search'] = $search; $computergroup_dynamic->update($input); } - } elseif (isset($_GET["reset"])) { - $computergroup_dynamic->deleteByCriteria(["plugin_databaseinventory_computergroups_id" => $_GET['id']]); + } elseif (isset($_GET['reset'])) { + $computergroup_dynamic->deleteByCriteria(['plugin_databaseinventory_computergroups_id' => $_GET['id']]); } - Html::header(PluginDatabaseinventoryComputerGroup::getTypeName(Session::getPluralNumber()), $_SERVER['PHP_SELF'], "admin", "PluginDatabaseinventoryMenu", "computergroup"); + Html::header(PluginDatabaseinventoryComputerGroup::getTypeName(Session::getPluralNumber()), $_SERVER['PHP_SELF'], 'admin', 'PluginDatabaseinventoryMenu', 'computergroup'); // show computergroup form to add - if ($_GET['id'] == "") { - $computergroup->showForm(-1, ['withtemplate' => $_GET["withtemplate"]]); + if ($_GET['id'] == '') { + $computergroup->showForm(-1, ['withtemplate' => $_GET['withtemplate']]); } else { $computergroup->display($_GET); } diff --git a/front/computergroup.php b/front/computergroup.php index 44b6291..eebb5e0 100644 --- a/front/computergroup.php +++ b/front/computergroup.php @@ -30,14 +30,14 @@ include('../../../inc/includes.php'); -Session::checkRight("config", UPDATE); +Session::checkRight('config', UPDATE); Html::header( PluginDatabaseinventoryComputerGroup::getTypeName(Session::getPluralNumber()), $_SERVER['PHP_SELF'], - "admin", - "PluginDatabaseinventoryMenu", - "computergroup" + 'admin', + 'PluginDatabaseinventoryMenu', + 'computergroup', ); Search::show('PluginDatabaseinventoryComputerGroup'); diff --git a/front/credential.form.php b/front/credential.form.php index 5670d6f..7be5a33 100644 --- a/front/credential.form.php +++ b/front/credential.form.php @@ -32,28 +32,28 @@ include('../../../inc/includes.php'); -Session::checkRight("config", READ); +Session::checkRight('config', READ); -if (!isset($_GET["id"])) { - $_GET["id"] = ""; +if (!isset($_GET['id'])) { + $_GET['id'] = ''; } -if (!isset($_GET["withtemplate"])) { - $_GET["withtemplate"] = ""; +if (!isset($_GET['withtemplate'])) { + $_GET['withtemplate'] = ''; } $credential = new PluginDatabaseinventoryCredential(); -if (isset($_POST["add"])) { +if (isset($_POST['add'])) { // Add a new credential $credential->check(-1, CREATE, $_POST); if ($newID = $credential->add($_POST)) { Event::log( $newID, - "PluginDatabaseinventoryCredential", + 'PluginDatabaseinventoryCredential', 4, - "inventory", - sprintf(__('%1$s adds the item %2$s'), $_SESSION["glpiname"], $_POST["name"]) + 'inventory', + sprintf(__('%1$s adds the item %2$s'), $_SESSION['glpiname'], $_POST['name']), ); if ($_SESSION['glpibackcreated']) { @@ -61,39 +61,39 @@ } } Html::back(); -} else if (isset($_POST["purge"])) { +} elseif (isset($_POST['purge'])) { // purge a credential $credential->check($_POST['id'], PURGE); if ($credential->delete($_POST, 1)) { Event::log( - $_POST["id"], - "PluginDatabaseinventoryCredential", + $_POST['id'], + 'PluginDatabaseinventoryCredential', 4, - "inventory", + 'inventory', //TRANS: %s is the user login - sprintf(__('%s purges an item'), $_SESSION["glpiname"]) + sprintf(__('%s purges an item'), $_SESSION['glpiname']), ); } $credential->redirectToList(); -} else if (isset($_POST["update"])) { +} elseif (isset($_POST['update'])) { // update a credential $credential->check($_POST['id'], UPDATE); $credential->update($_POST); Event::log( - $_POST["id"], - "PluginDatabaseinventoryCredential", + $_POST['id'], + 'PluginDatabaseinventoryCredential', 4, - "inventory", + 'inventory', //TRANS: %s is the user login - sprintf(__('%s updates an item'), $_SESSION["glpiname"]) + sprintf(__('%s updates an item'), $_SESSION['glpiname']), ); Html::back(); } else { // print credential information - Html::header(PluginDatabaseinventoryCredential::getTypeName(Session::getPluralNumber()), $_SERVER['PHP_SELF'], "admin", "PluginDatabaseinventoryMenu", "credential"); + Html::header(PluginDatabaseinventoryCredential::getTypeName(Session::getPluralNumber()), $_SERVER['PHP_SELF'], 'admin', 'PluginDatabaseinventoryMenu', 'credential'); // show credential form to add - if ($_GET['id'] == "") { - $credential->showForm(-1, ['withtemplate' => $_GET["withtemplate"]]); + if ($_GET['id'] == '') { + $credential->showForm(-1, ['withtemplate' => $_GET['withtemplate']]); } else { $credential->display($_GET); } diff --git a/front/credential.php b/front/credential.php index a0b0fe7..2026e55 100644 --- a/front/credential.php +++ b/front/credential.php @@ -30,14 +30,14 @@ include('../../../inc/includes.php'); -Session::checkRight("config", UPDATE); +Session::checkRight('config', UPDATE); Html::header( PluginDatabaseinventoryCredential::getTypeName(Session::getPluralNumber()), $_SERVER['PHP_SELF'], - "admin", - "PluginDatabaseinventoryMenu", - "credential" + 'admin', + 'PluginDatabaseinventoryMenu', + 'credential', ); Search::show('PluginDatabaseinventoryCredential'); diff --git a/front/databaseparam.form.php b/front/databaseparam.form.php index bf62b9c..13bcf5c 100644 --- a/front/databaseparam.form.php +++ b/front/databaseparam.form.php @@ -32,30 +32,30 @@ include('../../../inc/includes.php'); -Session::checkRight("config", READ); +Session::checkRight('config', READ); -if (!isset($_GET["id"])) { - $_GET["id"] = ""; +if (!isset($_GET['id'])) { + $_GET['id'] = ''; } -if (!isset($_GET["withtemplate"])) { - $_GET["withtemplate"] = ""; +if (!isset($_GET['withtemplate'])) { + $_GET['withtemplate'] = ''; } -$databaseparam = new PluginDatabaseinventoryDatabaseParam(); -$databaseparam_credential = new PluginDatabaseinventoryDatabaseParam_Credential(); +$databaseparam = new PluginDatabaseinventoryDatabaseParam(); +$databaseparam_credential = new PluginDatabaseinventoryDatabaseParam_Credential(); $databaseparam_computergroup = new PluginDatabaseinventoryDatabaseParam_ComputerGroup(); -if (isset($_POST["add"])) { +if (isset($_POST['add'])) { // Add a new databaseparam $databaseparam->check(-1, CREATE, $_POST); if ($newID = $databaseparam->add($_POST)) { Event::log( $newID, - "PluginDatabaseinventoryDatabaseParam", + 'PluginDatabaseinventoryDatabaseParam', 4, - "inventory", - sprintf(__('%1$s adds the item %2$s'), $_SESSION["glpiname"], $_POST["name"]) + 'inventory', + sprintf(__('%1$s adds the item %2$s'), $_SESSION['glpiname'], $_POST['name']), ); if ($_SESSION['glpibackcreated']) { @@ -63,16 +63,16 @@ } } Html::back(); -} elseif (isset($_POST["add_credential"])) { +} elseif (isset($_POST['add_credential'])) { // add credential $databaseparam_credential->check(-1, CREATE, $_POST); if ($newID = $databaseparam_credential->add($_POST)) { Event::log( $newID, - "PluginDatabaseinventoryDatabaseParam_Credential", + 'PluginDatabaseinventoryDatabaseParam_Credential', 4, - "inventory", - sprintf(__('%1$s adds the item %2$s'), $_SESSION["glpiname"], $databaseparam_credential::getTypeName(0)) + 'inventory', + sprintf(__('%1$s adds the item %2$s'), $_SESSION['glpiname'], $databaseparam_credential::getTypeName(0)), ); if ($_SESSION['glpibackcreated']) { @@ -81,16 +81,16 @@ } } Html::back(); -} elseif (isset($_POST["add_computergroup"])) { +} elseif (isset($_POST['add_computergroup'])) { // add computer group $databaseparam_computergroup->check(-1, CREATE, $_POST); if ($newID = $databaseparam_computergroup->add($_POST)) { Event::log( $newID, - "PluginDatabaseinventoryDatabaseParam_ComputerGroup", + 'PluginDatabaseinventoryDatabaseParam_ComputerGroup', 4, - "inventory", - sprintf(__('%1$s adds the item %2$s'), $_SESSION["glpiname"], $databaseparam_computergroup::getTypeName(0)) + 'inventory', + sprintf(__('%1$s adds the item %2$s'), $_SESSION['glpiname'], $databaseparam_computergroup::getTypeName(0)), ); if ($_SESSION['glpibackcreated']) { @@ -99,39 +99,39 @@ } } Html::back(); -} else if (isset($_POST["purge"])) { +} elseif (isset($_POST['purge'])) { // purge a databaseparam $databaseparam->check($_POST['id'], PURGE); if ($databaseparam->delete($_POST, 1)) { Event::log( - $_POST["id"], - "PluginDatabaseinventoryDatabaseParam", + $_POST['id'], + 'PluginDatabaseinventoryDatabaseParam', 4, - "inventory", + 'inventory', //TRANS: %s is the user login - sprintf(__('%s purges an item'), $_SESSION["glpiname"]) + sprintf(__('%s purges an item'), $_SESSION['glpiname']), ); } $databaseparam->redirectToList(); -} else if (isset($_POST["update"])) { +} elseif (isset($_POST['update'])) { // update a databaseparam $databaseparam->check($_POST['id'], UPDATE); $databaseparam->update($_POST); Event::log( - $_POST["id"], - "PluginDatabaseinventoryDatabaseParam", + $_POST['id'], + 'PluginDatabaseinventoryDatabaseParam', 4, - "inventory", + 'inventory', //TRANS: %s is the user login - sprintf(__('%s updates an item'), $_SESSION["glpiname"]) + sprintf(__('%s updates an item'), $_SESSION['glpiname']), ); Html::back(); } else { // print databaseparam information - Html::header(PluginDatabaseinventoryDatabaseParam::getTypeName(Session::getPluralNumber()), $_SERVER['PHP_SELF'], "admin", "PluginDatabaseinventoryMenu", "databaseparam"); + Html::header(PluginDatabaseinventoryDatabaseParam::getTypeName(Session::getPluralNumber()), $_SERVER['PHP_SELF'], 'admin', 'PluginDatabaseinventoryMenu', 'databaseparam'); // show databaseparam form to add - if ($_GET['id'] == "") { - $databaseparam->showForm(-1, ['withtemplate' => $_GET["withtemplate"]]); + if ($_GET['id'] == '') { + $databaseparam->showForm(-1, ['withtemplate' => $_GET['withtemplate']]); } else { $databaseparam->display($_GET); } diff --git a/front/databaseparam.php b/front/databaseparam.php index 0548471..e14de1c 100644 --- a/front/databaseparam.php +++ b/front/databaseparam.php @@ -30,14 +30,14 @@ include('../../../inc/includes.php'); -Session::checkRight("config", UPDATE); +Session::checkRight('config', UPDATE); Html::header( PluginDatabaseinventoryDatabaseParam::getTypeName(Session::getPluralNumber()), $_SERVER['PHP_SELF'], - "admin", - "PluginDatabaseinventoryMenu", - "databaseparam" + 'admin', + 'PluginDatabaseinventoryMenu', + 'databaseparam', ); Search::show('PluginDatabaseinventoryDatabaseParam'); diff --git a/front/menu.php b/front/menu.php index 5fa48b6..4b9a51f 100644 --- a/front/menu.php +++ b/front/menu.php @@ -28,7 +28,7 @@ * ------------------------------------------------------------------------- */ -include("../../../inc/includes.php"); +include('../../../inc/includes.php'); /** @var array $CFG_GLPI */ global $CFG_GLPI; @@ -36,38 +36,38 @@ Html::header( __('Database Inventory', 'databaseinventory'), $_SERVER['PHP_SELF'], - "admin", - "PluginDatabaseInventoryMenu" + 'admin', + 'PluginDatabaseInventoryMenu', ); if (PluginDatabaseinventoryDatabaseParam::canView()) { echo "
"; echo ""; - echo ""; + echo "'; echo ""; echo ""; echo ""; + . PluginDatabaseinventoryDatabaseParam::getTypeName(2) . ''; if (PluginDatabaseinventoryCredential::canView()) { echo ""; echo ""; echo ""; + . PluginDatabaseinventoryCredential::getTypeName(2) . ''; } if (PluginDatabaseinventoryComputerGroup::canView()) { echo ""; echo ""; echo ""; + . PluginDatabaseinventoryComputerGroup::getTypeName(2) . ''; } - echo "
" . __('Database Inventory', 'databaseinventory') . "
" . __('Database Inventory', 'databaseinventory') . '
" - . PluginDatabaseinventoryDatabaseParam::getTypeName(2) . "
" - . PluginDatabaseinventoryCredential::getTypeName(2) . "
" - . PluginDatabaseinventoryComputerGroup::getTypeName(2) . "
"; + echo ''; } else { - echo "


\"warning\"

"; - echo "" . __("Access denied") . "
"; + echo "


warning

'; + echo '' . __('Access denied') . '
'; } Html::footer(); diff --git a/hook.php b/hook.php index 99ec656..70f1b61 100644 --- a/hook.php +++ b/hook.php @@ -84,7 +84,7 @@ function plugin_databaseinventory_uninstall() function plugin_databaseinventory_MassiveActions($type) { // Must be super-admin - if (!Session::haveRight("database_inventory", UPDATE)) { + if (!Session::haveRight('database_inventory', UPDATE)) { return []; } @@ -92,11 +92,13 @@ function plugin_databaseinventory_MassiveActions($type) case 'Computer': case 'Agent': $class = PluginDatabaseinventoryInventoryAction::getType(); - $key = PluginDatabaseinventoryInventoryAction::MA_PARTIAL; - $label = __("Run partial databases inventory", "databaseinventory"); + $key = PluginDatabaseinventoryInventoryAction::MA_PARTIAL; + $label = __('Run partial databases inventory', 'databaseinventory'); + return [$class . MassiveAction::CLASS_ACTION_SEPARATOR . $key => $label]; } - return []; + + return []; } function postItemForm(CommonDBTM $item) diff --git a/inc/computergroup.class.php b/inc/computergroup.class.php index e60878c..b5ce549 100644 --- a/inc/computergroup.class.php +++ b/inc/computergroup.class.php @@ -60,8 +60,8 @@ class PluginDatabaseinventoryComputerGroup extends CommonDBTM { - public $dohistory = true; - public static $rightname = 'database_inventory'; + public $dohistory = true; + public static $rightname = 'database_inventory'; public static function getTypeName($nb = 0) { @@ -85,6 +85,7 @@ public function defineTabs($options = []) ->addStandardTab('PluginDatabaseinventoryComputerGroupDynamic', $ong, $options) ->addStandardTab('PluginDatabaseinventoryComputerGroupStatic', $ong, $options) ->addStandardTab('Log', $ong, $options); + return $ong; } @@ -93,20 +94,20 @@ public function rawSearchOptions() $tab = parent::rawSearchOptions(); $tab[] = [ - 'id' => '2', - 'table' => $this->getTable(), - 'field' => 'id', - 'name' => __('ID'), - 'massiveaction' => false, // implicit field is id - 'datatype' => 'number' + 'id' => '2', + 'table' => $this->getTable(), + 'field' => 'id', + 'name' => __('ID'), + 'massiveaction' => false, // implicit field is id + 'datatype' => 'number', ]; $tab[] = [ - 'id' => '3', - 'table' => $this->getTable(), - 'field' => 'comment', - 'name' => __('Comment'), - 'datatype' => 'text' + 'id' => '3', + 'table' => $this->getTable(), + 'field' => 'comment', + 'name' => __('Comment'), + 'datatype' => 'text', ]; $tab[] = [ @@ -123,16 +124,16 @@ public function rawSearchOptions() ]; $tab[] = [ - 'id' => '6', - 'table' => PluginDatabaseinventoryComputerGroupStatic::getTable(), - 'field' => 'id', - 'name' => __('Number of static items', 'databaseinventory'), - 'forcegroupby' => true, - 'usehaving' => true, - 'nosearch' => true, - 'datatype' => 'count', - 'massiveaction' => false, - 'joinparams' => ['jointype' => 'child'], + 'id' => '6', + 'table' => PluginDatabaseinventoryComputerGroupStatic::getTable(), + 'field' => 'id', + 'name' => __('Number of static items', 'databaseinventory'), + 'forcegroupby' => true, + 'usehaving' => true, + 'nosearch' => true, + 'datatype' => 'count', + 'massiveaction' => false, + 'joinparams' => ['jointype' => 'child'], ]; $tab[] = [ @@ -150,21 +151,21 @@ public function rawSearchOptions() ]; $tab[] = [ - 'id' => '8', - 'table' => Computer::getTable(), - 'field' => 'name', - 'datatype' => 'itemlink', - 'name' => __('List of static items', 'databaseinventory'), - 'forcegroupby' => true, - 'massiveaction' => false, - 'joinparams' => [ - 'beforejoin' => [ - 'table' => PluginDatabaseinventoryComputerGroupStatic::getTable(), - 'joinparams' => [ - 'jointype' => 'child', - ] - ] - ] + 'id' => '8', + 'table' => Computer::getTable(), + 'field' => 'name', + 'datatype' => 'itemlink', + 'name' => __('List of static items', 'databaseinventory'), + 'forcegroupby' => true, + 'massiveaction' => false, + 'joinparams' => [ + 'beforejoin' => [ + 'table' => PluginDatabaseinventoryComputerGroupStatic::getTable(), + 'joinparams' => [ + 'jointype' => 'child', + ], + ], + ], ]; return $tab; @@ -176,9 +177,10 @@ public function showForm($ID, array $options = []) TemplateRenderer::getInstance()->display( '@databaseinventory/computergroup.html.twig', [ - 'item' => $this - ] + 'item' => $this, + ], ); + return true; } @@ -197,7 +199,7 @@ public function countDynamicItem() $iterator = $DB->request($params); foreach ($iterator as $computergroup_dynamic) { $search_params = Search::manageParams('Computer', unserialize($computergroup_dynamic['search'])); - $data = Search::prepareDatasForSearch('Computer', $search_params); + $data = Search::prepareDatasForSearch('Computer', $search_params); Search::constructSQL($data); Search::constructData($data); $count += $data['data']['totalcount']; @@ -218,7 +220,7 @@ public function countStaticItem() ]; $iterator = $DB->request($params); - $count = count($iterator); + $count = count($iterator); return $count; } @@ -228,9 +230,9 @@ public static function install(Migration $migration) /** @var DBmysql $DB */ global $DB; - $default_charset = DBConnection::getDefaultCharset(); + $default_charset = DBConnection::getDefaultCharset(); $default_collation = DBConnection::getDefaultCollation(); - $default_key_sign = DBConnection::getDefaultPrimaryKeySignOption(); + $default_key_sign = DBConnection::getDefaultPrimaryKeySignOption(); $table = self::getTable(); if (!$DB->tableExists($table)) { @@ -253,8 +255,8 @@ public static function install(Migration $migration) // install default display preferences $migration->updateDisplayPrefs( [ - PluginDatabaseinventoryComputerGroup::class => [3, 5, 6] - ] + PluginDatabaseinventoryComputerGroup::class => [3, 5, 6], + ], ); } else { // Fix `comment` field type (was a varchar prior to v1.0.0) @@ -269,13 +271,13 @@ public static function uninstall(Migration $migration) global $DB; $table = self::getTable(); if ($DB->tableExists($table)) { - $DB->query("DROP TABLE IF EXISTS `" . self::getTable() . "`") or die($DB->error()); + $DB->query('DROP TABLE IF EXISTS `' . self::getTable() . '`') or die($DB->error()); } } public static function getIcon() { - return "ti ti-sitemap"; + return 'ti ti-sitemap'; } public function post_purgeItem() diff --git a/inc/computergroupdynamic.class.php b/inc/computergroupdynamic.class.php index 9eedba7..aa9e64d 100644 --- a/inc/computergroupdynamic.class.php +++ b/inc/computergroupdynamic.class.php @@ -30,7 +30,7 @@ class PluginDatabaseinventoryComputerGroupDynamic extends CommonDBTM { - public static $rightname = 'database_inventory'; + public static $rightname = 'database_inventory'; public static function getTypeName($nb = 0) { @@ -50,17 +50,19 @@ public static function canPurge() public function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) { if ($item instanceof PluginDatabaseinventoryComputerGroup) { - $count = 0; + $count = 0; $computergroup_dynamic = new self(); if ( $computergroup_dynamic->getFromDBByCrit([ - 'plugin_databaseinventory_computergroups_id' => $item->getID() + 'plugin_databaseinventory_computergroups_id' => $item->getID(), ]) ) { $count = $computergroup_dynamic->countDynamicItems(); } + return self::createTabEntry(self::getTypeName(Session::getPluralNumber()), $count); } + return ''; } @@ -79,53 +81,54 @@ public static function getSpecificValueToDisplay($field, $values, array $options $count = $computergroup_dynamic->countDynamicItems(); } } + return ($count) ? $count : ' 0 '; case '_virtual_dynamic_list': /** @var array $CFG_GLPI */ global $CFG_GLPI; - $value = " "; - $out = " "; + $value = ' '; + $out = ' '; if (strpos($values['id'], Search::NULLVALUE) === false) { $search_params = Search::manageParams('Computer', unserialize($values['search'])); - $data = Search::prepareDatasForSearch('Computer', $search_params); + $data = Search::prepareDatasForSearch('Computer', $search_params); Search::constructSQL($data); Search::constructData($data); foreach ($data['data']['rows'] as $colvalue) { $value .= ""; - $value .= Dropdown::getDropdownName('glpi_computers', $colvalue['id']) . "" . Search::LBBR; + $value .= Dropdown::getDropdownName('glpi_computers', $colvalue['id']) . '' . Search::LBBR; } } if (!preg_match('/' . Search::LBHR . '/', $value)) { - $values = preg_split('/' . Search::LBBR . '/i', $value); + $values = preg_split('/' . Search::LBBR . '/i', $value); $line_delimiter = '
'; } else { - $values = preg_split('/' . Search::LBHR . '/i', $value); + $values = preg_split('/' . Search::LBHR . '/i', $value); $line_delimiter = '
'; } // move full list to tooltip if needed if ( - count($values) > 1 + count($values) > 1 && Toolbox::strlen($value) > $CFG_GLPI['cut'] ) { $value = ''; foreach ($values as $v) { $value .= $v . $line_delimiter; } - $value = preg_replace('/' . Search::LBBR . '/', '
', $value); - $value = preg_replace('/' . Search::LBHR . '/', '
', $value); - $value = '
' . $value . '
'; - $valTip = " " . Html::showToolTip( + $value = preg_replace('/' . Search::LBBR . '/', '
', $value); + $value = preg_replace('/' . Search::LBHR . '/', '
', $value); + $value = '
' . $value . '
'; + $valTip = ' ' . Html::showToolTip( $value, [ - 'awesome-class' => 'fa-comments', - 'display' => false, - 'autoclose' => false, - 'onclick' => true - ] + 'awesome-class' => 'fa-comments', + 'display' => false, + 'autoclose' => false, + 'onclick' => true, + ], ); $out .= $values[0] . $valTip; } else { @@ -133,8 +136,10 @@ public static function getSpecificValueToDisplay($field, $values, array $options $value = preg_replace('/' . Search::LBHR . '/', '
', $value); $out .= $value; } + return $out; } + return ''; } @@ -145,35 +150,38 @@ public static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $ self::showForItem($item); break; } + return true; } private function countDynamicItems() { $search_params = Search::manageParams('Computer', unserialize($this->fields['search'])); - $data = Search::prepareDatasForSearch('Computer', $search_params); + $data = Search::prepareDatasForSearch('Computer', $search_params); Search::constructSQL($data); Search::constructData($data); $count = $data['data']['totalcount']; + return $count; } public function isDynamicSearchMatchComputer(Computer $computer) { // add new criteria to force computer ID - $search = unserialize($this->fields['search']); + $search = unserialize($this->fields['search']); $search['criteria'][] = [ - "link" => "AND", - "field" => 2, // computer ID - "searchtype" => 'contains', - "value" => $computer->fields['id'], + 'link' => 'AND', + 'field' => 2, // computer ID + 'searchtype' => 'contains', + 'value' => $computer->fields['id'], ]; $search_params = Search::manageParams('Computer', $search); - $data = Search::prepareDatasForSearch('Computer', $search_params); + $data = Search::prepareDatasForSearch('Computer', $search_params); Search::constructSQL($data); Search::constructData($data); $count = $data['data']['totalcount']; + return $count; } @@ -191,10 +199,10 @@ private static function showForItem(PluginDatabaseinventoryComputerGroup $comput $computergroup_dynamic = new self(); if ( $computergroup_dynamic->getFromDBByCrit([ - 'plugin_databaseinventory_computergroups_id' => $ID + 'plugin_databaseinventory_computergroups_id' => $ID, ]) ) { - $p = $search_params = Search::manageParams('Computer', unserialize($computergroup_dynamic->fields['search'])); + $p = $search_params = Search::manageParams('Computer', unserialize($computergroup_dynamic->fields['search'])); $firsttime = false; } else { // retrieve filter value from search if exist and reset it @@ -206,29 +214,29 @@ private static function showForItem(PluginDatabaseinventoryComputerGroup $comput // redirect to computergroup dynamic tab after saved search $target = PluginDatabaseinventoryComputerGroup::getFormURLWithID($ID); - $target .= "&_glpi_tab=PluginDatabaseinventoryComputerGroupDynamic$1"; - $p['target'] = $target; + $target .= '&_glpi_tab=PluginDatabaseinventoryComputerGroupDynamic$1'; + $p['target'] = $target; $p['addhidden'] = [ 'plugin_databaseinventory_computergroups_id' => $computergroup->getID(), 'id' => $computergroup->getID(), - 'start' => 0 + 'start' => 0, ]; $p['actionname'] = 'save'; $p['actionvalue'] = _sx('button', 'Save'); $p['showbookmark'] = false; Search::showGenericSearch(Computer::getType(), $p); - //display result from search + //display result from search if (!$firsttime) { $data = Search::prepareDatasForSearch('Computer', $search_params); Search::constructSQL($data); Search::constructData($data); - $data['search']['target'] = $target; + $data['search']['target'] = $target; $data['search']['showmassiveactions'] = false; - $data['search']['is_deleted'] = false; + $data['search']['is_deleted'] = false; Search::displayData($data); - //remove trashbin switch + //remove trashbin switch echo Html::scriptBlock(" $(document).ready( function() { @@ -247,9 +255,9 @@ public static function install(Migration $migration) /** @var DBmysql $DB */ global $DB; - $default_charset = DBConnection::getDefaultCharset(); + $default_charset = DBConnection::getDefaultCharset(); $default_collation = DBConnection::getDefaultCollation(); - $default_key_sign = DBConnection::getDefaultPrimaryKeySignOption(); + $default_key_sign = DBConnection::getDefaultPrimaryKeySignOption(); $table = self::getTable(); if (!$DB->tableExists($table)) { @@ -273,7 +281,7 @@ public static function uninstall(Migration $migration) global $DB; $table = self::getTable(); if ($DB->tableExists($table)) { - $DB->query("DROP TABLE IF EXISTS `" . self::getTable() . "`") or die($DB->error()); + $DB->query('DROP TABLE IF EXISTS `' . self::getTable() . '`') or die($DB->error()); } } } diff --git a/inc/computergroupstatic.class.php b/inc/computergroupstatic.class.php index 28c62bb..edd2ca3 100644 --- a/inc/computergroupstatic.class.php +++ b/inc/computergroupstatic.class.php @@ -66,11 +66,11 @@ class PluginDatabaseinventoryComputerGroupStatic extends CommonDBRelation public static $itemtype_2 = 'Computer'; public static $items_id_2 = 'computers_id'; - public static $checkItem_2_Rights = self::DONT_CHECK_ITEM_RIGHTS; - public static $logs_for_item_2 = false; - public $auto_message_on_action = false; + public static $checkItem_2_Rights = self::DONT_CHECK_ITEM_RIGHTS; + public static $logs_for_item_2 = false; + public $auto_message_on_action = false; - public static $rightname = 'database_inventory'; + public static $rightname = 'database_inventory'; public static function getTypeName($nb = 0) { @@ -96,8 +96,10 @@ public function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) { if ($item instanceof PluginDatabaseinventoryComputerGroup) { $count = countElementsInTable(self::getTable(), ['plugin_databaseinventory_computergroups_id' => $item->getID()]); + return self::createTabEntry(self::getTypeName(Session::getPluralNumber()), $count); } + return ''; } @@ -108,6 +110,7 @@ public static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $ self::showForItem($item); break; } + return true; } @@ -121,39 +124,39 @@ private static function showForItem(PluginDatabaseinventoryComputerGroup $comput return false; } - $staticsgroups = new PluginDatabaseinventoryComputerGroupStatic(); + $staticsgroups = new PluginDatabaseinventoryComputerGroupStatic(); $staticgrouplist = $staticsgroups->find( [ - 'plugin_databaseinventory_computergroups_id' => $ID - ] + 'plugin_databaseinventory_computergroups_id' => $ID, + ], ); - $computers = new Computer(); + $computers = new Computer(); $listofcomputers = []; - $used = []; + $used = []; foreach ($staticgrouplist as $staticgroup) { $used[] = $staticgroup['computers_id']; if ($computers->getFromDB($staticgroup['computers_id'])) { - $listofcomputers[] = $computers->fields + - [ - 'entityname' => Entity::getById($computers->fields['entities_id'])->fields['completename'], - 'link' => $computers->getLinkURL(), - 'idcompgroupstatic' => $staticgroup['id'], - ]; + $listofcomputers[] = $computers->fields + [ + 'entityname' => Entity::getById($computers->fields['entities_id'])->fields['completename'], + 'link' => $computers->getLinkURL(), + 'idcompgroupstatic' => $staticgroup['id'], + ]; } } TemplateRenderer::getInstance()->display( '@databaseinventory/computergroupstatic.html.twig', [ - 'item' => PluginDatabaseinventoryDatabaseParam::getById($ID), - 'computerslist' => $listofcomputers, + 'item' => PluginDatabaseinventoryDatabaseParam::getById($ID), + 'computerslist' => $listofcomputers, 'groupstaticclass' => PluginDatabaseinventoryComputerGroupStatic::class, - 'canread' => $computergroup->can($ID, READ), - 'canedit' => $computergroup->can($ID, UPDATE), - 'canadd' => $computergroup->canAddItem('itemtype'), - 'used' => $used, - ] + 'canread' => $computergroup->can($ID, READ), + 'canedit' => $computergroup->can($ID, UPDATE), + 'canadd' => $computergroup->canAddItem('itemtype'), + 'used' => $used, + ], ); + return true; } @@ -162,9 +165,9 @@ public static function install(Migration $migration) /** @var DBmysql $DB */ global $DB; - $default_charset = DBConnection::getDefaultCharset(); + $default_charset = DBConnection::getDefaultCharset(); $default_collation = DBConnection::getDefaultCollation(); - $default_key_sign = DBConnection::getDefaultPrimaryKeySignOption(); + $default_key_sign = DBConnection::getDefaultPrimaryKeySignOption(); $table = self::getTable(); if (!$DB->tableExists($table)) { @@ -189,7 +192,7 @@ public static function uninstall(Migration $migration) global $DB; $table = self::getTable(); if ($DB->tableExists($table)) { - $DB->query("DROP TABLE IF EXISTS `" . self::getTable() . "`") or die($DB->error()); + $DB->query('DROP TABLE IF EXISTS `' . self::getTable() . '`') or die($DB->error()); } } } diff --git a/inc/contactlog.class.php b/inc/contactlog.class.php index 97a0f33..476ed9a 100644 --- a/inc/contactlog.class.php +++ b/inc/contactlog.class.php @@ -60,8 +60,8 @@ class PluginDatabaseinventoryContactLog extends CommonDBTM { - public $dohistory = true; - public static $rightname = 'database_inventory'; + public $dohistory = true; + public static $rightname = 'database_inventory'; public static function canCreate() { @@ -88,11 +88,14 @@ public function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) switch (get_class($item)) { case PluginDatabaseinventoryDatabaseParam::class: $count = countElementsInTable(self::getTable(), ['plugin_databaseinventory_databaseparams_id' => $item->getID()]); + return self::createTabEntry(self::getTypeName(Session::getPluralNumber()), $count); case Agent::class: $count = countElementsInTable(self::getTable(), ['agents_id' => $item->getID()]); + return self::createTabEntry(self::getTypeName(Session::getPluralNumber()), $count); } + return ''; } @@ -106,6 +109,7 @@ public static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $ self::showForAgent($item); break; } + return true; } @@ -116,15 +120,15 @@ private static function showForDatabaseParams(PluginDatabaseinventoryDatabasePar return false; } - $contactlog = new PluginDatabaseinventoryContactLog(); + $contactlog = new PluginDatabaseinventoryContactLog(); $contactloglist = $contactlog->find( [ - 'plugin_databaseinventory_databaseparams_id' => $ID - ] + 'plugin_databaseinventory_databaseparams_id' => $ID, + ], ); - $credential = new PluginDatabaseinventoryCredential(); - $agent = new Agent(); + $credential = new PluginDatabaseinventoryCredential(); + $agent = new Agent(); $listofctlog = []; foreach ($contactloglist as $dbpctlog) { if ($credential->getFromDB($dbpctlog['plugin_databaseinventory_credentials_id'])) { @@ -137,9 +141,9 @@ private static function showForDatabaseParams(PluginDatabaseinventoryDatabasePar } if (isset($linkcred) || isset($linkagent)) { $listofctlog[] = $dbpctlog + [ - 'linkcred' => $linkcred ?? '', + 'linkcred' => $linkcred ?? '', 'linkagent' => $linkagent ?? '', - 'credname' => $credname ?? '', + 'credname' => $credname ?? '', 'agentname' => $agentname ?? '', ]; } @@ -147,11 +151,12 @@ private static function showForDatabaseParams(PluginDatabaseinventoryDatabasePar TemplateRenderer::getInstance()->display( '@databaseinventory/contactlog.html.twig', [ - 'itemtype' => PluginDatabaseinventoryDatabaseParam::getType(), + 'itemtype' => PluginDatabaseinventoryDatabaseParam::getType(), 'contactlogs' => $listofctlog, - 'canread' => $databaseparams->can($ID, READ) - ] + 'canread' => $databaseparams->can($ID, READ), + ], ); + return true; } @@ -162,15 +167,15 @@ private static function showForAgent(Agent $agent) return false; } - $contactlog = new PluginDatabaseinventoryContactLog(); + $contactlog = new PluginDatabaseinventoryContactLog(); $contactloglist = $contactlog->find( [ - 'agents_id' => $ID - ] + 'agents_id' => $ID, + ], ); - $credential = new PluginDatabaseinventoryCredential(); - $dbparam = new PluginDatabaseinventoryDatabaseParam(); + $credential = new PluginDatabaseinventoryCredential(); + $dbparam = new PluginDatabaseinventoryDatabaseParam(); $listofctlog = []; foreach ($contactloglist as $dbpctlog) { if ($credential->getFromDB($dbpctlog['plugin_databaseinventory_credentials_id'])) { @@ -183,9 +188,9 @@ private static function showForAgent(Agent $agent) } if (isset($linkcred)) { $listofctlog[] = $dbpctlog + [ - 'linkcred' => $linkcred, + 'linkcred' => $linkcred, 'linkdbparam' => $linkdbparam ?? '', - 'credname' => $credname ?? '', + 'credname' => $credname ?? '', 'dbparamname' => $dbparamname ?? '', ]; } @@ -193,11 +198,12 @@ private static function showForAgent(Agent $agent) TemplateRenderer::getInstance()->display( '@databaseinventory/contactlog.html.twig', [ - 'itemtype' => Agent::getType(), + 'itemtype' => Agent::getType(), 'contactlogs' => $listofctlog, - 'canread' => $agent->can($ID, READ) - ] + 'canread' => $agent->can($ID, READ), + ], ); + return true; } @@ -206,9 +212,9 @@ public static function install(Migration $migration) /** @var DBmysql $DB */ global $DB; - $default_charset = DBConnection::getDefaultCharset(); + $default_charset = DBConnection::getDefaultCharset(); $default_collation = DBConnection::getDefaultCollation(); - $default_key_sign = DBConnection::getDefaultPrimaryKeySignOption(); + $default_key_sign = DBConnection::getDefaultPrimaryKeySignOption(); $table = self::getTable(); if (!$DB->tableExists($table)) { @@ -237,7 +243,7 @@ public static function uninstall(Migration $migration) global $DB; $table = self::getTable(); if ($DB->tableExists($table)) { - $DB->query("DROP TABLE IF EXISTS `" . self::getTable() . "`") or die($DB->error()); + $DB->query('DROP TABLE IF EXISTS `' . self::getTable() . '`') or die($DB->error()); } } } diff --git a/inc/credential.class.php b/inc/credential.class.php index afd89d6..c3dd586 100644 --- a/inc/credential.class.php +++ b/inc/credential.class.php @@ -60,8 +60,8 @@ class PluginDatabaseinventoryCredential extends CommonDBTM { - public $dohistory = true; - public static $rightname = 'database_inventory'; + public $dohistory = true; + public static $rightname = 'database_inventory'; public static function canCreate() { @@ -88,44 +88,44 @@ public function rawSearchOptions() $tab = parent::rawSearchOptions(); $tab[] = [ - 'id' => '2', - 'table' => $this->getTable(), - 'field' => 'id', - 'name' => __('ID'), - 'massiveaction' => false, // implicit field is id - 'datatype' => 'number' + 'id' => '2', + 'table' => $this->getTable(), + 'field' => 'id', + 'name' => __('ID'), + 'massiveaction' => false, // implicit field is id + 'datatype' => 'number', ]; $tab[] = [ - 'id' => '3', - 'table' => $this->getTable(), - 'field' => 'login', - 'name' => __('Login'), - 'datatype' => 'text' + 'id' => '3', + 'table' => $this->getTable(), + 'field' => 'login', + 'name' => __('Login'), + 'datatype' => 'text', ]; $tab[] = [ - 'id' => '4', - 'table' => $this->getTable(), - 'field' => 'port', - 'name' => __('Port'), - 'datatype' => 'number' + 'id' => '4', + 'table' => $this->getTable(), + 'field' => 'port', + 'name' => __('Port'), + 'datatype' => 'number', ]; $tab[] = [ - 'id' => '5', - 'table' => $this->getTable(), - 'field' => 'socket', - 'name' => __('Socket'), - 'datatype' => 'text' + 'id' => '5', + 'table' => $this->getTable(), + 'field' => 'socket', + 'name' => __('Socket'), + 'datatype' => 'text', ]; $tab[] = [ - 'id' => '6', - 'table' => PluginDatabaseinventoryCredentialType::getTable(), - 'field' => 'name', - 'name' => _n('Type', 'Types', 1), - 'datatype' => 'dropdown' + 'id' => '6', + 'table' => PluginDatabaseinventoryCredentialType::getTable(), + 'field' => 'name', + 'name' => _n('Type', 'Types', 1), + 'datatype' => 'dropdown', ]; return $tab; @@ -137,24 +137,25 @@ public function showForm($ID, array $options = []) TemplateRenderer::getInstance()->display( '@databaseinventory/credential.html.twig', [ - 'item' => $this - ] + 'item' => $this, + ], ); + return true; } public function getCredentialMode() { - return "login_password"; + return 'login_password'; } public function prepareInput(array $input, $mode = 'add'): array { - if (isset($input["password"])) { - if (empty($input["password"])) { - unset($input["password"]); + if (isset($input['password'])) { + if (empty($input['password'])) { + unset($input['password']); } else { - $input["password"] = (new GLPIKey())->encrypt($input["password"]); + $input['password'] = (new GLPIKey())->encrypt($input['password']); } } @@ -164,6 +165,7 @@ public function prepareInput(array $input, $mode = 'add'): array public function prepareInputForAdd($input) { $input = $this->prepareInput($input, 'add'); + return $input; } @@ -171,7 +173,7 @@ public function prepareInputForUpdate($input) { $input = $this->prepareInput($input, 'update'); - if (isset($input["_blank_passwd"]) && $input["_blank_passwd"]) { + if (isset($input['_blank_passwd']) && $input['_blank_passwd']) { $input['password'] = ''; } @@ -183,9 +185,9 @@ public static function install(Migration $migration) /** @var DBmysql $DB */ global $DB; - $default_charset = DBConnection::getDefaultCharset(); + $default_charset = DBConnection::getDefaultCharset(); $default_collation = DBConnection::getDefaultCollation(); - $default_key_sign = DBConnection::getDefaultPrimaryKeySignOption(); + $default_key_sign = DBConnection::getDefaultPrimaryKeySignOption(); $table = self::getTable(); if (!$DB->tableExists($table)) { @@ -218,8 +220,8 @@ public static function install(Migration $migration) // install default display preferences $migration->updateDisplayPrefs( [ - PluginDatabaseinventoryCredential::class => [3, 4, 5, 6] - ] + PluginDatabaseinventoryCredential::class => [3, 4, 5, 6], + ], ); } else { // Fix `comment` field type (was a varchar prior to v1.0.0) @@ -238,13 +240,13 @@ public static function uninstall(Migration $migration) global $DB; $table = self::getTable(); if ($DB->tableExists($table)) { - $DB->query("DROP TABLE IF EXISTS `" . self::getTable() . "`") or die($DB->error()); + $DB->query('DROP TABLE IF EXISTS `' . self::getTable() . '`') or die($DB->error()); } } public static function getIcon() { - return "fas fa-lock"; + return 'fas fa-lock'; } public function post_purgeItem() diff --git a/inc/credentialtype.class.php b/inc/credentialtype.class.php index 39a7385..3d1179a 100644 --- a/inc/credentialtype.class.php +++ b/inc/credentialtype.class.php @@ -32,14 +32,14 @@ class PluginDatabaseinventoryCredentialType extends CommonDropdown { - public static $rightname = "dropdown"; + public static $rightname = 'dropdown'; - private const MYSQL = 1; - private const ORACLE = 2; - private const DB2 = 3; - private const MSSQL = 4; - private const POSTGRE_SQL = 5; - private const MONGO_DB = 6; + private const MYSQL = 1; + private const ORACLE = 2; + private const DB2 = 3; + private const MSSQL = 4; + private const POSTGRE_SQL = 5; + private const MONGO_DB = 6; public static function canCreate() { @@ -79,11 +79,12 @@ public static function getTypeName($nb = 0) public function pre_deleteItem() { Session::addMessageAfterRedirect( - __("You cannot remove this type", "databaseinventory") . ": " + __('You cannot remove this type', 'databaseinventory') . ': ' . $this->fields['name'], false, - ERROR + ERROR, ); + return false; } @@ -128,9 +129,9 @@ public static function install(Migration $migration) /** @var DBmysql $DB */ global $DB; - $default_charset = DBConnection::getDefaultCharset(); + $default_charset = DBConnection::getDefaultCharset(); $default_collation = DBConnection::getDefaultCollation(); - $default_key_sign = DBConnection::getDefaultPrimaryKeySignOption(); + $default_key_sign = DBConnection::getDefaultPrimaryKeySignOption(); $table = self::getTable(); if ($DB->tableExists('glpi_plugin_databaseinventory_credentials_types')) { @@ -153,18 +154,18 @@ public static function install(Migration $migration) $state = new self(); foreach ( [ - 1 => __("MySQL", "databaseinventory"), - 2 => __("Oracle", "databaseinventory"), - 3 => __("DB2", "databaseinventory"), - 4 => __("Microsoft SQL", "databaseinventory"), - 5 => __("PostgreSQL", "databaseinventory"), - 6 => __("MongoDB", "databaseinventory") + 1 => __('MySQL', 'databaseinventory'), + 2 => __('Oracle', 'databaseinventory'), + 3 => __('DB2', 'databaseinventory'), + 4 => __('Microsoft SQL', 'databaseinventory'), + 5 => __('PostgreSQL', 'databaseinventory'), + 6 => __('MongoDB', 'databaseinventory'), ] as $id => $label ) { if (!countElementsInTable($table, ['id' => $id])) { $state->add([ 'id' => $id, - 'name' => Sanitizer::sanitize($label) + 'name' => Sanitizer::sanitize($label), ]); } } @@ -174,6 +175,6 @@ public static function uninstall() { /** @var DBmysql $DB */ global $DB; - $DB->query("DROP TABLE IF EXISTS `" . self::getTable() . "`") or die($DB->error()); + $DB->query('DROP TABLE IF EXISTS `' . self::getTable() . '`') or die($DB->error()); } } diff --git a/inc/databaseparam.class.php b/inc/databaseparam.class.php index 2ed6cc7..ae70a4f 100644 --- a/inc/databaseparam.class.php +++ b/inc/databaseparam.class.php @@ -60,8 +60,8 @@ class PluginDatabaseinventoryDatabaseParam extends CommonDBTM { - public $dohistory = true; - public static $rightname = 'database_inventory'; + public $dohistory = true; + public static $rightname = 'database_inventory'; public static function getTypeName($nb = 0) { @@ -83,76 +83,76 @@ public function rawSearchOptions() $tab = parent::rawSearchOptions(); $tab[] = [ - 'id' => '2', - 'table' => $this->getTable(), - 'field' => 'id', - 'name' => __('ID'), - 'massiveaction' => false, // implicit field is id - 'datatype' => 'number' + 'id' => '2', + 'table' => $this->getTable(), + 'field' => 'id', + 'name' => __('ID'), + 'massiveaction' => false, // implicit field is id + 'datatype' => 'number', ]; $tab[] = [ - 'id' => '3', - 'table' => $this->getTable(), - 'field' => 'is_active', - 'name' => __('Active'), - 'datatype' => 'bool' + 'id' => '3', + 'table' => $this->getTable(), + 'field' => 'is_active', + 'name' => __('Active'), + 'datatype' => 'bool', ]; $tab[] = [ - 'id' => '4', - 'table' => $this->getTable(), - 'field' => 'partial_inventory', - 'name' => __('Partial inventory', 'databaseinventory'), - 'datatype' => 'bool' + 'id' => '4', + 'table' => $this->getTable(), + 'field' => 'partial_inventory', + 'name' => __('Partial inventory', 'databaseinventory'), + 'datatype' => 'bool', ]; $tab[] = [ - 'id' => '5', - 'table' => $this->getTable(), - 'field' => 'execution_delay', - 'name' => __('Execution frequency for partial inventory', 'databaseinventory'), - 'datatype' => 'number', - 'min' => 0, - 'max' => 24, - 'step' => 1, - 'unit' => 'hour', + 'id' => '5', + 'table' => $this->getTable(), + 'field' => 'execution_delay', + 'name' => __('Execution frequency for partial inventory', 'databaseinventory'), + 'datatype' => 'number', + 'min' => 0, + 'max' => 24, + 'step' => 1, + 'unit' => 'hour', ]; $tab[] = [ - 'id' => '6', - 'table' => PluginDatabaseinventoryComputerGroup::getTable(), - 'field' => 'name', - 'datatype' => 'itemlink', - 'name' => PluginDatabaseinventoryComputerGroup::getTypeName(1), - 'forcegroupby' => true, - 'massiveaction' => false, - 'joinparams' => [ - 'beforejoin' => [ - 'table' => PluginDatabaseinventoryDatabaseParam_ComputerGroup::getTable(), - 'joinparams' => [ - 'jointype' => 'child', - ] - ] - ] + 'id' => '6', + 'table' => PluginDatabaseinventoryComputerGroup::getTable(), + 'field' => 'name', + 'datatype' => 'itemlink', + 'name' => PluginDatabaseinventoryComputerGroup::getTypeName(1), + 'forcegroupby' => true, + 'massiveaction' => false, + 'joinparams' => [ + 'beforejoin' => [ + 'table' => PluginDatabaseinventoryDatabaseParam_ComputerGroup::getTable(), + 'joinparams' => [ + 'jointype' => 'child', + ], + ], + ], ]; $tab[] = [ - 'id' => '7', - 'table' => PluginDatabaseinventoryCredential::getTable(), - 'field' => 'name', - 'datatype' => 'itemlink', - 'name' => PluginDatabaseinventoryCredential::getTypeName(1), - 'forcegroupby' => true, - 'massiveaction' => false, - 'joinparams' => [ - 'beforejoin' => [ - 'table' => PluginDatabaseinventoryDatabaseParam_Credential::getTable(), - 'joinparams' => [ - 'jointype' => 'child', - ] - ] - ] + 'id' => '7', + 'table' => PluginDatabaseinventoryCredential::getTable(), + 'field' => 'name', + 'datatype' => 'itemlink', + 'name' => PluginDatabaseinventoryCredential::getTypeName(1), + 'forcegroupby' => true, + 'massiveaction' => false, + 'joinparams' => [ + 'beforejoin' => [ + 'table' => PluginDatabaseinventoryDatabaseParam_Credential::getTable(), + 'joinparams' => [ + 'jointype' => 'child', + ], + ], + ], ]; return $tab; @@ -164,34 +164,34 @@ public function getCredentialTypeLinked() global $DB; $databaseparam_credential_table = PluginDatabaseinventoryDatabaseParam_Credential::getTable(); - $credential_table = PluginDatabaseinventoryCredential::getTable(); - $credential_type_table = PluginDatabaseinventoryCredentialType::getTable(); - $types = []; + $credential_table = PluginDatabaseinventoryCredential::getTable(); + $credential_type_table = PluginDatabaseinventoryCredentialType::getTable(); + $types = []; // load all credential type $criteria = [ - 'SELECT' => [ + 'SELECT' => [ $credential_type_table . '.id', $credential_type_table . '.name', ], - 'FROM' => $credential_type_table, - 'JOIN' => [ + 'FROM' => $credential_type_table, + 'JOIN' => [ $credential_table => [ 'ON' => [ - $credential_table => 'plugin_databaseinventory_credentialtypes_id', - $credential_type_table => 'id' - ] + $credential_table => 'plugin_databaseinventory_credentialtypes_id', + $credential_type_table => 'id', + ], ], $databaseparam_credential_table => [ 'ON' => [ $databaseparam_credential_table => 'plugin_databaseinventory_credentials_id', - $credential_table => 'id' - ] + $credential_table => 'id', + ], ], ], - 'WHERE' => [ - $databaseparam_credential_table . ".plugin_databaseinventory_databaseparams_id" => $this->fields['id'], - ] + 'WHERE' => [ + $databaseparam_credential_table . '.plugin_databaseinventory_databaseparams_id' => $this->fields['id'], + ], ]; // store types found @@ -211,6 +211,7 @@ public function defineTabs($options = []) ->addStandardTab('PluginDatabaseinventoryDatabaseParam_Credential', $ong, $options) ->addStandardTab('PluginDatabaseinventoryContactLog', $ong, $options) ->addStandardTab('Log', $ong, $options); + return $ong; } @@ -220,9 +221,10 @@ public function showForm($ID, array $options = []) TemplateRenderer::getInstance()->display( '@databaseinventory/databaseparam.html.twig', [ - 'item' => $this - ] + 'item' => $this, + ], ); + return true; } @@ -231,9 +233,9 @@ public static function install(Migration $migration) /** @var DBmysql $DB */ global $DB; - $default_charset = DBConnection::getDefaultCharset(); + $default_charset = DBConnection::getDefaultCharset(); $default_collation = DBConnection::getDefaultCollation(); - $default_key_sign = DBConnection::getDefaultPrimaryKeySignOption(); + $default_key_sign = DBConnection::getDefaultPrimaryKeySignOption(); $table = self::getTable(); if (!$DB->tableExists($table)) { @@ -260,8 +262,8 @@ public static function install(Migration $migration) // install default display preferences $migration->updateDisplayPrefs( [ - PluginDatabaseinventoryDatabaseParam::class => [3, 4, 5, 6, 7] - ] + PluginDatabaseinventoryDatabaseParam::class => [3, 4, 5, 6, 7], + ], ); } } @@ -272,12 +274,12 @@ public static function uninstall(Migration $migration) global $DB; $table = self::getTable(); if ($DB->tableExists($table)) { - $DB->query("DROP TABLE IF EXISTS `" . self::getTable() . "`") or die($DB->error()); + $DB->query('DROP TABLE IF EXISTS `' . self::getTable() . '`') or die($DB->error()); } } public static function getIcon() { - return "fas fa-database"; + return 'fas fa-database'; } } diff --git a/inc/databaseparam_computergroup.class.php b/inc/databaseparam_computergroup.class.php index a58a5da..88404f5 100644 --- a/inc/databaseparam_computergroup.class.php +++ b/inc/databaseparam_computergroup.class.php @@ -66,11 +66,11 @@ class PluginDatabaseinventoryDatabaseParam_ComputerGroup extends CommonDBRelatio public static $itemtype_2 = 'PluginDatabaseinventoryComputerGroup'; public static $items_id_2 = 'plugin_databaseinventory_computergroups_id'; - public static $checkItem_2_Rights = self::DONT_CHECK_ITEM_RIGHTS; - public static $logs_for_item_2 = false; - public $auto_message_on_action = false; + public static $checkItem_2_Rights = self::DONT_CHECK_ITEM_RIGHTS; + public static $logs_for_item_2 = false; + public $auto_message_on_action = false; - public static $rightname = 'database_inventory'; + public static $rightname = 'database_inventory'; public static function canCreate() { @@ -96,8 +96,10 @@ public function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) { if ($item instanceof PluginDatabaseinventoryDatabaseParam) { $count = countElementsInTable(PluginDatabaseinventoryDatabaseParam_ComputerGroup::getTable(), ['plugin_databaseinventory_databaseparams_id' => $item->getID()]); + return self::createTabEntry(self::getTypeName(Session::getPluralNumber()), $count); } + return ''; } @@ -108,6 +110,7 @@ public static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $ self::showForItem($item); break; } + return true; } @@ -119,52 +122,51 @@ private static function showForItem(PluginDatabaseinventoryDatabaseParam $databa } $databaseparamcgroup = new PluginDatabaseinventoryDatabaseParam_ComputerGroup(); - $dbpcgrouplist = $databaseparamcgroup->find( + $dbpcgrouplist = $databaseparamcgroup->find( [ - 'plugin_databaseinventory_databaseparams_id' => $ID - ] + 'plugin_databaseinventory_databaseparams_id' => $ID, + ], ); - $dbcgroups = new PluginDatabaseinventoryComputerGroup(); + $dbcgroups = new PluginDatabaseinventoryComputerGroup(); $listofcgroups = []; - $used = []; + $used = []; foreach ($dbpcgrouplist as $dbpcgroup) { $used[] = $dbpcgroup['plugin_databaseinventory_computergroups_id']; if ($dbcgroups->getFromDB($dbpcgroup['plugin_databaseinventory_computergroups_id'])) { - $listofcgroups[] = $dbcgroups->fields + - [ - 'link' => $dbcgroups->getLinkURL(), - 'nbdynamicitems' => $dbcgroups->countDynamicItem(), - 'nbstaticitems' => $dbcgroups->countStaticItem(), - 'iddbparamcgroup' => $dbpcgroup['id'], - ]; + $listofcgroups[] = $dbcgroups->fields + [ + 'link' => $dbcgroups->getLinkURL(), + 'nbdynamicitems' => $dbcgroups->countDynamicItem(), + 'nbstaticitems' => $dbcgroups->countStaticItem(), + 'iddbparamcgroup' => $dbpcgroup['id'], + ]; } } TemplateRenderer::getInstance()->display( '@databaseinventory/databaseparam_computergroup.html.twig', [ - 'item' => PluginDatabaseinventoryDatabaseParam::getById($ID), - 'compgrouplist' => $listofcgroups, - 'compgroupclass' => PluginDatabaseinventoryComputerGroup::class, + 'item' => PluginDatabaseinventoryDatabaseParam::getById($ID), + 'compgrouplist' => $listofcgroups, + 'compgroupclass' => PluginDatabaseinventoryComputerGroup::class, 'dbparamgroupclass' => PluginDatabaseinventoryDatabaseParam_ComputerGroup::class, - 'canread' => $databaseparams->can($ID, READ), - 'canedit' => $databaseparams->can($ID, UPDATE), - 'canadd' => $databaseparams->canAddItem('itemtype'), - 'used' => $used, - ] + 'canread' => $databaseparams->can($ID, READ), + 'canedit' => $databaseparams->can($ID, UPDATE), + 'canadd' => $databaseparams->canAddItem('itemtype'), + 'used' => $used, + ], ); + return true; } - public static function install(Migration $migration) { /** @var DBmysql $DB */ global $DB; - $default_charset = DBConnection::getDefaultCharset(); + $default_charset = DBConnection::getDefaultCharset(); $default_collation = DBConnection::getDefaultCollation(); - $default_key_sign = DBConnection::getDefaultPrimaryKeySignOption(); + $default_key_sign = DBConnection::getDefaultPrimaryKeySignOption(); $table = self::getTable(); if (!$DB->tableExists($table)) { @@ -192,7 +194,7 @@ public static function uninstall(Migration $migration) global $DB; $table = self::getTable(); if ($DB->tableExists($table)) { - $DB->query("DROP TABLE IF EXISTS `" . self::getTable() . "`") or die($DB->error()); + $DB->query('DROP TABLE IF EXISTS `' . self::getTable() . '`') or die($DB->error()); } } } diff --git a/inc/databaseparam_credential.class.php b/inc/databaseparam_credential.class.php index 2f87227..a0569a6 100644 --- a/inc/databaseparam_credential.class.php +++ b/inc/databaseparam_credential.class.php @@ -66,11 +66,11 @@ class PluginDatabaseinventoryDatabaseParam_Credential extends CommonDBRelation public static $itemtype_2 = 'PluginDatabaseinventoryCredential'; public static $items_id_2 = 'plugin_databaseinventory_credentials_id'; - public static $checkItem_2_Rights = self::DONT_CHECK_ITEM_RIGHTS; - public static $logs_for_item_2 = false; - public $auto_message_on_action = false; + public static $checkItem_2_Rights = self::DONT_CHECK_ITEM_RIGHTS; + public static $logs_for_item_2 = false; + public $auto_message_on_action = false; - public static $rightname = 'database_inventory'; + public static $rightname = 'database_inventory'; public static function canCreate() { @@ -96,8 +96,10 @@ public function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) { if ($item instanceof PluginDatabaseinventoryDatabaseParam) { $count = countElementsInTable(PluginDatabaseinventoryDatabaseParam_Credential::getTable(), ['plugin_databaseinventory_databaseparams_id' => $item->getID()]); + return self::createTabEntry(self::getTypeName(Session::getPluralNumber()), $count); } + return ''; } @@ -108,6 +110,7 @@ public static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $ self::showForItem($item); break; } + return true; } @@ -119,41 +122,40 @@ private static function showForItem(PluginDatabaseinventoryDatabaseParam $databa } $databaseparamcredentials = new PluginDatabaseinventoryDatabaseParam_Credential(); - $dbpcredentialslist = $databaseparamcredentials->find( + $dbpcredentialslist = $databaseparamcredentials->find( [ - 'plugin_databaseinventory_databaseparams_id' => $ID - ] + 'plugin_databaseinventory_databaseparams_id' => $ID, + ], ); - $dbcredentials = new PluginDatabaseinventoryCredential(); + $dbcredentials = new PluginDatabaseinventoryCredential(); $listofcredentials = []; - $used = []; + $used = []; foreach ($dbpcredentialslist as $dbpcredential) { $used[] = $dbpcredential['plugin_databaseinventory_credentials_id']; if ($dbcredentials->getFromDB($dbpcredential['plugin_databaseinventory_credentials_id'])) { - $listofcredentials[] = $dbcredentials->fields + - [ - 'type' => Dropdown::getDropdownName( - PluginDatabaseinventoryCredentialType::getTable(), - $dbcredentials->fields['plugin_databaseinventory_credentialtypes_id'] - ), - 'link' => $dbcredentials->getLinkURL(), - 'iddbparamcredential' => $dbpcredential['id'], - ]; + $listofcredentials[] = $dbcredentials->fields + [ + 'type' => Dropdown::getDropdownName( + PluginDatabaseinventoryCredentialType::getTable(), + $dbcredentials->fields['plugin_databaseinventory_credentialtypes_id'], + ), + 'link' => $dbcredentials->getLinkURL(), + 'iddbparamcredential' => $dbpcredential['id'], + ]; } } TemplateRenderer::getInstance()->display( '@databaseinventory/databaseparam_credential.html.twig', [ - 'item' => PluginDatabaseinventoryDatabaseParam::getById($ID), - 'credentiallist' => $listofcredentials, - 'credentialclass' => PluginDatabaseinventoryCredential::class, + 'item' => PluginDatabaseinventoryDatabaseParam::getById($ID), + 'credentiallist' => $listofcredentials, + 'credentialclass' => PluginDatabaseinventoryCredential::class, 'credentialtypeclass' => PluginDatabaseinventoryDatabaseParam_Credential::class, - 'canread' => $databaseparams->can($ID, READ), - 'canedit' => $databaseparams->can($ID, UPDATE), - 'canadd' => $databaseparams->canAddItem('itemtype'), - 'used' => $used, - ] + 'canread' => $databaseparams->can($ID, READ), + 'canedit' => $databaseparams->can($ID, UPDATE), + 'canadd' => $databaseparams->canAddItem('itemtype'), + 'used' => $used, + ], ); return true; @@ -164,9 +166,9 @@ public static function install(Migration $migration) /** @var DBmysql $DB */ global $DB; - $default_charset = DBConnection::getDefaultCharset(); + $default_charset = DBConnection::getDefaultCharset(); $default_collation = DBConnection::getDefaultCollation(); - $default_key_sign = DBConnection::getDefaultPrimaryKeySignOption(); + $default_key_sign = DBConnection::getDefaultPrimaryKeySignOption(); $table = self::getTable(); if (!$DB->tableExists($table)) { @@ -194,7 +196,7 @@ public static function uninstall(Migration $migration) global $DB; $table = self::getTable(); if ($DB->tableExists($table)) { - $DB->query("DROP TABLE IF EXISTS `" . self::getTable() . "`") or die($DB->error()); + $DB->query('DROP TABLE IF EXISTS `' . self::getTable() . '`') or die($DB->error()); } } } diff --git a/inc/inventoryaction.class.php b/inc/inventoryaction.class.php index 54fd723..ac2cce3 100644 --- a/inc/inventoryaction.class.php +++ b/inc/inventoryaction.class.php @@ -32,7 +32,7 @@ class PluginDatabaseinventoryInventoryAction extends CommonDBTM { - public const MA_PARTIAL = 'partial_database_inventory'; + public const MA_PARTIAL = 'partial_database_inventory'; private const ENDPOINT_PARTIAL = 'now?'; public static function showMassiveActionsSubForm(MassiveAction $ma) @@ -40,7 +40,8 @@ public static function showMassiveActionsSubForm(MassiveAction $ma) if ($ma->getAction() !== self::MA_PARTIAL) { return parent::showMassiveActionsSubForm($ma); } - echo Html::submit(__('Run', "databaseinventory"), ['name' => 'submit']); + echo Html::submit(__('Run', 'databaseinventory'), ['name' => 'submit']); + return true; } @@ -48,6 +49,7 @@ public static function processMassiveActionsForOneItemtype(MassiveAction $ma, Co { if ($ma->getAction() !== self::MA_PARTIAL) { parent::processMassiveActionsForOneItemtype($ma, $item, $ids); + return; } @@ -58,14 +60,14 @@ public static function processMassiveActionsForOneItemtype(MassiveAction $ma, Co $computer->getFromDB($id); if ($agent = self::findAgent($computer)) { if (PluginDatabaseinventoryInventoryAction::runPartialInventory($agent, true)) { - $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_OK); + $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_OK); } else { $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_KO); $ma->addMessage($item->getErrorMessage(ERROR_ON_ACTION)); } } else { $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_KO); - $ma->addMessage(__('Agent not found for computer', "databaseinventory") . "" . $computer->getFriendlyName() . ""); + $ma->addMessage(__('Agent not found for computer', 'databaseinventory') . "" . $computer->getFriendlyName() . ''); } } break; @@ -92,13 +94,13 @@ public static function runPartialInventory(Agent $agent, $fromMA = false) { try { // retrieve data to do database inventory - $data = PluginDatabaseinventoryTask::handleInventoryTask(['item' => $agent]); + $data = PluginDatabaseinventoryTask::handleInventoryTask(['item' => $agent]); $params = $data['options']['response']['inventory']['params']; $arg = ['partial' => 'yes', 'category' => 'database']; foreach ($params as $value) { - $arg['params_id'] = implode(",", array_column($params, 'params_id')); - $arg['use'][$value['params_id']] = implode(",", $value['use']); + $arg['params_id'] = implode(',', array_column($params, 'params_id')); + $arg['use'][$value['params_id']] = implode(',', $value['use']); } $endpoint = self::ENDPOINT_PARTIAL . Toolbox::append_params($arg); @@ -121,34 +123,35 @@ public static function runPartialInventory(Agent $agent, $fromMA = false) public static function handleAgentResponse(Response $response, $request): array { - $params = []; + $params = []; $params['answer'] = sprintf( __('Requested at %s', 'databaseinventory'), - Html::convDateTime(date('Y-m-d H:i:s')) + Html::convDateTime(date('Y-m-d H:i:s')), ); + return $params; } private static function findAgent(Computer $item) { - $agent = new Agent(); + $agent = new Agent(); $has_agent = $agent->getFromDBByCrit([ 'itemtype' => $item->getType(), - 'items_id' => $item->fields['id'] + 'items_id' => $item->fields['id'], ]); // if no agent has been found, check if there is a linked item, and find its agent if (!$has_agent && $item->getType() == 'Computer') { - $citem = new Computer_Item(); + $citem = new Computer_Item(); $has_relation = $citem->getFromDBByCrit([ 'itemtype' => $item->getType(), - 'items_id' => $item->fields['id'] + 'items_id' => $item->fields['id'], ]); if ($has_relation) { - $has_agent = $agent->getFromDBByCrit([ - 'itemtype' => \Computer::getType(), - 'items_id' => $citem->fields['computers_id'] - ]); + $has_agent = $agent->getFromDBByCrit([ + 'itemtype' => \Computer::getType(), + 'items_id' => $citem->fields['computers_id'], + ]); } } @@ -176,9 +179,9 @@ public static function postItemForm($item) echo $out; - $url = Plugin::getWebDir('databaseinventory') . "/ajax/agent.php"; + $url = Plugin::getWebDir('databaseinventory') . '/ajax/agent.php'; $key = PluginDatabaseinventoryInventoryAction::MA_PARTIAL; - $js = <<" . $link::getTypeName(Session::getPluralNumber()) . ""; + $link_text = "" . $link::getTypeName(Session::getPluralNumber()) . ''; $links["$link_text"] = $link::getSearchURL(false); } $menu = [ - 'title' => self::getMenuName(), - 'page' => PluginDatabaseinventoryDatabaseParam::getSearchURL(false), - 'icon' => 'fas fa-database', + 'title' => self::getMenuName(), + 'page' => PluginDatabaseinventoryDatabaseParam::getSearchURL(false), + 'icon' => 'fas fa-database', 'options' => [], 'links' => $links, ]; $menu['options']['databaseparam'] = [ - 'title' => PluginDatabaseinventoryDatabaseParam::getTypeName(2), - 'page' => PluginDatabaseinventoryDatabaseParam::getSearchURL(false), - 'icon' => PluginDatabaseinventoryDatabaseParam::getIcon(), - 'links' => $links, + 'title' => PluginDatabaseinventoryDatabaseParam::getTypeName(2), + 'page' => PluginDatabaseinventoryDatabaseParam::getSearchURL(false), + 'icon' => PluginDatabaseinventoryDatabaseParam::getIcon(), + 'links' => $links, ]; if (true) { @@ -72,10 +71,10 @@ public static function getMenuContent() ] + $links; } $menu['options']['computergroup'] = [ - 'title' => PluginDatabaseinventoryComputerGroup::getTypeName(2), - 'page' => PluginDatabaseinventoryComputerGroup::getSearchURL(false), - 'icon' => PluginDatabaseinventoryComputerGroup::getIcon(), - 'links' => $links, + 'title' => PluginDatabaseinventoryComputerGroup::getTypeName(2), + 'page' => PluginDatabaseinventoryComputerGroup::getSearchURL(false), + 'icon' => PluginDatabaseinventoryComputerGroup::getIcon(), + 'links' => $links, ]; if (true) { @@ -85,10 +84,10 @@ public static function getMenuContent() ] + $links; } $menu['options']['credential'] = [ - 'title' => PluginDatabaseinventoryCredential::getTypeName(2), - 'page' => PluginDatabaseinventoryCredential::getSearchURL(false), - 'icon' => PluginDatabaseinventoryCredential::getIcon(), - 'links' => $links, + 'title' => PluginDatabaseinventoryCredential::getTypeName(2), + 'page' => PluginDatabaseinventoryCredential::getSearchURL(false), + 'icon' => PluginDatabaseinventoryCredential::getIcon(), + 'links' => $links, ]; if (true) { $menu['options']['credential']['links'] = [ diff --git a/inc/profile.class.php b/inc/profile.class.php index 5220e41..657708e 100644 --- a/inc/profile.class.php +++ b/inc/profile.class.php @@ -43,9 +43,10 @@ private static function getAllRights($all = false) [ 'itemtype' => PluginDatabaseinventoryDatabaseParam::getType(), 'label' => PluginDatabaseinventoryProfile::getTypeName(), - 'field' => 'database_inventory' - ] + 'field' => 'database_inventory', + ], ]; + return $rights; } @@ -54,6 +55,7 @@ public function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) if ($item->getType() == 'Profile') { return self::createTabEntry(self::getTypeName()); } + return ''; } @@ -62,31 +64,32 @@ public static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $ if ($item instanceof Profile && $item->getField('id')) { return self::showForProfile($item->getID()); } + return true; } private static function showForProfile($profiles_id = 0) { $canupdate = self::canUpdate(); - $profile = new Profile(); + $profile = new Profile(); $profile->getFromDB($profiles_id); echo "
"; echo "
"; $rights = self::getAllRights(); - $profile->displayRightsChoiceMatrix($rights, array( - 'canedit' => $canupdate, - 'title' => self::getTypeName(), - )); + $profile->displayRightsChoiceMatrix($rights, [ + 'canedit' => $canupdate, + 'title' => self::getTypeName(), + ]); if ($canupdate) { echo "
"; - echo Html::hidden('id', array('value' => $profiles_id)); - echo Html::submit(_sx('button', 'Save'), array('name' => 'update')); + echo Html::hidden('id', ['value' => $profiles_id]); + echo Html::submit(_sx('button', 'Save'), ['name' => 'update']); echo "
\n"; Html::closeForm(); - echo "
"; + echo ''; } } diff --git a/inc/task.class.php b/inc/task.class.php index d9ab611..32510fc 100644 --- a/inc/task.class.php +++ b/inc/task.class.php @@ -34,38 +34,38 @@ public static function inventoryGetParams(array $params) { /** @var DBmysql $DB */ global $DB; - $agent = $params['item']; - $content = $params['options']['content']; + $agent = $params['item']; + $content = $params['options']['content']; $credential_found = []; $databaseparam_credential_table = PluginDatabaseinventoryDatabaseParam_Credential::getTable(); - $credential_table = PluginDatabaseinventoryCredential::getTable(); - $credential_type_table = PluginDatabaseinventoryCredentialType::getTable(); + $credential_table = PluginDatabaseinventoryCredential::getTable(); + $credential_type_table = PluginDatabaseinventoryCredentialType::getTable(); // load all credential type $criteria = [ - 'SELECT' => [ + 'SELECT' => [ $credential_table . '.id', ], - 'FROM' => $credential_table, - 'JOIN' => [ + 'FROM' => $credential_table, + 'JOIN' => [ $credential_type_table => [ 'ON' => [ - $credential_table => 'plugin_databaseinventory_credentialtypes_id', - $credential_type_table => 'id' - ] + $credential_table => 'plugin_databaseinventory_credentialtypes_id', + $credential_type_table => 'id', + ], ], $databaseparam_credential_table => [ 'ON' => [ $databaseparam_credential_table => 'plugin_databaseinventory_credentials_id', - $credential_table => 'id' - ] + $credential_table => 'id', + ], ], ], - 'WHERE' => [ - $credential_type_table . ".id" => PluginDatabaseinventoryCredentialType::getModuleKeyByName($content->use), - $databaseparam_credential_table . ".id" => $content->params_id, - ] + 'WHERE' => [ + $credential_type_table . '.id' => PluginDatabaseinventoryCredentialType::getModuleKeyByName($content->use), + $databaseparam_credential_table . '.id' => $content->params_id, + ], ]; // store credentials found @@ -95,11 +95,11 @@ public static function inventoryGetParams(array $params) $crendential = new PluginDatabaseinventoryCredential(); $crendential->getFromDB($crendential_id); $data = [ - "id" => $crendential->fields['id'], - "type" => $crendential->getCredentialMode(), - "use" => $content->use, - "login" => $crendential->fields['login'], - "password" => (new GLPIKey())->decrypt($crendential->fields['password']), + 'id' => $crendential->fields['id'], + 'type' => $crendential->getCredentialMode(), + 'use' => $content->use, + 'login' => $crendential->fields['login'], + 'password' => (new GLPIKey())->decrypt($crendential->fields['password']), ]; if (!empty($crendential->fields['socket'])) { @@ -114,11 +114,11 @@ public static function inventoryGetParams(array $params) // store requested credentials $contact_log = new PluginDatabaseinventoryContactLog(); - $log = [ - "agents_id" => $agent->fields['id'], - "plugin_databaseinventory_credentials_id" => $crendential_id, - "plugin_databaseinventory_databaseparams_id" => $content->params_id, - "date_creation " => $_SESSION["glpi_currenttime"] + $log = [ + 'agents_id' => $agent->fields['id'], + 'plugin_databaseinventory_credentials_id' => $crendential_id, + 'plugin_databaseinventory_databaseparams_id' => $content->params_id, + 'date_creation ' => $_SESSION['glpi_currenttime'], ]; $contact_log->add($log); } @@ -159,26 +159,26 @@ public static function handleInventoryTask(array $params) $database_param_computergroup_table => [ 'ON' => [ $database_param_computergroup_table => 'plugin_databaseinventory_databaseparams_id', - $database_param_table => 'id' - ] + $database_param_table => 'id', + ], ], $computer_group_table => [ 'ON' => [ $database_param_computergroup_table => 'plugin_databaseinventory_computergroups_id', - $computer_group_table => 'id' - ] + $computer_group_table => 'id', + ], ], - $computer_group_static_table => [ + $computer_group_static_table => [ 'ON' => [ $computer_group_static_table => 'plugin_databaseinventory_computergroups_id', - $computer_group_table => 'id' - ] - ] + $computer_group_table => 'id', + ], + ], + ], + 'WHERE' => [ + $computer_group_static_table . '.computers_id' => $computer->fields['id'], + $database_param_table . '.is_active' => 1, ], - 'WHERE' => [ - $computer_group_static_table . ".computers_id" => $computer->fields['id'], - $database_param_table . ".is_active" => 1 - ] ]; // store databaseparam found @@ -203,35 +203,35 @@ public static function handleInventoryTask(array $params) $computer_group_table => [ 'ON' => [ $computer_group_dynamic_table => 'plugin_databaseinventory_computergroups_id', - $computer_group_table => 'id' - ] + $computer_group_table => 'id', + ], ], $database_param_computergroup_table => [ 'ON' => [ $database_param_computergroup_table => 'plugin_databaseinventory_computergroups_id', - $computer_group_table => 'id' - ] + $computer_group_table => 'id', + ], ], - $database_param_table => [ + $database_param_table => [ 'ON' => [ $database_param_computergroup_table => 'plugin_databaseinventory_databaseparams_id', - $database_param_table => 'id' - ] - ] + $database_param_table => 'id', + ], + ], + ], + 'WHERE' => [ + $database_param_table . '.is_active' => 1, ], - 'WHERE' => [ - $database_param_table . ".is_active" => 1 - ] ]; if (!empty($database_param_found)) { $criteria['WHERE'] = [ - $database_param_table . ".is_active" => 1, - ['NOT' => [$database_param_table . ".id" => $database_param_found]] //no need to look for what is already found + $database_param_table . '.is_active' => 1, + ['NOT' => [$database_param_table . '.id' => $database_param_found]], //no need to look for what is already found ]; } else { $criteria['WHERE'] = [ - $database_param_table . ".is_active" => 1, + $database_param_table . '.is_active' => 1, ]; } @@ -281,10 +281,10 @@ public static function handleInventoryTask(array $params) $database_params = new PluginDatabaseinventoryDatabaseParam(); $database_params->getFromDB($database_params_id); - $json = []; - $json['category'] = "database"; - $json['use'] = $database_params->getCredentialTypeLinked(); - $json['params_id'] = $database_params_id; + $json = []; + $json['category'] = 'database'; + $json['use'] = $database_params->getCredentialTypeLinked(); + $json['params_id'] = $database_params_id; if ($database_params->fields['partial_inventory']) { $json['delay'] = $database_params->fields['execution_delay']; } diff --git a/setup.php b/setup.php index 207b9c0..de00cc2 100644 --- a/setup.php +++ b/setup.php @@ -60,12 +60,12 @@ function plugin_init_databaseinventory() $PLUGIN_HOOKS['item_purge']['databaseinventory'] = [ 'Computer' => 'cleanComputerFromStaticGroup', - 'Agent' => 'cleanAgentFromContactLog' + 'Agent' => 'cleanAgentFromContactLog', ]; - if (Session::haveRight("config", UPDATE)) { + if (Session::haveRight('config', UPDATE)) { $PLUGIN_HOOKS['menu_toadd']['databaseinventory'] = [ - 'admin' => 'PluginDatabaseinventoryMenu' + 'admin' => 'PluginDatabaseinventoryMenu', ]; Plugin::registerClass('PluginDatabaseinventoryContactLog', ['addtabon' => 'Agent']); @@ -73,7 +73,7 @@ function plugin_init_databaseinventory() $PLUGIN_HOOKS['use_massive_action']['databaseinventory'] = 1; $PLUGIN_HOOKS['autoinventory_information']['databaseinventory'] = [ - 'Computer' => 'postItemForm' + 'Computer' => 'postItemForm', ]; } } @@ -88,16 +88,16 @@ function plugin_init_databaseinventory() function plugin_version_databaseinventory() { return [ - 'name' => __('Database Inventory', 'databaseinventory'), - 'version' => PLUGIN_DATABASEINVENTORY_VERSION, - 'author' => 'Teclib\'', - 'license' => 'GPL v3', - 'homepage' => 'https://services.glpi-network.com', - 'requirements' => [ + 'name' => __('Database Inventory', 'databaseinventory'), + 'version' => PLUGIN_DATABASEINVENTORY_VERSION, + 'author' => 'Teclib\'', + 'license' => 'GPL v3', + 'homepage' => 'https://services.glpi-network.com', + 'requirements' => [ 'glpi' => [ 'min' => PLUGIN_DATABASEINVENTORY_MIN_GLPI, 'max' => PLUGIN_DATABASEINVENTORY_MAX_GLPI, - ] - ] + ], + ], ]; }