-
Notifications
You must be signed in to change notification settings - Fork 5
/
module.combodo-webhook-integration.php
77 lines (71 loc) · 1.99 KB
/
module.combodo-webhook-integration.php
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
<?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-webhook-integration/1.4.0', array(
// Identification
//
'label' => 'Webhook integrations',
'category' => 'business',
// Setup
//
'dependencies' => array(
'itop-structure/3.2.0',
'itop-attribute-encrypted-password/1.0.0',
'combodo-oauth2-client/1.0.0',
),
'mandatory' => false,
'visible' => true,
'installer' => 'WebhookIntegrationInstaller',
// Components
//
'datamodel' => array(
// Extension autoloader
'vendor/autoload.php',
// Explicitly load DM classes
'SendWebRequest.php',
'model.combodo-webhook-integration.php',
),
'webservice' => array(),
'data.struct' => array(
'data.struct.remote_application_type.xml',
),
'data.sample' => array(),
// Documentation
//
'doc.manual_setup' => '', // hyperlink to manual setup documentation, if any
'doc.more_information' => '', // hyperlink to more information, if any
// Default settings
//
'settings' => array(),
)
);
if (!class_exists('WebhookIntegrationInstaller'))
{
// Module installation handler
//
class WebhookIntegrationInstaller extends ModuleInstallerAPI
{
/**
* @inheritDoc
* @since 1.4.0
*/
public static function BeforeDatabaseCreation(Config $oConfiguration, $sPreviousVersion, $sCurrentVersion)
{
if (strlen($sPreviousVersion) === 0) {
return;
}
// Search for existing ActionWebhook where the language attribute was defined on its child
if (version_compare($sPreviousVersion, '1.4.0', '<')) {
SetupLog::Info("| Migrate ActionWebhook language attribute values to its parent.");
$sTableToRead = MetaModel::DBGetTable('ActionWebhook');
$sTableToSet = MetaModel::DBGetTable('ActionNotification');
self::MoveColumnInDB($sTableToRead, 'language', $sTableToSet, 'language', true);
SetupLog::Info("| ActionWebhook migration done.");
}
}
}
}