Repository navigation
Expand file tree
/
Copy pathmodule.combodo-vcs-integration.php
More file actions
108 lines (96 loc) · 3.25 KB
/
Copy pathmodule.combodo-vcs-integration.php
File metadata and controls
108 lines (96 loc) · 3.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<?php
//
// iTop module definition file
//
SetupWebPage::AddModule(
__FILE__, // Path to the current file, all other file names are relative to the directory containing this file
'combodo-vcs-integration/1.2.1',
[
// Identification
//
'label' => 'VCS Management',
'category' => 'business',
// Setup
//
'dependencies' => [
'itop-structure/3.2.0',
'itop-tickets/2.7.0',
'itop-request-mgmt/3.2.0',
],
'mandatory' => false,
'visible' => true,
'installer' => 'VCSIntegrationInstaller',
// Components
//
'datamodel' => [
'vendor/autoload.php',
'model.combodo-vcs-integration.php', // Contains the PHP code generated by the "compilation" of datamodel.github-base.xml
'src/Hook/VCSPopupMenu.php',
'src/BackgroundProcess/VCSWebhookSynchroProcess.php',
'src/BackgroundProcess/VCSWebhookAsynchronousHandler.php',
'src/EventListener/VCSAutomationEventListener.php',
'src/EventListener/VCSWebhookEventListener.php',
],
'webservice' => [],
'data.struct' => [// add your 'structure' definition XML files here,
],
'data.sample' => [// add your sample data XML files here,
],
// Documentation
//
'doc.manual_setup' => '', // hyperlink to manual setup documentation, if any
'doc.more_information' => '', // hyperlink to more information, if any
// Security
'delegated_authentication_endpoints' => [
'github.php',
],
// Default settings
//
'settings' => [
'webhook_user_id' => null,
'user_resolver_class_name' => null,
],
]
);
if (!class_exists('VCSIntegrationInstaller')) {
// Module installation handler
//
class VCSIntegrationInstaller extends ModuleInstallerAPI
{
public static function BeforeWritingConfig(Config $oConfiguration)
{
// If you want to override/force some configuration values, do it here
return $oConfiguration;
}
/**
* Handler called before creating or upgrading the database schema
* @param $oConfiguration Config The new configuration of the application
* @param $sPreviousVersion string PRevious version number of the module (empty string in case of first install)
* @param $sCurrentVersion string Current version number of the module
*/
public static function BeforeDatabaseCreation(Config $oConfiguration, $sPreviousVersion, $sCurrentVersion)
{
// If you want to migrate data from one format to another, do it here
}
/**
* Handler called after the creation/update of the database schema
* @param $oConfiguration Config The new configuration of the application
* @param $sPreviousVersion string PRevious version number of the module (empty string in case of first install)
* @param $sCurrentVersion string Current version number of the module
*/
public static function AfterDatabaseCreation(Config $oConfiguration, $sPreviousVersion, $sCurrentVersion)
{
// Load structure data
if (utils::IsNullOrEmptyString($sPreviousVersion)) {
$oDataLoader = new XMLDataLoader();
CMDBObject::SetTrackInfo("Initialization");
$oMyChange = CMDBObject::GetCurrentChange();
$sFileName = dirname(__FILE__)."/data/en_us.data.combodo-vcs-integration.xml";
SetupLog::Info("Loading file: $sFileName");
$oDataLoader->StartSession($oMyChange);
$oDataLoader->LoadFile($sFileName, false, true);
$oDataLoader->EndSession();
}
}
}
}