-
Notifications
You must be signed in to change notification settings - Fork 3
/
install.php
73 lines (59 loc) · 2.04 KB
/
install.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
<?php
/*
Redaxo-Addon Gridblock
Installation
v1.1.12
by Falko Müller @ 2021 (based on 0.1.0-dev von bloep)
*/
/** RexStan: Vars vom Check ausschließen */
/** @var rex_addon $this */
//Variablen deklarieren
$mypage = $this->getProperty('package');
$error = "";
//Vorgaben vornehmen
if (!$this->hasConfig()):
$this->setConfig('config', [
'modulesmode' => 'ignore',
'modules' => '',
'previewtabnames' => '',
'showtemplatetitles' => '',
'hidepreviewcoltitles' => '',
'hideinfotexts' => '',
'showcontentsettingsbe' => '',
'plusbuttonfornewblock' => '',
'alwaysallowdelete' => '',
]);
endif;
//Datenbank-Einträge vornehmen
rex_sql_table::get(rex::getTable('1620_gridtemplates'))
->ensureColumn(new rex_sql_column('id', 'int(100)', false, null, 'auto_increment'))
->ensureColumn(new rex_sql_column('prio', 'int(11)'))
->ensureColumn(new rex_sql_column('cat', 'int(100)'))
->ensureColumn(new rex_sql_column('title', 'varchar(255)'))
->ensureColumn(new rex_sql_column('description', 'text'))
->ensureColumn(new rex_sql_column('columns', 'int(2)'))
->ensureColumn(new rex_sql_column('template', 'text'))
->ensureColumn(new rex_sql_column('preview', 'text'))
->ensureColumn(new rex_sql_column('status', 'varchar(10)'))
->ensureGlobalColumns()
->setPrimaryKey('id')
->ensure();
//Module anlegen
$db = rex_sql::factory();
$db->setQuery('SELECT id FROM '.rex::getTable('module').' WHERE input LIKE "%/* GRID_MODULE_IDENTIFIER | DONT REMOVE */%"');
$input = rex_file::get($this->getPath('install/input.php'));
$output = rex_file::get($this->getPath('install/output.php'));
$db2 = rex_sql::factory();
$db2->setValue('input', $input);
$db2->setValue('output', $output);
$db2->setTable(rex::getTable('module'));
if ($db->hasNext()):
$db2->addGlobalUpdateFields();
$db2->setWhere(['id' => $db->getValue('id')]);
$db2->update();
else:
$db2->addGlobalCreateFields();
$db2->setValue('name', '01 - Gridblock (gruppierte Blöcke)');
$db2->insert();
endif;
?>