Skip to content

Commit 7d385b9

Browse files
committed
Init data for pastebin_lang
1 parent be28a2c commit 7d385b9

File tree

1 file changed

+119
-0
lines changed

1 file changed

+119
-0
lines changed

migrations/v210_add_data.php

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
<?php
2+
/**
3+
*
4+
* Pastebin extension for the phpBB Forum Software package.
5+
*
6+
* @copyright (c) 2024 Crizzo <https://www.phpBB.de>
7+
* @license GNU General Public License, version 2 (GPL-2.0)
8+
*
9+
*/
10+
11+
namespace phpbbde\pastebin\migrations;
12+
13+
class v210_add_data extends \phpbb\db\migration\migration
14+
{
15+
public static function depends_on()
16+
{
17+
return array(
18+
'\phpbbde\pastebin\migrations\v210',
19+
);
20+
}
21+
22+
public function update_data()
23+
{
24+
$data = [
25+
// Update version
26+
array('config.update', array('pastebin_version', '2.1.0')),
27+
// Add ACP module
28+
array('module.add', array(
29+
'acp',
30+
'ACP_CAT_DOT_MODS',
31+
'ACP_PASTEBIN_TITLE'
32+
)),
33+
array('module.add', array(
34+
'acp',
35+
'ACP_PASTEBIN_TITLE',
36+
array(
37+
'module_basename' => '\phpbbde\pastebin\acp\pastebin_module',
38+
'modes' => array('pastebin_settings'),
39+
),
40+
)),
41+
// Insert first data into new table pastebin_langs
42+
array('custom', array(array($this, 'insert_init_lang_data'))),
43+
];
44+
return $data;
45+
}
46+
47+
public function insert_init_lang_data()
48+
{
49+
$init_lang_data = [
50+
[
51+
'lang_file_ext' => '',
52+
'lang_name' => 'Base',
53+
'lang_active' => 1,
54+
],
55+
[
56+
'lang_file_ext' => '',
57+
'lang_name' => 'Blade',
58+
'lang_active' => 1,
59+
],
60+
[
61+
'lang_file_ext' => 'css',
62+
'lang_name' => 'CSS',
63+
'lang_active' => 1,
64+
],
65+
[
66+
'lang_file_ext' => '',
67+
'lang_name' => 'DocComment',
68+
'lang_active' => 0,
69+
],
70+
[
71+
'lang_file_ext' => '',
72+
'lang_name' => 'GDScript',
73+
'lang_active' => 0,
74+
],
75+
[
76+
'lang_file_ext' => 'html,htm',
77+
'lang_name' => 'HTML',
78+
'lang_active' => 1,
79+
],
80+
[
81+
'lang_file_ext' => 'js',
82+
'lang_name' => 'JavaScript',
83+
'lang_active' => 1,
84+
],
85+
[
86+
'lang_file_ext' => 'json',
87+
'lang_name' => 'Json',
88+
'lang_active' => 1,
89+
],
90+
[
91+
'lang_file_ext' => 'php',
92+
'lang_name' => 'PHP',
93+
'lang_active' => 1,
94+
],
95+
[
96+
'lang_file_ext' => 'sql',
97+
'lang_name' => 'SQL',
98+
'lang_active' => 1,
99+
],
100+
[
101+
'lang_file_ext' => '',
102+
'lang_name' => 'Twig',
103+
'lang_active' => 0,
104+
],
105+
[
106+
'lang_file_ext' => 'xml',
107+
'lang_name' => 'yaml',
108+
'lang_active' => 0,
109+
],
110+
[
111+
'lang_file_ext' => 'yaml,yml',
112+
'lang_name' => 'YAML',
113+
'lang_active' => 1,
114+
],
115+
];
116+
// Insert sample rule data
117+
$this->db->sql_multi_insert($this->table_prefix . 'pastebin_langs', $init_lang_data);
118+
}
119+
}

0 commit comments

Comments
 (0)