Verzeichnisstruktur phpBB-3.3.15
- Veröffentlicht
- 28.08.2024
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
acp_prune_users_module.php
01 <?php
02 /**
03 *
04 * This file is part of the phpBB Forum Software package.
05 *
06 * @copyright (c) phpBB Limited <https://www.phpbb.com>
07 * @license GNU General Public License, version 2 (GPL-2.0)
08 *
09 * For full copyright and license information, please see
10 * the docs/CREDITS.txt file.
11 *
12 */
13
14 namespace phpbb\db\migration\data\v310;
15
16 class acp_prune_users_module extends \phpbb\db\migration\container_aware_migration
17 {
18 public function effectively_installed()
19 {
20 $sql = 'SELECT module_id
21 FROM ' . MODULES_TABLE . "
22 WHERE module_class = 'acp'
23 AND module_langname = 'ACP_CAT_USERS'";
24 $result = $this->db->sql_query($sql);
25 $acp_cat_users_id = (int) $this->db->sql_fetchfield('module_id');
26 $this->db->sql_freeresult($result);
27
28 $sql = 'SELECT parent_id
29 FROM ' . MODULES_TABLE . "
30 WHERE module_class = 'acp'
31 AND module_basename = 'acp_prune'
32 AND module_mode = 'users'";
33 $result = $this->db->sql_query($sql);
34 $acp_prune_users_parent = (int) $this->db->sql_fetchfield('parent_id');
35 $this->db->sql_freeresult($result);
36
37 // Skip migration if "Users" category has been deleted
38 // or the module has already been moved to that category
39 return !$acp_cat_users_id || $acp_cat_users_id === $acp_prune_users_parent;
40 }
41
42 static public function depends_on()
43 {
44 return array('\phpbb\db\migration\data\v310\beta1');
45 }
46
47 public function update_data()
48 {
49 return array(
50 array('custom', array(array($this, 'move_prune_users_module'))),
51 );
52 }
53
54 public function move_prune_users_module()
55 {
56 $sql = 'SELECT module_id
57 FROM ' . MODULES_TABLE . "
58 WHERE module_class = 'acp'
59 AND module_basename = 'acp_prune'
60 AND module_mode = 'users'";
61 $result = $this->db->sql_query($sql);
62 $acp_prune_users_id = (int) $this->db->sql_fetchfield('module_id');
63 $this->db->sql_freeresult($result);
64
65 $sql = 'SELECT module_id
66 FROM ' . MODULES_TABLE . "
67 WHERE module_class = 'acp'
68 AND module_langname = 'ACP_CAT_USERS'";
69 $result = $this->db->sql_query($sql);
70 $acp_cat_users_id = (int) $this->db->sql_fetchfield('module_id');
71 $this->db->sql_freeresult($result);
72
73 $module_manager = $this->container->get('module.manager');
74 $module_manager->move_module($acp_prune_users_id, $acp_cat_users_id, 'acp');
75 }
76 }
77