Skip to content
This repository has been archived by the owner on Aug 9, 2021. It is now read-only.

Commit

Permalink
Merge branch 'develop' into feature/404_apn_policy
Browse files Browse the repository at this point in the history
  • Loading branch information
btry authored Jul 11, 2018
2 parents 34162fe + 26c0dcc commit 2b175c4
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 36 deletions.
15 changes: 8 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
8 changes: 7 additions & 1 deletion inc/agent.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@ public function getSearchOptionsNew() {
'table' => $this->getTable(),
'field' => 'mdm_type',
'name' => __('MDM type', 'flyvemdm'),
'datatype' => 'bool',
'datatype' => 'specific',
'massiveaction' => false
];

Expand Down Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion install/upgrade/update_to_dev.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
23 changes: 22 additions & 1 deletion .github/push_ghpages.sh → tests/after_success.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/suite-unit/PluginFlyvemdmEntityConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
]
]
Expand Down
17 changes: 0 additions & 17 deletions tests/update_locales.sh

This file was deleted.

43 changes: 35 additions & 8 deletions tools/cli_install.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -168,6 +195,7 @@
'download_url' => PLUGIN_FLYVEMDM_AGENT_BETA_DOWNLOAD_URL
]);
}
Config::setConfigurationValues('flyvemdm', $pluginConfig);

// Enable the plugin
print("Activating Plugin...\n");
Expand All @@ -182,4 +210,3 @@
print("Loading Plugin...\n");
$plugin->load("flyvemdm");
print("Load Done...\n");

0 comments on commit 2b175c4

Please sign in to comment.