From c74d9bbafbafd6570b9f77b830513469bed825a2 Mon Sep 17 00:00:00 2001
From: Molkobain
Date: Mon, 3 Sep 2018 15:51:43 +0200
Subject: [PATCH 01/19] Add .gitignore
---
.gitignore | 121 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 121 insertions(+)
create mode 100644 .gitignore
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000..43cf000c4
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,121 @@
+
+conf/*
+env-*/*
+
+# composer reserver directory, from sources, populate/update using "composer install"
+vendor/*
+
+# all datas but listing prevention
+data/*
+!data/.htaccess
+!data/index.php
+!data/web.config
+
+# iTop extensions
+extensions/*
+!extensions/readme.txt
+
+# all logs but listing prevention
+log/*
+!log/.htaccess
+!log/index.php
+!log/web.config
+
+
+# Jetbrains
+.idea/**
+!.idea/encodings.xml
+!.idea/codeStyles
+!.idea/codeStyles/*
+!.idea/inspectionProfiles
+!.idea/inspectionProfiles/*
+
+
+
+# CMake
+cmake-build-*/
+
+# Mongo Explorer plugin
+.idea/**/mongoSettings.xml
+
+# File-based project format
+*.iws
+
+# IntelliJ
+out/
+
+# mpeltonen/sbt-idea plugin
+.idea_modules/
+
+# JIRA plugin
+atlassian-ide-plugin.xml
+
+# Cursive Clojure plugin
+.idea/replstate.xml
+
+# Crashlytics plugin (for Android Studio and IntelliJ)
+com_crashlytics_export_strings.xml
+crashlytics.properties
+crashlytics-build.properties
+fabric.properties
+
+# Editor-based Rest Client
+.idea/httpRequests
+### Eclipse template
+
+.metadata
+tmp/
+*.tmp
+*.bak
+*.swp
+*~.nib
+local.properties
+.settings/
+.loadpath
+.recommenders
+.project
+
+# External tool builders
+.externalToolBuilders/
+
+# Locally stored "Eclipse launch configurations"
+*.launch
+
+# PyDev specific (Python IDE for Eclipse)
+*.pydevproject
+
+# CDT-specific (C/C++ Development Tooling)
+.cproject
+
+# CDT- autotools
+.autotools
+
+# Java annotation processor (APT)
+.factorypath
+
+# PDT-specific (PHP Development Tools)
+.buildpath
+
+# sbteclipse plugin
+.target
+
+# Tern plugin
+.tern-project
+
+# TeXlipse plugin
+.texlipse
+
+# STS (Spring Tool Suite)
+.springBeans
+
+# Code Recommenders
+.recommenders/
+
+# Annotation Processing
+.apt_generated/
+
+# Scala IDE specific (Scala & Java development for Eclipse)
+.cache-main
+.scala_dependencies
+.worksheet
+
From 9ad8c6a96df92037c6070d0acae30de186f1c507 Mon Sep 17 00:00:00 2001
From: Molkobain
Date: Mon, 3 Sep 2018 15:53:00 +0200
Subject: [PATCH 02/19] Add .idea project files
---
.idea/codeStyles/Project.xml | 37 +++++
.idea/codeStyles/codeStyleConfig.xml | 5 +
.idea/encodings.xml | 6 +
.idea/inspectionProfiles/Project_Default.xml | 154 +++++++++++++++++++
4 files changed, 202 insertions(+)
create mode 100644 .idea/codeStyles/Project.xml
create mode 100644 .idea/codeStyles/codeStyleConfig.xml
create mode 100644 .idea/encodings.xml
create mode 100644 .idea/inspectionProfiles/Project_Default.xml
diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
new file mode 100644
index 000000000..cbc60d1a0
--- /dev/null
+++ b/.idea/codeStyles/Project.xml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml
new file mode 100644
index 000000000..79ee123c2
--- /dev/null
+++ b/.idea/codeStyles/codeStyleConfig.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 000000000..97626ba45
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 000000000..ffbbf4b97
--- /dev/null
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,154 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
From a7000b2582a2f0851cf15aaddb2c5a4e7813d33b Mon Sep 17 00:00:00 2001
From: bruno DA SILVA
Date: Fri, 7 Sep 2018 14:52:22 +0200
Subject: [PATCH 03/19] [WIP] jenkinsfile integration cherry picked from
commits : 79157c465af1e12aba1e1d926b0c0b865859a78c
e473c46dc3a341d7035c3e85be09ce7d3de2ac80
148309245b7e2b0831f0678eeebb6eeee20cdc03
5dc39fe0686a1761501c318e6d25e99e13845372
47c7a3c5e3e275a29137ef81111ff602e7e4c220
85b7e86e58ca39e03fa7bc79296a0e06c615078f
3fca465f1d4785139d519f7f2b4de8ec96feb299
7955dd86f408cf73cd3919013d032c2282f1c1b3
bef4ac83a4038b8a289cfba4d90b0232f6da2a03
bde83fc70530454366482008b03e72453d7fecbd
---
.jenkins/bin/archive/gather_external_files.sh | 0
.jenkins/bin/init/append_files.sh | 14 +
.jenkins/bin/init/composer_install.sh | 11 +
.jenkins/bin/init/debug.sh | 13 +
.jenkins/bin/tests/phpunit.sh | 8 +
.../bin/unattended_install/default_env.sh | 6 +
.../default-config-itop.php | 285 ++++++++++++++++++
.../unattended_install/default-params.xml | 69 +++++
.../unattended_install/unattended_install.php | 190 ++++++++++++
Jenkinsfile | 62 ++++
10 files changed, 658 insertions(+)
create mode 100755 .jenkins/bin/archive/gather_external_files.sh
create mode 100755 .jenkins/bin/init/append_files.sh
create mode 100755 .jenkins/bin/init/composer_install.sh
create mode 100755 .jenkins/bin/init/debug.sh
create mode 100755 .jenkins/bin/tests/phpunit.sh
create mode 100755 .jenkins/bin/unattended_install/default_env.sh
create mode 100644 .jenkins/configuration/default-environment/unattended_install/default-config-itop.php
create mode 100644 .jenkins/configuration/default-environment/unattended_install/default-params.xml
create mode 100644 .jenkins/configuration/default-environment/unattended_install/unattended_install.php
create mode 100644 Jenkinsfile
diff --git a/.jenkins/bin/archive/gather_external_files.sh b/.jenkins/bin/archive/gather_external_files.sh
new file mode 100755
index 000000000..e69de29bb
diff --git a/.jenkins/bin/init/append_files.sh b/.jenkins/bin/init/append_files.sh
new file mode 100755
index 000000000..2e383001e
--- /dev/null
+++ b/.jenkins/bin/init/append_files.sh
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+
+set -x
+
+# create target dirs
+mkdir -p var
+mkdir -p toolkit
+
+# cleanup target dirs
+rm -rf toolkit/*
+
+# fill target dirs
+curl http://www.combodo.com/documentation/iTopDataModelToolkit-2.3.zip | tar xvz --directory toolkit
+cp -r .jenkins/configuration/default-environment/unattended_install/* toolkit
diff --git a/.jenkins/bin/init/composer_install.sh b/.jenkins/bin/init/composer_install.sh
new file mode 100755
index 000000000..cfea9704f
--- /dev/null
+++ b/.jenkins/bin/init/composer_install.sh
@@ -0,0 +1,11 @@
+#!/usr/bin/env bash
+
+set -x
+
+# on the root dir
+composer install
+
+
+# under the test dir
+cd test
+composer install
diff --git a/.jenkins/bin/init/debug.sh b/.jenkins/bin/init/debug.sh
new file mode 100755
index 000000000..8f9ea404a
--- /dev/null
+++ b/.jenkins/bin/init/debug.sh
@@ -0,0 +1,13 @@
+#!/usr/bin/env bash
+
+set -x
+
+whoami
+pwd
+ls
+
+echo "$BRANCH_NAME:${BRANCH_NAME}"
+
+echo "printenv :"
+printenv
+
diff --git a/.jenkins/bin/tests/phpunit.sh b/.jenkins/bin/tests/phpunit.sh
new file mode 100755
index 000000000..3c327f6c9
--- /dev/null
+++ b/.jenkins/bin/tests/phpunit.sh
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+set -x
+
+cd test
+
+export DEBUG_UNIT_TEST="0"
+
+php vendor/bin/phpunit --log-junit ../var/test/phpunit-log.junit.xml --teamcity
\ No newline at end of file
diff --git a/.jenkins/bin/unattended_install/default_env.sh b/.jenkins/bin/unattended_install/default_env.sh
new file mode 100755
index 000000000..e4a9e8c98
--- /dev/null
+++ b/.jenkins/bin/unattended_install/default_env.sh
@@ -0,0 +1,6 @@
+#!/usr/bin/env bash
+
+set -x
+
+cd toolkit
+php unattended_install.php default-params.xml
\ No newline at end of file
diff --git a/.jenkins/configuration/default-environment/unattended_install/default-config-itop.php b/.jenkins/configuration/default-environment/unattended_install/default-config-itop.php
new file mode 100644
index 000000000..71a82612b
--- /dev/null
+++ b/.jenkins/configuration/default-environment/unattended_install/default-config-itop.php
@@ -0,0 +1,285 @@
+ 'iTop is temporarily frozen, please wait... (the admin team)',
+
+ // access_mode: Access mode: ACCESS_READONLY = 0, ACCESS_ADMIN_WRITE = 2, ACCESS_FULL = 3
+ // default: 3
+ 'access_mode' => 3,
+
+ 'allowed_login_types' => 'form|basic|external',
+
+ // apc_cache.enabled: If set, the APC cache is allowed (the PHP extension must also be active)
+ // default: true
+ 'apc_cache.enabled' => true,
+
+ // apc_cache.query_ttl: Time to live set in APC for the prepared queries (seconds - 0 means no timeout)
+ // default: 3600
+ 'apc_cache.query_ttl' => 3600,
+
+ // app_root_url: Root URL used for navigating within the application, or from an email to the application (you can put $SERVER_NAME$ as a placeholder for the server's name)
+ // default: ''
+ 'app_root_url' => 'http://127.0.0.1/itop/svn/trunk/',
+
+ // buttons_position: Position of the forms buttons: bottom | top | both
+ // default: 'both'
+ 'buttons_position' => 'both',
+
+ // cas_include_path: The path where to find the phpCAS library
+ // default: '/usr/share/php'
+ 'cas_include_path' => '/usr/share/php',
+
+ // cron_max_execution_time: Duration (seconds) of the page cron.php, must be shorter than php setting max_execution_time and shorter than the web server response timeout
+ // default: 600
+ 'cron_max_execution_time' => 600,
+
+ // csv_file_default_charset: Character set used by default for downloading and uploading data as a CSV file. Warning: it is case sensitive (uppercase is preferable).
+ // default: 'ISO-8859-1'
+ 'csv_file_default_charset' => 'ISO-8859-1',
+
+ 'csv_import_charsets' => array (
+ ),
+
+ // csv_import_history_display: Display the history tab in the import wizard
+ // default: false
+ 'csv_import_history_display' => false,
+
+ // date_and_time_format: Format for date and time display (per language)
+ // default: array (
+ // 'default' =>
+ // array (
+ // 'date' => 'Y-m-d',
+ // 'time' => 'H:i:s',
+ // 'date_time' => '$date $time',
+ // ),
+ // )
+ 'date_and_time_format' => array (
+ 'default' =>
+ array (
+ 'date' => 'Y-m-d',
+ 'time' => 'H:i:s',
+ 'date_time' => '$date $time',
+ ),
+ 'FR FR' =>
+ array (
+ 'date' => 'd/m/Y',
+ 'time' => 'H:i:s',
+ 'date_time' => '$date $time',
+ ),
+ ),
+
+ 'db_host' => '',
+
+ 'db_name' => 'itop_ci_main',
+
+ 'db_pwd' => 'c8mb0do',
+
+ 'db_subname' => '',
+
+ 'db_user' => 'root',
+
+ // deadline_format: The format used for displaying "deadline" attributes: any string with the following placeholders: $date$, $difference$
+ // default: '$difference$'
+ 'deadline_format' => '$difference$',
+
+ 'default_language' => 'EN US',
+
+ // disable_attachments_download_legacy_portal: Disable attachments download from legacy portal
+ // default: true
+ 'disable_attachments_download_legacy_portal' => true,
+
+ // draft_attachments_lifetime: Lifetime (in seconds) of drafts' attachments and inline images: after this duration, the garbage collector will delete them.
+ // default: 3600
+ 'draft_attachments_lifetime' => 3600,
+
+ // email_asynchronous: If set, the emails are sent off line, which requires cron.php to be activated. Exception: some features like the email test utility will force the serialized mode
+ // default: false
+ 'email_asynchronous' => false,
+
+ // email_default_sender_address: Default address provided in the email from header field.
+ // default: ''
+ 'email_default_sender_address' => '',
+
+ // email_default_sender_label: Default label provided in the email from header field.
+ // default: ''
+ 'email_default_sender_label' => '',
+
+ // email_transport: Mean to send emails: PHPMail (uses the function mail()) or SMTP (implements the client protocole)
+ // default: 'PHPMail'
+ 'email_transport' => 'SMTP',
+
+ // email_transport_smtp.host: host name or IP address (optional)
+ // default: 'localhost'
+ 'email_transport_smtp.host' => 'smtp.combodo.com',
+
+ // email_transport_smtp.password: Authentication password (optional)
+ // default: ''
+ 'email_transport_smtp.password' => '++combodo++',
+
+ // email_transport_smtp.port: port number (optional)
+ // default: 25
+ 'email_transport_smtp.port' => 25,
+
+ // email_transport_smtp.username: Authentication user (optional)
+ // default: ''
+ 'email_transport_smtp.username' => 'test2@combodo.com',
+
+ // email_validation_pattern: Regular expression to validate/detect the format of an eMail address
+ // default: '[a-zA-Z0-9._&\'-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z0-9-]{2,}'
+ 'email_validation_pattern' => '[a-zA-Z0-9._&\'-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z0-9-]{2,}',
+
+ 'encryption_key' => '@iT0pEncr1pti0n!',
+
+ 'ext_auth_variable' => '$_SERVER[\'REMOTE_USER\']',
+
+ 'fast_reload_interval' => '60',
+
+ // graphviz_path: Path to the Graphviz "dot" executable for graphing objects lifecycle
+ // default: '/usr/bin/dot'
+ 'graphviz_path' => '/usr/bin/dot',
+
+ // inline_image_max_display_width: The maximum width (in pixels) when displaying images inside an HTML formatted attribute. Images will be displayed using this this maximum width.
+ // default: '250'
+ 'inline_image_max_display_width' => 250,
+
+ // inline_image_max_storage_width: The maximum width (in pixels) when uploading images to be used inside an HTML formatted attribute. Images larger than the given size will be downsampled before storing them in the database.
+ // default: '1600'
+ 'inline_image_max_storage_width' => 1600,
+
+ // link_set_attribute_qualifier: Link set from string: attribute qualifier (encloses both the attcode and the value)
+ // default: '\''
+ 'link_set_attribute_qualifier' => '\'',
+
+ // link_set_attribute_separator: Link set from string: attribute separator
+ // default: ';'
+ 'link_set_attribute_separator' => ';',
+
+ // link_set_item_separator: Link set from string: line separator
+ // default: '|'
+ 'link_set_item_separator' => '|',
+
+ // link_set_value_separator: Link set from string: value separator (between the attcode and the value itself
+ // default: ':'
+ 'link_set_value_separator' => ':',
+
+ 'log_global' => true,
+
+ 'log_issue' => true,
+
+ 'log_notification' => true,
+
+ 'log_web_service' => true,
+
+ // max_combo_length: The maximum number of elements in a drop-down list. If more then an autocomplete will be used
+ // default: 50
+ 'max_combo_length' => 50,
+
+ 'max_display_limit' => '15',
+
+ // max_linkset_output: Maximum number of items shown when getting a list of related items in an email, using the form $this->some_list$. 0 means no limit.
+ // default: 100
+ 'max_linkset_output' => 100,
+
+ 'min_display_limit' => '10',
+
+ // online_help: Hyperlink to the online-help web page
+ // default: 'http://www.combodo.com/itop-help'
+ 'online_help' => 'http://www.combodo.com/itop-help',
+
+ // php_path: Path to the php executable in CLI mode
+ // default: 'php'
+ 'php_path' => 'php',
+
+ // portal_tickets: CSV list of classes supported in the portal
+ // default: 'UserRequest'
+ 'portal_tickets' => 'UserRequest',
+
+ 'query_cache_enabled' => true,
+
+ // search_manual_submit: Force manual submit of search requests (class => true)
+ // default: false
+ 'search_manual_submit' => array (
+ 'Person' => true,
+ ),
+
+ 'secure_connection_required' => false,
+
+ // session_name: The name of the cookie used to store the PHP session id
+ // default: 'iTop'
+ 'session_name' => 'iTop',
+
+ // shortcut_actions: Actions that are available as direct buttons next to the "Actions" menu
+ // default: 'UI:Menu:Modify,UI:Menu:New'
+ 'shortcut_actions' => 'UI:Menu:Modify,UI:Menu:New',
+
+ // source_dir: Source directory for the datamodel files. (which gets compiled to env-production).
+ // default: ''
+ 'source_dir' => 'datamodels/2.x/',
+
+ 'standard_reload_interval' => '300',
+
+ // synchro_trace: Synchronization details: none, display, save (includes 'display')
+ // default: 'none'
+ 'synchro_trace' => 'none',
+
+ // timezone: Timezone (reference: http://php.net/manual/en/timezones.php). If empty, it will be left unchanged and MUST be explicitely configured in PHP
+ // default: 'Europe/Paris'
+ 'timezone' => 'Europe/Paris',
+
+ // tracking_level_linked_set_default: Default tracking level if not explicitely set at the attribute level, for AttributeLinkedSet (defaults to NONE in case of a fresh install, LIST otherwise - this to preserve backward compatibility while upgrading from a version older than 2.0.3 - see TRAC #936)
+ // default: 1
+ 'tracking_level_linked_set_default' => 0,
+
+ // url_validation_pattern: Regular expression to validate/detect the format of an URL (URL attributes and Wiki formatting for Text attributes)
+ // default: '(https?|ftp)\\://([a-zA-Z0-9+!*(),;?&=\\$_.-]+(\\:[a-zA-Z0-9+!*(),;?&=\\$_.-]+)?@)?([a-zA-Z0-9-.]{3,})(\\:[0-9]{2,5})?(/([a-zA-Z0-9%+\\$_-]\\.?)+)*/?(\\?[a-zA-Z+&\\$_.-][a-zA-Z0-9;:[\\]@&%=+/\\$_.-]*)?(#[a-zA-Z_.-][a-zA-Z0-9+\\$_.-]*)?'
+ 'url_validation_pattern' => '(https?|ftp)\\://([a-zA-Z0-9+!*(),;?&=\\$_.-]+(\\:[a-zA-Z0-9+!*(),;?&=\\$_.-]+)?@)?([a-zA-Z0-9-.]{3,})(\\:[0-9]{2,5})?(/([a-zA-Z0-9%+\\$_-]\\.?)+)*/?(\\?[a-zA-Z+&\\$_.-][a-zA-Z0-9;:[\\]@&%=+/\\$_.-]*)?(#[a-zA-Z_.-][a-zA-Z0-9+\\$_.-]*)?',
+);
+
+/**
+ *
+ * Modules specific settings
+ *
+ */
+$MyModuleSettings = array(
+ 'itop-attachments' => array (
+ 'allowed_classes' => array (
+ 0 => 'Ticket',
+ ),
+ 'position' => 'relations',
+ 'preview_max_width' => 290,
+ ),
+ 'itop-backup' => array (
+ 'mysql_bindir' => '',
+ 'week_days' => 'monday, tuesday, wednesday, thursday, friday',
+ 'time' => '23:30',
+ 'retention_count' => 5,
+ 'enabled' => true,
+ 'debug' => false,
+ ),
+ 'molkobain-console-tooltips' => array (
+ 'decoration_class' => 'fas fa-question',
+ 'enabled' => true,
+ ),
+);
+
+/**
+ *
+ * Data model modules to be loaded. Names are specified as relative paths
+ *
+ */
+$MyModules = array(
+ 'addons' => array (
+ 'user rights' => 'addons/userrights/userrightsprofile.class.inc.php',
+ ),
+);
+?>
\ No newline at end of file
diff --git a/.jenkins/configuration/default-environment/unattended_install/default-params.xml b/.jenkins/configuration/default-environment/unattended_install/default-params.xml
new file mode 100644
index 000000000..fc188ba02
--- /dev/null
+++ b/.jenkins/configuration/default-environment/unattended_install/default-params.xml
@@ -0,0 +1,69 @@
+
+
+ upgrade
+
+
+
+ datamodels/2.x/
+ 2.5.0
+ /var/lib/jenkins/workspace/iTop-CI/unattended_install/default-config-itop.php
+ extensions
+ production
+
+
+
+ root
+ c8mb0do
+ itop_ci
+
+
+
+
+ http://127.0.0.1/itop/svn/trunk/
+ /usr/bin/dot
+
+ admin
+ admin
+ EN US
+
+ EN US
+
+ - authent-external
+ - authent-local
+ - itop-backup
+ - itop-config
+ - itop-profiles-itil
+ - itop-sla-computation
+ - itop-tickets
+ - itop-welcome-itil
+ - itop-config-mgmt
+ - itop-attachments
+ - itop-datacenter-mgmt
+ - itop-endusers-devices
+ - itop-storage-mgmt
+ - itop-virtualization-mgmt
+ - itop-bridge-virtualization-storage
+ - itop-service-mgmt
+ - itop-request-mgmt
+ - itop-portal
+ - itop-portal-base
+ - itop-change-mgmt
+
+
+ - itop-config-mgmt-core
+ - itop-config-mgmt-datacenter
+ - itop-config-mgmt-end-user
+ - itop-config-mgmt-storage
+ - itop-config-mgmt-virtualization
+ - itop-service-mgmt-enterprise
+ - itop-ticket-mgmt-simple-ticket
+ - itop-ticket-mgmt-simple-ticket-enhanced-portal
+ - itop-change-mgmt-simple
+
+ 1
+
+
+ 1
+
+
+
\ No newline at end of file
diff --git a/.jenkins/configuration/default-environment/unattended_install/unattended_install.php b/.jenkins/configuration/default-environment/unattended_install/unattended_install.php
new file mode 100644
index 000000000..7f67bee85
--- /dev/null
+++ b/.jenkins/configuration/default-environment/unattended_install/unattended_install.php
@@ -0,0 +1,190 @@
+Get('mode');
+
+if ($sMode == 'install')
+{
+ echo "Installation mode detected.\n";
+ $bClean = utils::ReadParam('clean', false, true /* CLI allowed */);
+ if ($bClean)
+ {
+ echo "Cleanup mode detected.\n";
+ $sTargetEnvironment = $oParams->Get('target_env', '');
+ if ($sTargetEnvironment == '')
+ {
+ $sTargetEnvironment = 'production';
+ }
+ $sTargetDir = APPROOT.'env-'.$sTargetEnvironment;
+
+ // Configuration file
+ $sConfigFile = APPCONF.$sTargetEnvironment.'/'.ITOP_CONFIG_FILE;
+ if (file_exists($sConfigFile))
+ {
+ echo "Trying to delete the configuration file: '$sConfigFile'.\n";
+ @chmod($sConfigFile, 0770); // RWX for owner and group, nothing for others
+ unlink($sConfigFile);
+ }
+ else
+ {
+ echo "No config file to delete ($sConfigFile does not exist).\n";
+ }
+
+ // env-xxx directory
+ if (file_exists($sTargetDir))
+ {
+ if (is_dir($sTargetDir))
+ {
+ echo "Emptying the target directory '$sTargetDir'.\n";
+ SetupUtils::tidydir($sTargetDir);
+ }
+ else
+ {
+ die("ERROR the target dir '$sTargetDir' exists, but is NOT a directory !!!\nExiting.\n");
+ }
+ }
+ else
+ {
+ echo "No target directory to delete ($sTargetDir does not exist).\n";
+ }
+
+ // Database
+ $aDBSettings = $oParams->Get('database', array());
+ $sDBServer = $aDBSettings['server'];
+ $sDBUser = $aDBSettings['user'];
+ $sDBPwd = $aDBSettings['pwd'];
+ $sDBName = $aDBSettings['name'];
+ $sDBPrefix = $aDBSettings['prefix'];
+
+ if ($sDBPrefix != '')
+ {
+ die("Cleanup not implemented for a partial database (prefix= '$sDBPrefix')\nExiting.");
+ }
+
+ $oMysqli = new mysqli($sDBServer, $sDBUser, $sDBPwd);
+ if ($oMysqli->connect_errno)
+ {
+ die("Cannot connect to the MySQL server (".$mysqli->connect_errno . ") ".$mysqli->connect_error."\nExiting");
+ }
+ else
+ {
+ if ($oMysqli->select_db($sDBName))
+ {
+ echo "Deleting database '$sDBName'\n";
+ $oMysqli->query("DROP DATABASE `$sDBName`");
+ }
+ else
+ {
+ echo "The database '$sDBName' does not seem to exist. Nothing to cleanup.\n";
+ }
+ }
+ }
+}
+
+$bHasErrors = false;
+$aChecks = SetupUtils::CheckBackupPrerequisites(APPROOT.'data'); // mmm should be the backup destination dir
+
+$aSelectedModules = $oParams->Get('selected_modules');
+$sSourceDir = $oParams->Get('source_dir', 'datamodels/latest');
+$sExtensionDir = $oParams->Get('extensions_dir', 'extensions');
+$aChecks = array_merge($aChecks, SetupUtils::CheckSelectedModules($sSourceDir, $sExtensionDir, $aSelectedModules));
+
+
+foreach($aChecks as $oCheckResult)
+{
+ switch($oCheckResult->iSeverity)
+ {
+ case CheckResult::ERROR:
+ $bHasErrors = true;
+ $sHeader = "Error";
+ break;
+
+ case CheckResult::WARNING:
+ $sHeader = "Warning";
+ break;
+
+ case CheckResult::INFO:
+ default:
+ $sHeader = "Info";
+ break;
+ }
+ echo $sHeader.": ".$oCheckResult->sLabel;
+ if (strlen($oCheckResult->sDescription))
+ {
+ echo ' - '.$oCheckResult->sDescription;
+ }
+ echo "\n";
+}
+
+if ($bHasErrors)
+{
+ echo "Encountered stopper issues. Aborting...\n";
+ die;
+}
+
+$bFoundIssues = false;
+
+$bInstall = utils::ReadParam('install', true, true /* CLI allowed */);
+if ($bInstall)
+{
+ echo "Starting the unattended installation...\n";
+ $oWizard = new ApplicationInstaller($oParams);
+ $bRes = $oWizard->ExecuteAllSteps();
+ if (!$bRes)
+ {
+ echo "\nencountered installation issues!";
+ $bFoundIssues = true;
+ }
+}
+else
+{
+ echo "No installation requested.\n";
+}
+if (!$bFoundIssues && $bCheckConsistency)
+{
+ echo "Checking data model consistency.\n";
+ ob_start();
+ $sCheckRes = '';
+ try
+ {
+ MetaModel::CheckDefinitions(false);
+ $sCheckRes = ob_get_clean();
+ }
+ catch(Exception $e)
+ {
+ $sCheckRes = ob_get_clean()."\nException: ".$e->getMessage();
+ }
+ if (strlen($sCheckRes) > 0)
+ {
+ echo $sCheckRes;
+ echo "\nfound consistency issues!";
+ $bFoundIssues = true;
+ }
+}
+
+if (!$bFoundIssues)
+{
+ // last line: used to check the install
+ // the only way to track issues in case of Fatal error or even parsing error!
+ echo "\ninstalled!";
+ exit;
+}
diff --git a/Jenkinsfile b/Jenkinsfile
new file mode 100644
index 000000000..2f49a0667
--- /dev/null
+++ b/Jenkinsfile
@@ -0,0 +1,62 @@
+pipeline {
+ agent any
+ stages {
+
+ stage('init') {
+ parallel {
+ stage('debug') {
+ steps {
+ sh './.jenkins/bin/init/debug.sh'
+ }
+ }
+ stage('append files to project') {
+ steps {
+ sh './.jenkins/bin/init/append_files.sh'
+ }
+ }
+ stage('composer install') {
+ steps {
+ sh './.jenkins/bin/init/composer_install.sh'
+ }
+ }
+ }
+ }
+
+ stage('unattended_install') {
+ parallel {
+ stage('unattended_install default env') {
+ steps {
+ sh './.jenkins/bin/unattended_install/default_env.sh'
+ }
+ }
+ }
+ }
+
+ stage('test') {
+ parallel {
+ stage('phpunit') {
+ steps {
+ sh './.jenkins/bin/tests/phpunit.sh'
+ }
+ }
+ }
+ }
+
+ }
+
+ post {
+ always {
+ junit 'var/test/phpunit-log.junit.xml'
+ }
+ failure {
+ slackSend(channel: "#jenkins-itop", color: '#FF0000', message: "Ho no! Build failed! (${currentBuild.result}), Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})")
+ }
+ }
+
+ environment {
+ DEBUG_UNIT_TEST = '0'
+ }
+ options {
+ timeout(time: 20, unit: 'MINUTES')
+ }
+}
\ No newline at end of file
From 866dfe453121a3ea9fbe459638253d09ef9419ad Mon Sep 17 00:00:00 2001
From: Guillaume Lajarige
Date: Tue, 21 Aug 2018 12:29:46 +0200
Subject: [PATCH 04/19] =?UTF-8?q?(Retrofit=20from=20develop=2007056613)=20?=
=?UTF-8?q?N=C2=B01611=20Fix=20"UTF-8=20Characters=20Malformed"=20error=20?=
=?UTF-8?q?due=20to=20wrong=20file=20encoding.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../es_cr.dict.authent-external.php | 94 +++++++++---------
.../authent-ldap/es_cr.dict.authent-ldap.php | 95 +++++++++----------
.../es_cr.dict.authent-local.php | 94 +++++++++---------
.../es_cr.dict.itop-attachments.php | 88 ++++++++---------
4 files changed, 183 insertions(+), 188 deletions(-)
diff --git a/datamodels/2.x/authent-external/es_cr.dict.authent-external.php b/datamodels/2.x/authent-external/es_cr.dict.authent-external.php
index 935e8e7c2..757617528 100644
--- a/datamodels/2.x/authent-external/es_cr.dict.authent-external.php
+++ b/datamodels/2.x/authent-external/es_cr.dict.authent-external.php
@@ -1,49 +1,45 @@
-
-
-
-/**
- * Localized data
- *
- * @copyright Copyright (C) 2010-2013 Combodo SARL
- * @license http://opensource.org/licenses/AGPL-3.0
- * @traductor Miguel Turrubiates
- */
-
-// Dictionnay conventions
-// Class:
-// Class:+
-// Class:/Attribute:
-// Class:/Attribute:+
-// Class:/Attribute:/Value:
-// Class:/Attribute:/Value:+
-// Class:/Stimulus:
-// Class:/Stimulus:+
-
-//
-// Class: UserExternal
-//
-
-Dict::Add('ES CR', 'Spanish', 'Español, Castellaño', array(
- 'Class:UserExternal' => 'Usuario Externo',
- 'Class:UserExternal+' => 'Usuario Autenticado fuera de iTop',
-));
-
-
-
-?>
+
+
+
+/**
+ * Localized data
+ *
+ * @copyright Copyright (C) 2010-2013 Combodo SARL
+ * @license http://opensource.org/licenses/AGPL-3.0
+ * @traductor Miguel Turrubiates
+ */
+
+// Dictionnay conventions
+// Class:
+// Class:+
+// Class:/Attribute:
+// Class:/Attribute:+
+// Class:/Attribute:/Value:
+// Class:/Attribute:/Value:+
+// Class:/Stimulus:
+// Class:/Stimulus:+
+
+//
+// Class: UserExternal
+//
+
+Dict::Add('ES CR', 'Spanish', 'Español, Castellaño', array(
+ 'Class:UserExternal' => 'Usuario Externo',
+ 'Class:UserExternal+' => 'Usuario Autenticado fuera de iTop',
+));
diff --git a/datamodels/2.x/authent-ldap/es_cr.dict.authent-ldap.php b/datamodels/2.x/authent-ldap/es_cr.dict.authent-ldap.php
index a23ba8fc3..5d1395a43 100644
--- a/datamodels/2.x/authent-ldap/es_cr.dict.authent-ldap.php
+++ b/datamodels/2.x/authent-ldap/es_cr.dict.authent-ldap.php
@@ -1,48 +1,47 @@
-
-
-
-/**
- * Localized data
- *
- * @copyright Copyright (C) 2010-2013 Combodo SARL
- * @license http://opensource.org/licenses/AGPL-3.0
- * @traductor Miguel Turrubiates
- */
-
-// Dictionnay conventions
-// Class:
-// Class:+
-// Class:/Attribute:
-// Class:/Attribute:+
-// Class:/Attribute:/Value:
-// Class:/Attribute:/Value:+
-// Class:/Stimulus:
-// Class:/Stimulus:+
-
-//
-// Class: UserLDAP
-//
-
-Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array(
- 'Class:UserLDAP' => 'Usuario LDAP',
- 'Class:UserLDAP+' => 'Usuario Autenticado vía LDAP',
- 'Class:UserLDAP/Attribute:password' => 'Contraseña',
- 'Class:UserLDAP/Attribute:password+' => 'Contraseña',
-));
-
+
+
+
+/**
+ * Localized data
+ *
+ * @copyright Copyright (C) 2010-2013 Combodo SARL
+ * @license http://opensource.org/licenses/AGPL-3.0
+ * @traductor Miguel Turrubiates
+ */
+
+// Dictionnay conventions
+// Class:
+// Class:+
+// Class:/Attribute:
+// Class:/Attribute:+
+// Class:/Attribute:/Value:
+// Class:/Attribute:/Value:+
+// Class:/Stimulus:
+// Class:/Stimulus:+
+
+//
+// Class: UserLDAP
+//
+
+Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array(
+ 'Class:UserLDAP' => 'Usuario LDAP',
+ 'Class:UserLDAP+' => 'Usuario Autenticado vÃa LDAP',
+ 'Class:UserLDAP/Attribute:password' => 'Contraseña',
+ 'Class:UserLDAP/Attribute:password+' => 'Contraseña',
+));
diff --git a/datamodels/2.x/authent-local/es_cr.dict.authent-local.php b/datamodels/2.x/authent-local/es_cr.dict.authent-local.php
index c9a048ac0..81af35001 100644
--- a/datamodels/2.x/authent-local/es_cr.dict.authent-local.php
+++ b/datamodels/2.x/authent-local/es_cr.dict.authent-local.php
@@ -1,47 +1,47 @@
-
-
-
-/**
- * Localized data
- *
- * @copyright Copyright (C) 2010-2013 Combodo SARL
- * @license http://opensource.org/licenses/AGPL-3.0
- * @traductor Miguel Turrubiates
- */
-
-// Dictionnay conventions
-// Class:
-// Class:+
-// Class:/Attribute:
-// Class:/Attribute:+
-// Class:/Attribute:/Value:
-// Class:/Attribute:/Value:+
-// Class:/Stimulus:
-// Class:/Stimulus:+
-
-//
-// Class: UserLocal
-//
-
-Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array(
- 'Class:UserLocal' => 'Usuario de iTop',
- 'Class:UserLocal+' => 'Usuario Autenticado vía iTop',
- 'Class:UserLocal/Attribute:password' => 'Contraseña',
- 'Class:UserLocal/Attribute:password+' => 'Contraseña',
-));
+
+
+
+/**
+ * Localized data
+ *
+ * @copyright Copyright (C) 2010-2013 Combodo SARL
+ * @license http://opensource.org/licenses/AGPL-3.0
+ * @traductor Miguel Turrubiates
+ */
+
+// Dictionnay conventions
+// Class:
+// Class:+
+// Class:/Attribute:
+// Class:/Attribute:+
+// Class:/Attribute:/Value:
+// Class:/Attribute:/Value:+
+// Class:/Stimulus:
+// Class:/Stimulus:+
+
+//
+// Class: UserLocal
+//
+
+Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array(
+ 'Class:UserLocal' => 'Usuario de iTop',
+ 'Class:UserLocal+' => 'Usuario Autenticado vÃa iTop',
+ 'Class:UserLocal/Attribute:password' => 'Contraseña',
+ 'Class:UserLocal/Attribute:password+' => 'Contraseña',
+));
diff --git a/datamodels/2.x/itop-attachments/es_cr.dict.itop-attachments.php b/datamodels/2.x/itop-attachments/es_cr.dict.itop-attachments.php
index 4351dbae3..8483a197c 100755
--- a/datamodels/2.x/itop-attachments/es_cr.dict.itop-attachments.php
+++ b/datamodels/2.x/itop-attachments/es_cr.dict.itop-attachments.php
@@ -1,44 +1,44 @@
-
-
-
-/**
- * Localized data
- *
- * @copyright Copyright (C) 2010-2013 Combodo SARL
- * @license http://opensource.org/licenses/AGPL-3.0
- * @traductor Miguel Turrubiates
- */
-
-Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array(
- 'Attachments:TabTitle_Count' => 'Anexos (%1$d)',
- 'Attachments:EmptyTabTitle' => 'Anexos',
- 'Attachments:FieldsetTitle' => 'Anexos',
- 'Attachments:DeleteBtn' => 'Borrar',
- 'Attachments:History_File_Added' => 'Anexo %1$s agregado.',
- 'Attachments:History_File_Removed' => 'Anexo %1$s removido.',
- 'Attachments:AddAttachment' => 'Agregar Anexo: ',
- 'Attachments:UploadNotAllowedOnThisSystem' => 'La carga de archivos NO está permitida en este sistema.',
- 'Attachment:Max_Go' => '(Tamaño Máximo de Archivo: %1$s Gb)',
- 'Attachment:Max_Mo' => '(Tamaño Máximo de Archivo: %1$s Mb)',
- 'Attachment:Max_Ko' => '(Tamaño Máximo de Archivo: %1$s Kb)',
- 'Attachments:NoAttachment' => 'No hay Anexo. ',
- 'Class:Attachment' => 'Anexo',
- 'Class:Attachment+' => 'Anexo',
- 'Attachments:PreviewNotAvailable' => 'Vista preliminar no disponible para este tipo de Anexo.',
- ));
+
+
+
+/**
+ * Localized data
+ *
+ * @copyright Copyright (C) 2010-2013 Combodo SARL
+ * @license http://opensource.org/licenses/AGPL-3.0
+ * @traductor Miguel Turrubiates
+ */
+
+Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array(
+ 'Attachments:TabTitle_Count' => 'Anexos (%1$d)',
+ 'Attachments:EmptyTabTitle' => 'Anexos',
+ 'Attachments:FieldsetTitle' => 'Anexos',
+ 'Attachments:DeleteBtn' => 'Borrar',
+ 'Attachments:History_File_Added' => 'Anexo %1$s agregado.',
+ 'Attachments:History_File_Removed' => 'Anexo %1$s removido.',
+ 'Attachments:AddAttachment' => 'Agregar Anexo: ',
+ 'Attachments:UploadNotAllowedOnThisSystem' => 'La carga de archivos NO está permitida en este sistema.',
+ 'Attachment:Max_Go' => '(Tamaño Máximo de Archivo: %1$s Gb)',
+ 'Attachment:Max_Mo' => '(Tamaño Máximo de Archivo: %1$s Mb)',
+ 'Attachment:Max_Ko' => '(Tamaño Máximo de Archivo: %1$s Kb)',
+ 'Attachments:NoAttachment' => 'No hay Anexo. ',
+ 'Class:Attachment' => 'Anexo',
+ 'Class:Attachment+' => 'Anexo',
+ 'Attachments:PreviewNotAvailable' => 'Vista preliminar no disponible para este tipo de Anexo.',
+ ));
From 1973f7526e39d90f031174696725b3b222398a44 Mon Sep 17 00:00:00 2001
From: Molkobain
Date: Tue, 2 Oct 2018 10:48:32 +0200
Subject: [PATCH 05/19] Update .gitignore to match the one from develop
---
.gitignore | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/.gitignore b/.gitignore
index 43cf000c4..aec7aa429 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,9 +1,11 @@
-conf/*
-env-*/*
+/toolkit/
+/conf/*
+/env-*/*
# composer reserver directory, from sources, populate/update using "composer install"
vendor/*
+test/vendor/*
# all datas but listing prevention
data/*
@@ -118,4 +120,3 @@ local.properties
.cache-main
.scala_dependencies
.worksheet
-
From 1cf36a5d0105cbcce4eba9bfba345b2bc1374462 Mon Sep 17 00:00:00 2001
From: Guillaume Lajarige
Date: Thu, 26 Jul 2018 16:22:15 +0200
Subject: [PATCH 06/19] =?UTF-8?q?(Retrofit=20from=20develop=205e1452f9)=20?=
=?UTF-8?q?N=C2=B01580=20Portal:=20Default=20image=20of=20image=20attribut?=
=?UTF-8?q?es=20not=20correctly=20displayed=20in=20object=20forms.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
core/attributedef.class.inc.php | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/core/attributedef.class.inc.php b/core/attributedef.class.inc.php
index b4ac8205b..732faf2d1 100644
--- a/core/attributedef.class.inc.php
+++ b/core/attributedef.class.inc.php
@@ -5835,6 +5835,32 @@ class AttributeImage extends AttributeBlob
{
return '\\Combodo\\iTop\\Form\\Field\\ImageField';
}
+
+ public function MakeFormField(DBObject $oObject, $oFormField = null)
+ {
+ if ($oFormField === null)
+ {
+ $sFormFieldClass = static::GetFormFieldClass();
+ $oFormField = new $sFormFieldClass($this->GetCode());
+ }
+
+ parent::MakeFormField($oObject, $oFormField);
+
+ // Generating urls
+ $value = $oObject->Get($this->GetCode());
+ if (is_object($value) && !$value->IsEmpty())
+ {
+ $oFormField->SetDownloadUrl($value->GetDownloadURL(get_class($oObject), $oObject->GetKey(), $this->GetCode()));
+ $oFormField->SetDisplayUrl($value->GetDisplayURL(get_class($oObject), $oObject->GetKey(), $this->GetCode()));
+ }
+ else
+ {
+ $oFormField->SetDownloadUrl($this->Get('default_image'));
+ $oFormField->SetDisplayUrl($this->Get('default_image'));
+ }
+
+ return $oFormField;
+ }
}
/**
* A stop watch is an ormStopWatch object, it is stored as several columns in the database
From 2966efcfde7c848d3d59a2424c413af6d26f8fc6 Mon Sep 17 00:00:00 2001
From: Guillaume Lajarige
Date: Wed, 25 Jul 2018 15:06:38 +0200
Subject: [PATCH 07/19] =?UTF-8?q?(Retrofit=20from=20develop=20af43e22f)=20?=
=?UTF-8?q?N=C2=B01578=20Fix=20"Run=20Query"=20page=20hotkeys=20behavior?=
=?UTF-8?q?=20in=20some=20configurations=20due=20to=20a=20wrong=20url.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pages/run_query.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pages/run_query.php b/pages/run_query.php
index c871d236e..22e919d93 100644
--- a/pages/run_query.php
+++ b/pages/run_query.php
@@ -170,7 +170,7 @@ try
$oP->add("
";
$sTip = addslashes($sTip);
- $sReadyScript .= "$('#multi_values_$sAttCode').qtip( { content: '$sTip', show: 'mouseover', hide: 'mouseout', style: { name: 'dark', tip: 'leftTop' }, position: { corner: { target: 'rightMiddle', tooltip: 'leftTop' }} } );\n";
- $sComments .= ''.count($aValues[$sAttCode]).'
';
+ $sReadyScript .= "$('#multi_values_$sFieldInputId').qtip( { content: '$sTip', show: 'mouseover', hide: 'mouseout', style: { name: 'dark', tip: 'leftTop' }, position: { corner: { target: 'rightMiddle', tooltip: 'leftTop' }} } );\n";
+ $sComments .= ''.count($aValues[$sAttCode]).'
';
}
- $aDetails[] = array('label' => ''.$oAttDef->GetLabel().'', 'value' => "$sHTMLValue", 'comments' => $sComments);
- $aFieldsMap[$sAttCode] = $sAttCode;
+ $aDetails[] = array('label' => ''.$oAttDef->GetLabel().'', 'value' => "$sHTMLValue", 'comments' => $sComments);
+ $aFieldsMap[$sAttCode] = $sFieldInputId;
$iFieldIndex++;
}
}
@@ -1289,7 +1292,7 @@ EOF
$oP->add('');
}
$oP->add("\n");
- $oP->add("