diff --git a/.travis.yml b/.travis.yml index ab430c32..f357928f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,9 +8,10 @@ env: - FI_SOURCE="https://github.com/fusioninventory/fusioninventory-for-glpi" - CS=7.2 - DBNAME=glpitest + - AFTER_SUCCESS_BRANCH=9.3/bugfixes - secure: Y9sG3lZ3Fn3t5BXvcMJQxWsdSUVQgF4M08E6oouYrRc95HEj3ZwZOqp6Df58u8CQFA0EKJyvCBLn8UicvHGMKAD0RwGLBdSP4Ji9gJRZkyMZi79awSshdva/c8dqVQrRd4asuTNQfcagVJpNDnY8sYusw504JUilK3vFVp+39nNZUkcvT69NGVIlXzgHTYinBkVuqDhf5eVtcLcaESLEshrg+5ZERdm+0KifdJVREzhicJxofnmTl/wBsIP7XiQqspljf2/SxLqreGmWXYXUfqIwIOVtsd9fkZChQCz8USC7P427tH6styRDYuMCtvA9b/T/XacSdKFbuDezff3NbIM3b5BebDyCrOK5MGSOdRUY5RuyZN4R5LjePUE++9QNCUPeDSkfb23v0VfuqXIRAxfdtik517GzFy6O7/e6FU1msVZlGQED7Uek9nqnupj+0lIq+99Jcm1UCNJu1NTL2Tv80XXqySaxyE4Sedq/FiYAsy1bo2cg2367I2b4FhFXaJCKkFHcdjHXAeurkRy/brSPhBNoOO5/GA3RepUErgly4P8TLZqHNZv8rgMUoQ88sdwDyXG7dY4UwWiTlCkxMBTqBqJanlTMA9zn2bYyMDioTGnA7+VYAA8cddjFOMVrmmuFJ+YV2x1+5B5qd+Wt8RPwcPQDyqaiN5amb1HGeMA= matrix: - - GLPI_BRANCH=9.2.1 FI_BRANCH=glpi9.2+1.0 + - GLPI_BRANCH=9.2.1 FI_BRANCH=glpi9.2+2.0 - GLPI_BRANCH=9.2/bugfixes FI_BRANCH=glpi9.2+2.0 - GLPI_BRANCH=9.3.0 FI_BRANCH=glpi9.3+1.0 - GLPI_BRANCH=9.3/bugfixes FI_BRANCH=glpi9.3+1.0 @@ -33,17 +34,17 @@ before_install: before_script: - "./tests/before_script.sh" script: + - if [ "${TRAVIS_PHP_VERSION:0:3}" = "$CS" ] && [ "$GLPI_BRANCH" = "$AFTER_SUCCESS_BRANCH" ]; then COVERAGE="--nccfc CommonTreeDropdown CommonDropdown CommonDBTM CommonGLPI"; else COVERAGE="-ncc"; fi - vendor/bin/atoum -ft -bf tests/bootstrap.php -d tests/suite-install -ncc - #php scripts/mqtt.php --tests > /dev/null 2>&1 & - - vendor/bin/atoum -ft -bf tests/bootstrap.php -d tests/suite-unit --nccfc CommonTreeDropdown CommonDropdown CommonDBTM CommonGLPI - - vendor/bin/atoum -ft -bf tests/bootstrap.php -d tests/suite-integration -mcn 1 --nccfc CommonTreeDropdown CommonDropdown CommonDBTM CommonGLPI + - vendor/bin/atoum -ft -bf tests/bootstrap.php -d tests/suite-unit $COVERAGE + - vendor/bin/atoum -ft -bf tests/bootstrap.php -d tests/suite-integration -mcn 1 $COVERAGE - vendor/bin/atoum -ft -bf tests/bootstrap.php -d tests/suite-uninstall -ncc - - if [[ ${TRAVIS_PHP_VERSION:0:3} == "$CS" ]] && [ "$GLPI_BRANCH" = "9.3/bugfixes" ]; then vendor/bin/phpcs -p --standard=vendor/glpi-project/coding-standard/GlpiStandard/ *.php install/ inc/ front/ ajax/ tests/; fi + - if [ ${TRAVIS_PHP_VERSION:0:3} == "$CS" ] && [ "$GLPI_BRANCH" = "$AFTER_SUCCESS_BRANCH" ]; then vendor/bin/phpcs -p --standard=vendor/glpi-project/coding-standard/GlpiStandard/ *.php install/ inc/ front/ ajax/ tests/; fi after_success: - # let's update the documentation - - if [ ${TRAVIS_PHP_VERSION:0:3} == "$CS" ] && [ "$GLPI_BRANCH" = "9.2/bugfixes" ]; then tests/update_locales.sh; fi - - if [ ${TRAVIS_PHP_VERSION:0:3} == "$CS" ] && [ "$GLPI_BRANCH" = "9.2/bugfixes" ]; then .github/push_ghpages.sh; fi + # let's update the documentation and locales + - if [ ${TRAVIS_PHP_VERSION:0:3} == "$CS" ] && [ "$GLPI_BRANCH" = "$AFTER_SUCCESS_BRANCH" ]; then tests/after_success.sh; fi cache: directories: diff --git a/inc/agent.class.php b/inc/agent.class.php index 83241872..946fd367 100644 --- a/inc/agent.class.php +++ b/inc/agent.class.php @@ -823,7 +823,7 @@ public function getSearchOptionsNew() { 'table' => $this->getTable(), 'field' => 'mdm_type', 'name' => __('MDM type', 'flyvemdm'), - 'datatype' => 'bool', + 'datatype' => 'specific', 'massiveaction' => false ]; @@ -1986,6 +1986,12 @@ public static function getSpecificValueToDisplay($field, $values, array $options return $output; } break; + case 'mdm_type': + if (!isAPI()) { + $enumtypes = self::getEnumMdmType(); + return $enumtypes[$values[$field]]; + } + break; } return parent::getSpecificValueToDisplay($field, $values, $options); } diff --git a/install/upgrade/update_to_dev.php b/install/upgrade/update_to_dev.php index 1cb08f25..ad05392d 100644 --- a/install/upgrade/update_to_dev.php +++ b/install/upgrade/update_to_dev.php @@ -178,7 +178,7 @@ function plugin_flyvemdm_update_to_dev(Migration $migration) { $migration->changeField($table, 'plugin_flyvemdm_fleets_id', 'items_id_applied', 'integer'); $migration->dropKey($table, 'plugin_flyvemdm_fleets_id'); $migration->addField($table, 'itemtype_applied', 'string', ['after' => 'id']); - $migration->addKey($table, 'FK_applied', ['itemtype_applied', 'items_id_applied']); + $migration->addKey($table, ['itemtype_applied', 'items_id_applied'], 'FK_applied'); // All tasks already created were applied on fleets $migration->addPostQuery("UPDATE `$table` SET `itemtype_applied` = 'PluginFlyvemdmFleet'"); $migration->executeMigration(); diff --git a/.github/push_ghpages.sh b/tests/after_success.sh similarity index 70% rename from .github/push_ghpages.sh rename to tests/after_success.sh index 29dd4545..e2116230 100755 --- a/.github/push_ghpages.sh +++ b/tests/after_success.sh @@ -1,6 +1,27 @@ #!/bin/sh -# please set the $GH_TOKEN in your travis dashboard +# +# After success script for Travis CI +# + +# please keep tasks strongly separated, +# no matter they have the same if block +# please set $TX_USER and $TX_TOKEN in your travis dashboard +if [ "$TRAVIS_BRANCH" = "develop" ] && [ "$TRAVIS_PULL_REQUEST" = false ]; then + echo "updating source language" + sudo apt install transifex-client + echo "[https://www.transifex.com]" > ~/.transifexrc + echo "api_hostname = https://api.transifex.com" >> ~/.transifexrc + echo "hostname = https://www.transifex.com" >> ~/.transifexrc + echo "token = ${TX_TOKEN}" >> ~/.transifexrc + echo "password = ${TX_TOKEN}" >> ~/.transifexrc + echo "username = ${TX_USER}" >> ~/.transifexrc + php vendor/bin/robo locales:send +else + echo "skipping source language update" +fi + +# please set the $GH_TOKEN in your travis dashboard if [ "$TRAVIS_BRANCH" = "develop" ] && [ "$TRAVIS_PULL_REQUEST" = false ]; then #wget http://get.sensiolabs.org/sami.phar -O "$HOME/bin/sami.phar" # setup_git only for the main repo and not forks diff --git a/tests/suite-unit/PluginFlyvemdmEntityConfig.php b/tests/suite-unit/PluginFlyvemdmEntityConfig.php index e9fef09f..1014a647 100644 --- a/tests/suite-unit/PluginFlyvemdmEntityConfig.php +++ b/tests/suite-unit/PluginFlyvemdmEntityConfig.php @@ -116,7 +116,7 @@ public function providerPrepareInputForUpdate() { [], [ 'You are not allowed to change the device limit', - 'You are not allowed to download URL of the MDM agent', + 'You are not allowed to change the download URL of the MDM agent', 'You are not allowed to change the invitation token life', ] ] diff --git a/tests/update_locales.sh b/tests/update_locales.sh deleted file mode 100755 index fda09497..00000000 --- a/tests/update_locales.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -# please set $TX_USER and $TX_TOKEN in your travis dashboard - -if [ "$TRAVIS_BRANCH" = "develop" ] && [ "$TRAVIS_PULL_REQUEST" = false ]; then - # check if gh-pages exist in remote - echo "updating source language" - sudo apt install transifex-client - echo "[https://www.transifex.com]" > ~/.transifexrc - echo "api_hostname = https://api.transifex.com" >> ~/.transifexrc - echo "hostname = https://www.transifex.com" >> ~/.transifexrc - echo "token = ${TX_TOKEN}" >> ~/.transifexrc - echo "password = ${TX_TOKEN}" >> ~/.transifexrc - echo "username = ${TX_USER}" >> ~/.transifexrc - php vendor/bin/robo locales:send -else - echo "skipping source language update" -fi diff --git a/tools/cli_install.php b/tools/cli_install.php index 0a346433..79736089 100644 --- a/tools/cli_install.php +++ b/tools/cli_install.php @@ -39,15 +39,19 @@ cli_install.php Usage: - cli_install.php [--as-user USER] [--api-user-token APITOKEN] [--enable-api ] [--enable-email ] [ --tests ] [--dev] + cli_install.php [--as-user USER] [--api-user-token APITOKEN] [--enable-api ] [--enable-email ] [ --tests ] [--dev] [--mqtt-address MQTTADDRESS] [--mqtt-internal-address MQTTINTERNALADDRESS] [--mqtt-port MQTTPORT] [--mqtt-port-tls MQTTPORTTLS] Options: - --as-user USER Do install/upgrade as specified USER. If not provided, 'glpi' user will be used - --api-user-token APITOKEN APITOKEN - --enable-api Enable GLPI's API - --enable-email Enable GLPI's email notification - --tests Use GLPI test database - --dev Change the Agent download URL for the Beta testing url + --as-user USER Do install/upgrade as specified USER. If not provided, 'glpi' user will be used + --api-user-token APITOKEN APITOKEN + --enable-api Enable GLPI's API + --enable-email Enable GLPI's email notification + --tests Use GLPI test database + --dev Change the Agent download URL for the Beta testing url + --mqtt-address MQTTADDRESS Sets the address for Mosquitto MQTTADDRESS. This parameter can be [ IP Address/Hostname ] + --mqtt-internal-address MQTTINTERNALADDRESS Sets the Internal address for Mosquitto MQTTINTERNALADDRESS. This parameter can be [ IP Address/Hostname ] + --mqtt-port MQTTPORT Sets the Listen Port for Mosquitto MQTTPORT + --mqtt-port-tls MQTTPORTTLS Sets the Listen Port TLS for Mosquitto MQTTPORTTLS DOC; @@ -91,6 +95,29 @@ $CFG_GLPI = $config + $CFG_GLPI; } +// Setup plugin configuration +$pluginConfig = []; +if (isset($args['--mqtt-address']) && $args['--mqtt-address'] !== false) { + $pluginConfig = [ + 'mqtt_broker_address' => $args['--mqtt-address'] + ]; +} +if (isset($args['--mqtt-internal-address']) && $args['--mqtt-internal-address'] !== false) { + $pluginConfig = [ + 'mqtt_broker_internal_address' => $args['--mqtt-internal-address'] + ]; +} +if (isset($args['--mqtt-port']) && $args['--mqtt-port'] !== false) { + $pluginConfig = [ + 'mqtt_broker_port' => $args['--mqtt-port'] + ]; +} +if (isset($args['--mqtt-port-tls']) && $args['--mqtt-port-tls'] !== false) { + $pluginConfig = [ + 'mqtt_broker_tls_port' => $args['--mqtt-port-tls'] + ]; +} + // Init debug variable $_SESSION['glpi_use_mode'] = Session::DEBUG_MODE; $_SESSION['glpilanguage'] = "en_GB"; @@ -168,6 +195,7 @@ 'download_url' => PLUGIN_FLYVEMDM_AGENT_BETA_DOWNLOAD_URL ]); } +Config::setConfigurationValues('flyvemdm', $pluginConfig); // Enable the plugin print("Activating Plugin...\n"); @@ -182,4 +210,3 @@ print("Loading Plugin...\n"); $plugin->load("flyvemdm"); print("Load Done...\n"); -