-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathatm.install
48 lines (38 loc) · 1 KB
/
atm.install
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
<?php
/**
* @file
* AdTechMedia advertising install module file.
*/
/**
* Implements hook_install().
*/
function atm_install() {
$timeLimit = ini_get('max_execution_time');
set_time_limit(0);
$helper = atm_get_helper();
$helper->generateApiKey();
$helper->getAtmHttpClient()->propertyCreate();
$isThemeRetrieved = $helper->getAtmHttpClient()->retrieveThemeConfig();
if ($isThemeRetrieved !== TRUE) {
$helper->createThemeConfig();
}
set_time_limit($timeLimit);
}
/**
* Implements hook_uninstall().
*/
function atm_uninstall() {
/** @var \Drupal\Core\File\FileSystem $fileSystem */
$helper = atm_get_helper();
$fileSystem = \Drupal::service('file_system');
$jsLocalFile = $helper->get('atm_js_local_file');
$scheme = file_default_scheme();
$path = $fileSystem->realpath($scheme . "://" . $jsLocalFile);
$dirname = $fileSystem->dirname($path);
if (file_exists($path)) {
$fileSystem->unlink($path);
}
if (is_dir($dirname)) {
$fileSystem->rmdir($dirname);
}
}