-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSetup.php
49 lines (42 loc) · 1.17 KB
/
Setup.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
<?php
declare(strict_types=1);
/**
* This file is part of "[HLModerators] Protect post for editing" Add-On for XenForo v2.2.x.
* All rights reserved.
*
* Developed by HLModerators.
*/
namespace HLModerators\PostEditProtect;
use XF\AddOn\AbstractSetup;
use XF\AddOn\StepRunnerInstallTrait;
use XF\AddOn\StepRunnerUninstallTrait;
use XF\AddOn\StepRunnerUpgradeTrait;
use XF\Db\Schema\Alter;
class Setup extends AbstractSetup
{
use StepRunnerInstallTrait;
use StepRunnerUpgradeTrait;
use StepRunnerUninstallTrait;
public function installStep1()
{
$this->applyContentPermission('forum', 'hlmProtectPost', 'forum',
'editAnyPost');
$this->applyGlobalPermission('forum', 'hlmProtectPost', 'forum',
'editAnyPost');
}
public function installStep2()
{
$this->alterTable('xf_post', function (Alter $table)
{
$table->addColumn('hlm_is_protected', 'bool')
->setDefault(0);
});
}
public function uninstallStep1()
{
$this->alterTable('xf_post', function (Alter $table)
{
$table->dropColumns(['hlm_is_protected']);
});
}
}