-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscripts.php
74 lines (58 loc) · 2.04 KB
/
scripts.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
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
<?php
return [
/*
* Installation hook.
*/
'install' => function ($app) {
$util = $app['db']->getUtility();
if ($util->tableExists('@search_keywords') === false) {
$util->createTable('@search_keywords', function ($table) {
$table->addColumn('id', 'integer', ['unsigned' => true, 'length' => 10, 'autoincrement' => true]);
$table->addColumn('word', 'string', ['length' => 255]);
$table->addColumn('ip', 'integer',['unsigned' => true, 'default' => 0]);
$table->addColumn('putdate', 'datetime', ['notnull' => false]);
$table->setPrimaryKey(['id']);
$table->addIndex(['word'], '@SEARCH_KEYWORDS_WORD');
$table->addIndex(['putdate'], '@SEARCH_KEYWORDS_PUTDATE');
});
}
},
/*
* Enable hook
*
*/
'enable' => function ($app) {
},
/*
* Uninstall hook
*
*/
'uninstall' => function ($app) {
$util = $app['db']->getUtility();
if ($util->tableExists('@search_keywords')) {
$util->dropTable('@search_keywords');
}
// remove the config
$app['config']->remove('pagekit/search');
},
/*
* Runs all updates that are newer than the current version.
*
*/
'updates' => [
'0.1.5' => function ($app) {
$util = $app['db']->getUtility();
if ($util->tableExists('@search_keywords') === false) {
$util->createTable('@search_keywords', function ($table) {
$table->addColumn('id', 'integer', ['unsigned' => true, 'length' => 10, 'autoincrement' => true]);
$table->addColumn('word', 'string', ['length' => 255]);
$table->addColumn('ip', 'integer',['unsigned' => true, 'default' => 0]);
$table->addColumn('putdate', 'datetime', ['notnull' => false]);
$table->setPrimaryKey(['id']);
$table->addIndex(['word'], '@SEARCH_KEYWORDS_WORD');
$table->addIndex(['putdate'], '@SEARCH_KEYWORDS_PUTDATE');
});
}
}
]
];