From 2ed11488d16406a62b7e2e63829b4ed6be460924 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Anne?= Date: Wed, 10 Nov 2021 08:59:22 +0100 Subject: [PATCH 1/7] Permit installation on GLPI 10.0.x --- setup.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.php b/setup.php index 2d7ce47..ac29d2e 100644 --- a/setup.php +++ b/setup.php @@ -36,7 +36,7 @@ // Minimal GLPI version, inclusive define('PLUGIN_AIRWATCH_MIN_GLPI', '9.5'); // Maximum GLPI version, exclusive -define('PLUGIN_AIRWATCH_MAX_GLPI', '9.6'); +define('PLUGIN_AIRWATCH_MAX_GLPI', '10.0.99'); function plugin_init_airwatch() { global $PLUGIN_HOOKS,$CFG_GLPI,$LANG; From 89459fcd30258bec72ccdc5e6ee3bb4e0b1ebdbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Anne?= Date: Mon, 15 Nov 2021 14:47:31 +0100 Subject: [PATCH 2/7] Replace deprecated usage of Html::autocompletionTextField() --- inc/config.class.php | 50 +++++++++++++++++++++++++++++++++----------- 1 file changed, 38 insertions(+), 12 deletions(-) diff --git a/inc/config.class.php b/inc/config.class.php index d3406dd..0adf4ff 100644 --- a/inc/config.class.php +++ b/inc/config.class.php @@ -54,48 +54,74 @@ public function showForm() { echo ""; echo "" . __("Service URL", "fusioninventory") . ""; echo ""; - Html::autocompletionTextField($this, "fusioninventory_url"); + echo Html::input( + 'fusioninventory_url', + [ + 'value' => $this->fields['fusioninventory_url'], + ] + ); echo ""; echo ""; echo ""; echo "" . __("Airwatch Service URL", "airwatch") . ""; echo ""; - Html::autocompletionTextField($this, "airwatch_service_url"); + echo Html::input( + 'airwatch_service_url', + [ + 'value' => $this->fields['airwatch_service_url'], + ] + ); echo ""; echo ""; echo ""; echo "" . __("Airwatch Console URL", "airwatch") . ""; echo ""; - Html::autocompletionTextField($this, "airwatch_console_url"); + echo Html::input( + 'airwatch_console_url', + [ + 'value' => $this->fields['airwatch_console_url'], + ] + ); echo ""; echo ""; echo ""; echo "" . __("Username", "airwatch") . ""; echo ""; - // FIXME This is a credential field so it is not in autocomplete whitelist - // Replace with a simple text input. - Html::autocompletionTextField($this, "username"); + echo Html::input( + 'username', + [ + 'value' => $this->fields['username'], + ] + ); echo ""; echo ""; echo ""; echo "" . __("Password", "airwatch") . ""; echo ""; - // FIXME This is a credential field so it is not in autocomplete whitelist - // Replace with a password text input, crypt it, and handle ability to "blank" it. - Html::autocompletionTextField($this, "password"); + // FIXME This is a credential field. Encrypt it, and handle ability to "blank" it. + echo Html::input( + 'password', + [ + 'type' => 'password', + 'value' => $this->fields['password'], + ] + ); echo ""; echo ""; echo ""; echo "" . __("API Key", "airwatch") . ""; echo ""; - // FIXME This is a credential field so it is not in autocomplete whitelist - // Replace with a simple text input. - Html::autocompletionTextField($this, "api_key"); + echo Html::input( + 'api_key', + [ + 'value' => $this->fields['api_key'], + ] + ); echo ""; echo ""; From 53337f33ae258892072b0f0996acbd1c4de83068 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Anne?= Date: Fri, 3 Dec 2021 10:32:01 +0100 Subject: [PATCH 3/7] Fix showForm() signature --- inc/config.class.php | 2 +- setup.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/config.class.php b/inc/config.class.php index 0adf4ff..429c053 100644 --- a/inc/config.class.php +++ b/inc/config.class.php @@ -39,7 +39,7 @@ public static function getTypeName($nb = 0) { return __("GLPi Airwatch Connector", 'airwatch'); } - public function showForm() { + public function showForm($ID, array $options = []) { $this->getFromDB(1); echo "
"; diff --git a/setup.php b/setup.php index ac29d2e..25b1092 100644 --- a/setup.php +++ b/setup.php @@ -34,7 +34,7 @@ define ('PLUGIN_AIRWATCH_VERSION', '1.5.0'); // Minimal GLPI version, inclusive -define('PLUGIN_AIRWATCH_MIN_GLPI', '9.5'); +define('PLUGIN_AIRWATCH_MIN_GLPI', '10.0.0'); // Maximum GLPI version, exclusive define('PLUGIN_AIRWATCH_MAX_GLPI', '10.0.99'); From ef611caad10753f529d885496bf0a1e4704b3674 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Anne?= Date: Mon, 6 Dec 2021 11:29:52 +0100 Subject: [PATCH 4/7] Use same PHP minimal version as GLPI core; upgrade build libs --- composer.json | 4 +- composer.lock | 487 ++++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 452 insertions(+), 39 deletions(-) diff --git a/composer.json b/composer.json index 16dc795..56459e6 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "require": { - "php": "^7.2", + "php": ">=7.4", "ext-curl": "*" }, "require-dev": { @@ -9,7 +9,7 @@ "config": { "optimize-autoloader": true, "platform": { - "php": "7.2.0" + "php": "7.4.0" }, "sort-packages": true } diff --git a/composer.lock b/composer.lock index a30c561..669ef27 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "2423e28867b21bcd55a6f0940e60ed90", + "content-hash": "e405cfffe6cde8e1ea300c849e36716f", "packages": [], "packages-dev": [ { @@ -61,20 +61,20 @@ }, { "name": "psr/container", - "version": "1.1.1", + "version": "1.1.2", "source": { "type": "git", "url": "https://github.com/php-fig/container.git", - "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf" + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/8622567409010282b7aeebe4bb841fe98b58dcaf", - "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf", + "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea", + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea", "shasum": "" }, "require": { - "php": ">=7.2.0" + "php": ">=7.4.0" }, "type": "library", "autoload": { @@ -103,49 +103,52 @@ ], "support": { "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/1.1.1" + "source": "https://github.com/php-fig/container/tree/1.1.2" }, - "time": "2021-03-05T17:36:06+00:00" + "time": "2021-11-05T16:50:12+00:00" }, { "name": "symfony/console", - "version": "v4.4.37", + "version": "v5.4.3", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "0259f01dbf9d77badddbbf4c2abb681f24c9cac6" + "reference": "a2a86ec353d825c75856c6fd14fac416a7bdb6b8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/0259f01dbf9d77badddbbf4c2abb681f24c9cac6", - "reference": "0259f01dbf9d77badddbbf4c2abb681f24c9cac6", + "url": "https://api.github.com/repos/symfony/console/zipball/a2a86ec353d825c75856c6fd14fac416a7bdb6b8", + "reference": "a2a86ec353d825c75856c6fd14fac416a7bdb6b8", "shasum": "" }, "require": { - "php": ">=7.1.3", + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php73": "^1.8", + "symfony/polyfill-php73": "^1.9", "symfony/polyfill-php80": "^1.16", - "symfony/service-contracts": "^1.1|^2" + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/string": "^5.1|^6.0" }, "conflict": { "psr/log": ">=3", - "symfony/dependency-injection": "<3.4", - "symfony/event-dispatcher": "<4.3|>=5", + "symfony/dependency-injection": "<4.4", + "symfony/dotenv": "<5.1", + "symfony/event-dispatcher": "<4.4", "symfony/lock": "<4.4", - "symfony/process": "<3.3" + "symfony/process": "<4.4" }, "provide": { "psr/log-implementation": "1.0|2.0" }, "require-dev": { "psr/log": "^1|^2", - "symfony/config": "^3.4|^4.0|^5.0", - "symfony/dependency-injection": "^3.4|^4.0|^5.0", - "symfony/event-dispatcher": "^4.3", - "symfony/lock": "^4.4|^5.0", - "symfony/process": "^3.4|^4.0|^5.0", - "symfony/var-dumper": "^4.3|^5.0" + "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", @@ -178,8 +181,163 @@ ], "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.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": "2022-01-26T16:28:35+00:00" + }, + { + "name": "symfony/deprecation-contracts", + "version": "v2.5.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "6f981ee24cf69ee7ce9736146d1c57c2780598a8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/6f981ee24cf69ee7ce9736146d1c57c2780598a8", + "reference": "6f981ee24cf69ee7ce9736146d1c57c2780598a8", + "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.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": "2021-07-12T14:48:14+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.24.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "30885182c981ab175d4d034db0f6f469898070ab" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/30885182c981ab175d4d034db0f6f469898070ab", + "reference": "30885182c981ab175d4d034db0f6f469898070ab", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "provide": { + "ext-ctype": "*" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], "support": { - "source": "https://github.com/symfony/console/tree/v4.4.37" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.24.0" }, "funding": [ { @@ -195,7 +353,172 @@ "type": "tidelift" } ], - "time": "2022-01-26T16:15:26+00:00" + "time": "2021-10-20T20:35:02+00:00" + }, + { + "name": "symfony/polyfill-intl-grapheme", + "version": "v1.24.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-grapheme.git", + "reference": "81b86b50cf841a64252b439e738e97f4a34e2783" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/81b86b50cf841a64252b439e738e97f4a34e2783", + "reference": "81b86b50cf841a64252b439e738e97f4a34e2783", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Intl\\Grapheme\\": "" + }, + "files": [ + "bootstrap.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": "Symfony polyfill for intl's grapheme_* functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "grapheme", + "intl", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.24.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": "2021-11-23T21:10:46+00:00" + }, + { + "name": "symfony/polyfill-intl-normalizer", + "version": "v1.24.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-normalizer.git", + "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8590a5f561694770bdcd3f9b5c69dde6945028e8", + "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + }, + "files": [ + "bootstrap.php" + ], + "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 for intl's Normalizer class and related functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "intl", + "normalizer", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.24.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": "2021-02-19T12:13:01+00:00" }, { "name": "symfony/polyfill-mbstring", @@ -444,21 +767,25 @@ }, { "name": "symfony/service-contracts", - "version": "v1.1.11", + "version": "v2.5.0", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "633df678bec3452e04a7b0337c9bcfe7354124b3" + "reference": "1ab11b933cd6bc5464b08e81e2c5b07dec58b0fc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/633df678bec3452e04a7b0337c9bcfe7354124b3", - "reference": "633df678bec3452e04a7b0337c9bcfe7354124b3", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/1ab11b933cd6bc5464b08e81e2c5b07dec58b0fc", + "reference": "1ab11b933cd6bc5464b08e81e2c5b07dec58b0fc", "shasum": "" }, "require": { - "php": ">=7.1.3", - "psr/container": "^1.0" + "php": ">=7.2.5", + "psr/container": "^1.1", + "symfony/deprecation-contracts": "^2.1" + }, + "conflict": { + "ext-psr": "<1.1|>=2" }, "suggest": { "symfony/service-implementation": "" @@ -466,7 +793,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.1-dev" + "dev-main": "2.5-dev" }, "thanks": { "name": "symfony/contracts", @@ -503,7 +830,93 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v1.1.11" + "source": "https://github.com/symfony/service-contracts/tree/v2.5.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": "2021-11-04T16:48:04+00:00" + }, + { + "name": "symfony/string", + "version": "v5.4.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/string.git", + "reference": "92043b7d8383e48104e411bc9434b260dbeb5a10" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/string/zipball/92043b7d8383e48104e411bc9434b260dbeb5a10", + "reference": "92043b7d8383e48104e411bc9434b260dbeb5a10", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-intl-grapheme": "~1.0", + "symfony/polyfill-intl-normalizer": "~1.0", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php80": "~1.15" + }, + "conflict": { + "symfony/translation-contracts": ">=3.0" + }, + "require-dev": { + "symfony/error-handler": "^4.4|^5.0|^6.0", + "symfony/http-client": "^4.4|^5.0|^6.0", + "symfony/translation-contracts": "^1.1|^2", + "symfony/var-exporter": "^4.4|^5.0|^6.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\String\\": "" + }, + "files": [ + "Resources/functions.php" + ], + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "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": "Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way", + "homepage": "https://symfony.com", + "keywords": [ + "grapheme", + "i18n", + "string", + "unicode", + "utf-8", + "utf8" + ], + "support": { + "source": "https://github.com/symfony/string/tree/v5.4.3" }, "funding": [ { @@ -519,7 +932,7 @@ "type": "tidelift" } ], - "time": "2021-11-04T13:32:43+00:00" + "time": "2022-01-02T09:53:40+00:00" } ], "aliases": [], @@ -528,12 +941,12 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "^7.2", + "php": ">=7.4", "ext-curl": "*" }, "platform-dev": [], "platform-overrides": { - "php": "7.2.0" + "php": "7.4.0" }, "plugin-api-version": "2.1.0" } From 07e1ae9f698ac5dde5e420464762b0035e826e3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Anne?= Date: Mon, 6 Dec 2021 13:40:06 +0100 Subject: [PATCH 5/7] Remove deprecated usage of integer display width --- inc/compliance.class.php | 6 +++--- inc/config.class.php | 4 ++-- inc/detail.class.php | 32 ++++++++++++++++---------------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/inc/compliance.class.php b/inc/compliance.class.php index 0f89531..f38556f 100644 --- a/inc/compliance.class.php +++ b/inc/compliance.class.php @@ -106,10 +106,10 @@ static function install(Migration $migration) { if (!$DB->tableExists('glpi_plugin_airwatch_compliances')) { $query = "CREATE TABLE `glpi_plugin_airwatch_compliances` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `computers_id` int(11) NOT NULL DEFAULT '0', + `id` int NOT NULL AUTO_INCREMENT, + `computers_id` int NOT NULL DEFAULT '0', `name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `is_compliant` tinyint(1) NOT NULL DEFAULT '0', + `is_compliant` tinyint NOT NULL DEFAULT '0', `date_last_check` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`), KEY `computers_id` (`computers_id`), diff --git a/inc/config.class.php b/inc/config.class.php index 429c053..17d1108 100644 --- a/inc/config.class.php +++ b/inc/config.class.php @@ -157,14 +157,14 @@ public static function install(Migration $migration) { //Install $query = "CREATE TABLE `glpi_plugin_airwatch_configs` ( - `id` int(11) NOT NULL auto_increment, + `id` int NOT NULL auto_increment, `fusioninventory_url` varchar(255) character set utf8 collate utf8_unicode_ci NOT NULL, `airwatch_service_url` varchar(255) character set utf8 collate utf8_unicode_ci NOT NULL, `airwatch_console_url` varchar(255) character set utf8 collate utf8_unicode_ci NOT NULL, `username` varchar(255) character set utf8 collate utf8_unicode_ci NOT NULL, `password` varchar(255) character set utf8 collate utf8_unicode_ci NOT NULL, `api_key` varchar(255) character set utf8 collate utf8_unicode_ci NOT NULL, - `skip_ssl_check` tinyint(1) NOT NULL default '0', + `skip_ssl_check` tinyint NOT NULL default '0', PRIMARY KEY (`id`), KEY `fusioninventory_url` (`fusioninventory_url`), KEY `airwatch_service_url` (`airwatch_service_url`), diff --git a/inc/detail.class.php b/inc/detail.class.php index c8ce1d9..eaac5f2 100644 --- a/inc/detail.class.php +++ b/inc/detail.class.php @@ -424,9 +424,9 @@ public static function install(Migration $migration) { //Install $query = "CREATE TABLE `glpi_plugin_airwatch_details` ( - `id` int(11) NOT NULL auto_increment, - `computers_id` int(11) NOT NULL DEFAULT '0', - `aw_device_id` int(11) NOT NULL DEFAULT '0', + `id` int NOT NULL auto_increment, + `computers_id` int NOT NULL DEFAULT '0', + `aw_device_id` int NOT NULL DEFAULT '0', `imei` varchar(255) character set utf8 collate utf8_unicode_ci NOT NULL DEFAULT '', `simcard_serial` varchar(255) character set utf8 collate utf8_unicode_ci NOT NULL DEFAULT '', `phone_number` varchar(255) character set utf8 collate utf8_unicode_ci NOT NULL DEFAULT '', @@ -437,13 +437,13 @@ public static function install(Migration $migration) { `date_last_enrollment_check` timestamp NULL DEFAULT NULL, `date_last_compliance_check` timestamp NULL DEFAULT NULL, `date_last_compromised_check` timestamp NULL DEFAULT NULL, - `is_enrolled` tinyint(1) NOT NULL DEFAULT '0', - `is_compliant` tinyint(1) NOT NULL DEFAULT '-1', - `is_compromised` tinyint(1) NOT NULL DEFAULT '-1', - `is_dataencryption` tinyint(1) NOT NULL DEFAULT '-1', - `is_roaming_enabled` tinyint(1) NOT NULL DEFAULT '-1', - `is_data_roaming_enabled` tinyint(1) NOT NULL DEFAULT '-1', - `is_voice_roaming_enabled` tinyint(1) NOT NULL DEFAULT '-1', + `is_enrolled` tinyint NOT NULL DEFAULT '0', + `is_compliant` tinyint NOT NULL DEFAULT '-1', + `is_compromised` tinyint NOT NULL DEFAULT '-1', + `is_dataencryption` tinyint NOT NULL DEFAULT '-1', + `is_roaming_enabled` tinyint NOT NULL DEFAULT '-1', + `is_data_roaming_enabled` tinyint NOT NULL DEFAULT '-1', + `is_voice_roaming_enabled` tinyint NOT NULL DEFAULT '-1', PRIMARY KEY (`id`), KEY `computers_id` (`computers_id`), KEY `aw_device_id` (`aw_device_id`), @@ -465,17 +465,17 @@ public static function install(Migration $migration) { $DB->query($query) or die ($DB->error()); } else { $migration->changeField('glpi_plugin_airwatch_details', 'is_compliant', 'is_compliant', - 'TINYINT(1) NOT NULL DEFAULT \'-1\''); + 'TINYINT NOT NULL DEFAULT \'-1\''); $migration->changeField('glpi_plugin_airwatch_details', 'is_compromised', 'is_compromised', - 'TINYINT(1) NOT NULL DEFAULT \'-1\''); + 'TINYINT NOT NULL DEFAULT \'-1\''); $migration->changeField('glpi_plugin_airwatch_details', 'is_dataencryption', - 'is_dataencryption', 'TINYINT(1) NOT NULL DEFAULT \'-1\''); + 'is_dataencryption', 'TINYINT NOT NULL DEFAULT \'-1\''); $migration->changeField('glpi_plugin_airwatch_details', 'is_roaming_enabled', - 'is_roaming_enabled', 'TINYINT(1) NOT NULL DEFAULT \'-1\''); + 'is_roaming_enabled', 'TINYINT NOT NULL DEFAULT \'-1\''); $migration->changeField('glpi_plugin_airwatch_details', 'is_data_roaming_enabled', - 'is_data_roaming_enabled', 'TINYINT(1) NOT NULL DEFAULT \'-1\''); + 'is_data_roaming_enabled', 'TINYINT NOT NULL DEFAULT \'-1\''); $migration->changeField('glpi_plugin_airwatch_details', 'is_voice_roaming_enabled', - 'is_voice_roaming_enabled', 'TINYINT(1) NOT NULL DEFAULT \'-1\''); + 'is_voice_roaming_enabled', 'TINYINT NOT NULL DEFAULT \'-1\''); $migration->migrationOneTable('glpi_plugin_airwatch_details'); } } From a8c64480b7058c8adf3c34e85856f673fd2b4ac8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Anne?= Date: Mon, 6 Dec 2021 13:54:53 +0100 Subject: [PATCH 6/7] Use default GLPI charset/collation during install/update --- inc/compliance.class.php | 7 +++++-- inc/config.class.php | 17 ++++++++++------- inc/detail.class.php | 11 +++++++---- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/inc/compliance.class.php b/inc/compliance.class.php index f38556f..9caab2e 100644 --- a/inc/compliance.class.php +++ b/inc/compliance.class.php @@ -104,18 +104,21 @@ static function addProfile($computers_id, $name, $is_compliant, $date_last_check static function install(Migration $migration) { global $DB; + $default_charset = DBConnection::getDefaultCharset(); + $default_collation = DBConnection::getDefaultCollation(); + if (!$DB->tableExists('glpi_plugin_airwatch_compliances')) { $query = "CREATE TABLE `glpi_plugin_airwatch_compliances` ( `id` int NOT NULL AUTO_INCREMENT, `computers_id` int NOT NULL DEFAULT '0', - `name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `name` varchar(255) DEFAULT NULL, `is_compliant` tinyint NOT NULL DEFAULT '0', `date_last_check` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`), KEY `computers_id` (`computers_id`), KEY `is_compliant` (`is_compliant`), KEY `date_last_check` (`date_last_check`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;"; + ) ENGINE=InnoDB DEFAULT CHARSET={$default_charset} COLLATE={$default_collation};"; $DB->queryOrDie($query, $DB->error()); } } diff --git a/inc/config.class.php b/inc/config.class.php index 17d1108..1fcee8b 100644 --- a/inc/config.class.php +++ b/inc/config.class.php @@ -155,15 +155,18 @@ public static function install(Migration $migration) { if (!$DB->tableExists("glpi_plugin_airwatch_configs")) { $migration->displayMessage("Install glpi_plugin_airwatch_configs"); + $default_charset = DBConnection::getDefaultCharset(); + $default_collation = DBConnection::getDefaultCollation(); + //Install $query = "CREATE TABLE `glpi_plugin_airwatch_configs` ( `id` int NOT NULL auto_increment, - `fusioninventory_url` varchar(255) character set utf8 collate utf8_unicode_ci NOT NULL, - `airwatch_service_url` varchar(255) character set utf8 collate utf8_unicode_ci NOT NULL, - `airwatch_console_url` varchar(255) character set utf8 collate utf8_unicode_ci NOT NULL, - `username` varchar(255) character set utf8 collate utf8_unicode_ci NOT NULL, - `password` varchar(255) character set utf8 collate utf8_unicode_ci NOT NULL, - `api_key` varchar(255) character set utf8 collate utf8_unicode_ci NOT NULL, + `fusioninventory_url` varchar(255) NOT NULL, + `airwatch_service_url` varchar(255) NOT NULL, + `airwatch_console_url` varchar(255) NOT NULL, + `username` varchar(255) NOT NULL, + `password` varchar(255) NOT NULL, + `api_key` varchar(255) NOT NULL, `skip_ssl_check` tinyint NOT NULL default '0', PRIMARY KEY (`id`), KEY `fusioninventory_url` (`fusioninventory_url`), @@ -173,7 +176,7 @@ public static function install(Migration $migration) { KEY `password` (`password`), KEY `api_key` (`api_key`), KEY `skip_ssl_check` (`skip_ssl_check`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;"; + ) ENGINE=InnoDB DEFAULT CHARSET={$default_charset} COLLATE={$default_collation};"; $DB->query($query) or die ($DB->error()); $tmp = ['id' => 1, diff --git a/inc/detail.class.php b/inc/detail.class.php index eaac5f2..8eda9ae 100644 --- a/inc/detail.class.php +++ b/inc/detail.class.php @@ -422,14 +422,17 @@ public static function install(Migration $migration) { if (!$DB->tableExists("glpi_plugin_airwatch_details")) { $migration->displayMessage("Install glpi_plugin_airwatch_details"); + $default_charset = DBConnection::getDefaultCharset(); + $default_collation = DBConnection::getDefaultCollation(); + //Install $query = "CREATE TABLE `glpi_plugin_airwatch_details` ( `id` int NOT NULL auto_increment, `computers_id` int NOT NULL DEFAULT '0', `aw_device_id` int NOT NULL DEFAULT '0', - `imei` varchar(255) character set utf8 collate utf8_unicode_ci NOT NULL DEFAULT '', - `simcard_serial` varchar(255) character set utf8 collate utf8_unicode_ci NOT NULL DEFAULT '', - `phone_number` varchar(255) character set utf8 collate utf8_unicode_ci NOT NULL DEFAULT '', + `imei` varchar(255) NOT NULL DEFAULT '', + `simcard_serial` varchar(255) NOT NULL DEFAULT '', + `phone_number` varchar(255) NOT NULL DEFAULT '', `date_mod` timestamp NULL DEFAULT NULL, `date_creation` timestamp NULL DEFAULT NULL, `date_last_seen` timestamp NULL DEFAULT NULL, @@ -461,7 +464,7 @@ public static function install(Migration $migration) { KEY `is_roaming_enabled` (`is_roaming_enabled`), KEY `is_data_roaming_enabled` (`is_data_roaming_enabled`), KEY `is_voice_roaming_enabled` (`is_voice_roaming_enabled`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;"; + ) ENGINE=InnoDB DEFAULT CHARSET={$default_charset} COLLATE={$default_collation};"; $DB->query($query) or die ($DB->error()); } else { $migration->changeField('glpi_plugin_airwatch_details', 'is_compliant', 'is_compliant', From 78f4745a86e4d7794df4f4463e1dacc77b357751 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Anne?= Date: Mon, 6 Dec 2021 15:12:27 +0100 Subject: [PATCH 7/7] Force database dynamic row format --- inc/compliance.class.php | 2 +- inc/config.class.php | 2 +- inc/detail.class.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/inc/compliance.class.php b/inc/compliance.class.php index 9caab2e..f1a4e04 100644 --- a/inc/compliance.class.php +++ b/inc/compliance.class.php @@ -118,7 +118,7 @@ static function install(Migration $migration) { KEY `computers_id` (`computers_id`), KEY `is_compliant` (`is_compliant`), KEY `date_last_check` (`date_last_check`) - ) ENGINE=InnoDB DEFAULT CHARSET={$default_charset} COLLATE={$default_collation};"; + ) ENGINE=InnoDB DEFAULT CHARSET={$default_charset} COLLATE={$default_collation} ROW_FORMAT=DYNAMIC;"; $DB->queryOrDie($query, $DB->error()); } } diff --git a/inc/config.class.php b/inc/config.class.php index 1fcee8b..1d2d397 100644 --- a/inc/config.class.php +++ b/inc/config.class.php @@ -176,7 +176,7 @@ public static function install(Migration $migration) { KEY `password` (`password`), KEY `api_key` (`api_key`), KEY `skip_ssl_check` (`skip_ssl_check`) - ) ENGINE=InnoDB DEFAULT CHARSET={$default_charset} COLLATE={$default_collation};"; + ) ENGINE=InnoDB DEFAULT CHARSET={$default_charset} COLLATE={$default_collation} ROW_FORMAT=DYNAMIC;"; $DB->query($query) or die ($DB->error()); $tmp = ['id' => 1, diff --git a/inc/detail.class.php b/inc/detail.class.php index 8eda9ae..a7be1b3 100644 --- a/inc/detail.class.php +++ b/inc/detail.class.php @@ -464,7 +464,7 @@ public static function install(Migration $migration) { KEY `is_roaming_enabled` (`is_roaming_enabled`), KEY `is_data_roaming_enabled` (`is_data_roaming_enabled`), KEY `is_voice_roaming_enabled` (`is_voice_roaming_enabled`) - ) ENGINE=InnoDB DEFAULT CHARSET={$default_charset} COLLATE={$default_collation};"; + ) ENGINE=InnoDB DEFAULT CHARSET={$default_charset} COLLATE={$default_collation} ROW_FORMAT=DYNAMIC;"; $DB->query($query) or die ($DB->error()); } else { $migration->changeField('glpi_plugin_airwatch_details', 'is_compliant', 'is_compliant',