1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Backend\Modules\Profiles\Installer; |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
* This file is part of Fork CMS. |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the license |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
use Backend\Core\Installer\ModuleUninstaller; |
13
|
|
|
use Backend\Core\Installer\UninstallerInterface; |
14
|
|
|
use Backend\Core\Language\Language; |
15
|
|
|
use Symfony\Component\Filesystem\Filesystem; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Uninstaller for the profiles module. |
19
|
|
|
*/ |
20
|
|
|
class Uninstaller extends ModuleUninstaller implements UninstallerInterface |
21
|
|
|
{ |
22
|
|
|
public function uninstall(): void |
23
|
|
|
{ |
24
|
|
|
$this->setModule('Profiles'); |
25
|
|
|
|
26
|
|
|
$this->deleteFrontendFilesDirectories(); |
27
|
|
|
$this->deleteFrontendPages(); |
28
|
|
|
$this->deleteBackendNavigation(); |
29
|
|
|
|
30
|
|
|
$this->dropDatabase([ |
31
|
|
|
'profiles_settings', 'profiles_sessions', 'profiles_groups_rights', 'profiles_groups', 'profiles', |
32
|
|
|
]); |
33
|
|
|
|
34
|
|
|
$this->dropModule(); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
private function deleteBackendNavigation(): void |
38
|
|
|
{ |
39
|
|
|
$this->deleteNavigation('Modules.' . $this->getModule() . '.Overview'); |
40
|
|
|
$this->deleteNavigation('Modules.' . $this->getModule() . '.Groups'); |
41
|
|
|
$this->deleteNavigation('Modules.' . $this->getModule()); |
42
|
|
|
$this->deleteNavigation('Settings.Modules.' . $this->getModule()); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
private function deleteFrontendFilesDirectories(): void |
46
|
|
|
{ |
47
|
|
|
$filesystem = new Filesystem(); |
48
|
|
|
$filesystem->remove(PATH_WWW . '/src/Frontend/Files/Profiles/Avatars/source/'); |
49
|
|
|
$filesystem->remove(PATH_WWW . '/src/Frontend/Files/Profiles/Avatars/240x240/'); |
50
|
|
|
$filesystem->remove(PATH_WWW . '/src/Frontend/Files/Profiles/Avatars/64x64/'); |
51
|
|
|
$filesystem->remove(PATH_WWW . '/src/Frontend/Files/Profiles/Avatars/32x32/'); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
private function deleteFrontendPages(): void |
55
|
|
|
{ |
56
|
|
|
foreach ($this->getLanguages() as $language) { |
57
|
|
|
// We must define the locale we want to insert the page into |
58
|
|
|
Language::setLocale($language); |
59
|
|
|
|
60
|
|
|
/** @noinspection DisconnectedForeachInstructionInspection */ |
61
|
|
|
$this->deletePages([ |
62
|
|
|
ucfirst(Language::lbl('Profile')), |
63
|
|
|
ucfirst(Language::lbl('Activate')), |
64
|
|
|
ucfirst(Language::lbl('ForgotPassword')), |
65
|
|
|
ucfirst(Language::lbl('ResetPassword')), |
66
|
|
|
ucfirst(Language::lbl('ResendActivation')), |
67
|
|
|
ucfirst(Language::lbl('Login')), |
68
|
|
|
ucfirst(Language::lbl('Register')), |
69
|
|
|
ucfirst(Language::lbl('Logout')), |
70
|
|
|
ucfirst(Language::lbl('ProfileSettings')), |
71
|
|
|
ucfirst(Language::lbl('ChangeEmail')), |
72
|
|
|
ucfirst(Language::lbl('ChangePassword')), |
73
|
|
|
]); |
74
|
|
|
} |
75
|
|
|
} |
76
|
|
|
} |
77
|
|
|
|