Completed
Pull Request — master (#4433)
by Craig
04:24
created

MailerModuleInstaller::uninstall()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 4
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Zikula package.
7
 *
8
 * Copyright Zikula - https://ziku.la/
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Zikula\MailerModule;
15
16
use Zikula\ExtensionsModule\Installer\AbstractExtensionInstaller;
17
18
class MailerModuleInstaller extends AbstractExtensionInstaller
19
{
20
    public function install(): bool
21
    {
22
        $this->setVars($this->getDefaults());
23
24
        return true;
25
    }
26
27
    public function upgrade(string $oldVersion): bool
28
    {
29
        switch ($oldVersion) {
30
            case '1.5.0': // shipped with Core-1.4.3
31
            case '1.5.1': // shipped with Core-2.0.15
32
                $enableLogging = $this->getVar('enableLogging');
33
                $this->delVars();
34
                $this->setVar('enableLogging', $enableLogging);
35
                // future upgrade routines
36
        }
37
38
        return true;
39
    }
40
41
    public function uninstall(): bool
42
    {
43
        // Deletion not allowed
44
        return false;
45
    }
46
47
    /**
48
     * Default module vars.
49
     */
50
    private function getDefaults(): array
51
    {
52
        return [
53
            'enableLogging' => false
54
        ];
55
    }
56
}
57