This repository was archived by the owner on Aug 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPageLockModuleInstaller.php
More file actions
76 lines (62 loc) · 1.63 KB
/
PageLockModuleInstaller.php
File metadata and controls
76 lines (62 loc) · 1.63 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
<?php
declare(strict_types=1);
/*
* This file is part of the Zikula package.
*
* Copyright Zikula - https://ziku.la/
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Zikula\PageLockModule;
use Exception;
use PDOException;
use Zikula\ExtensionsModule\Installer\AbstractExtensionInstaller;
use Zikula\PageLockModule\Entity\PageLockEntity;
/**
* Installation and upgrade routines for the pagelock module.
*/
class PageLockModuleInstaller extends AbstractExtensionInstaller
{
/**
* @var array
*/
private $entities = [
PageLockEntity::class
];
public function install(): bool
{
try {
$this->schemaTool->create($this->entities);
} catch (Exception $exception) {
$this->addFlash('error', $exception->getMessage());
return false;
}
return true;
}
public function upgrade(string $oldVersion): bool
{
switch ($oldVersion) {
case '1.1.1':
$this->schemaTool->update([
PageLockEntity::class
]);
case '2.0.0':
// current version
}
return true;
}
public function uninstall(): bool
{
try {
$this->schemaTool->drop($this->entities);
} catch (PDOException $exception) {
$this->addFlash('error', $exception->getMessage());
return false;
}
// Delete any module variables.
$this->delVars();
// Deletion successful.
return true;
}
}