Skip to content

Commit 64531d7

Browse files
committed
Init data for pastebin_lang
1 parent be28a2c commit 64531d7

File tree

2 files changed

+132
-0
lines changed

2 files changed

+132
-0
lines changed

acp/pastebin_info.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ function module()
2323
'auth' => 'ext_phpbbde/pastebin && acl_a_board',
2424
'cat' => array('ACP_PASTEBIN_TITLE')
2525
),
26+
'pastebin_languages' => array(
27+
'title' => 'ACP_PASTEBIN_LANGUAGES',
28+
'auth' => 'ext_phpbbde/pastebin && acl_a_board',
29+
'cat' => array('ACP_PASTEBIN_TITLE')
30+
),
2631
),
2732
);
2833
}

migrations/v210_add_data.php

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
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+
array('module.add', array(
42+
'acp',
43+
'ACP_PASTEBIN_TITLE',
44+
array(
45+
'module_basename' => '\phpbbde\pastebin\acp\pastebin_module',
46+
'modes' => array('pastebin_languages'),
47+
),
48+
)),
49+
// Insert first data into new table pastebin_langs
50+
array('custom', array(array($this, 'insert_init_lang_data'))),
51+
];
52+
return $data;
53+
}
54+
55+
public function insert_init_lang_data()
56+
{
57+
$init_lang_data = [
58+
[
59+
'lang_file_ext' => '',
60+
'lang_name' => 'Base',
61+
'lang_active' => 1,
62+
],
63+
[
64+
'lang_file_ext' => '',
65+
'lang_name' => 'Blade',
66+
'lang_active' => 1,
67+
],
68+
[
69+
'lang_file_ext' => 'css',
70+
'lang_name' => 'CSS',
71+
'lang_active' => 1,
72+
],
73+
[
74+
'lang_file_ext' => '',
75+
'lang_name' => 'DocComment',
76+
'lang_active' => 0,
77+
],
78+
[
79+
'lang_file_ext' => '',
80+
'lang_name' => 'GDScript',
81+
'lang_active' => 0,
82+
],
83+
[
84+
'lang_file_ext' => 'html,htm',
85+
'lang_name' => 'HTML',
86+
'lang_active' => 1,
87+
],
88+
[
89+
'lang_file_ext' => 'js',
90+
'lang_name' => 'JavaScript',
91+
'lang_active' => 1,
92+
],
93+
[
94+
'lang_file_ext' => 'json',
95+
'lang_name' => 'Json',
96+
'lang_active' => 1,
97+
],
98+
[
99+
'lang_file_ext' => 'php',
100+
'lang_name' => 'PHP',
101+
'lang_active' => 1,
102+
],
103+
[
104+
'lang_file_ext' => 'sql',
105+
'lang_name' => 'SQL',
106+
'lang_active' => 1,
107+
],
108+
[
109+
'lang_file_ext' => '',
110+
'lang_name' => 'Twig',
111+
'lang_active' => 0,
112+
],
113+
[
114+
'lang_file_ext' => 'xml',
115+
'lang_name' => 'XML',
116+
'lang_active' => 0,
117+
],
118+
[
119+
'lang_file_ext' => 'yaml,yml',
120+
'lang_name' => 'YAML',
121+
'lang_active' => 1,
122+
],
123+
];
124+
// Insert sample rule data
125+
$this->db->sql_multi_insert($this->table_prefix . 'pastebin_langs', $init_lang_data);
126+
}
127+
}

0 commit comments

Comments
 (0)