[ticket/701] Update migrations file
B3P-701
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Board3 Portal v2.2
|
||||
* @copyright 2015 Board3 Group ( www.board3.de )
|
||||
* @package Board3 Portal v2.3
|
||||
* @copyright 2021 Board3 Group ( www.board3.de )
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*/
|
||||
|
||||
@@ -10,36 +10,36 @@ namespace board3\portal\migrations;
|
||||
|
||||
use phpbb\db\migration\migration;
|
||||
|
||||
class v220_fa extends migration
|
||||
class v230_fa extends migration
|
||||
{
|
||||
public static function depends_on()
|
||||
public static function depends_on(): array
|
||||
{
|
||||
return array('\board3\portal\migrations\v210');
|
||||
return ['\board3\portal\migrations\v210'];
|
||||
}
|
||||
|
||||
public function update_schema()
|
||||
public function update_schema(): array
|
||||
{
|
||||
return array(
|
||||
'add_columns' => array(
|
||||
$this->table_prefix . 'portal_modules' => array(
|
||||
'module_fa_icon' => array('VCHAR', ''),
|
||||
'module_fa_size' => array('INT:1', 16),
|
||||
),
|
||||
),
|
||||
);
|
||||
return [
|
||||
'add_columns' => [
|
||||
$this->table_prefix . 'portal_modules' => [
|
||||
'module_fa_icon' => ['VCHAR', ''],
|
||||
'module_fa_size' => ['INT:1', 16],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function update_data()
|
||||
public function update_data(): array
|
||||
{
|
||||
return array(
|
||||
array('config.add', array('board3_portal_fa_styles', '')),
|
||||
array('custom', array(array(&$this, 'insert_defaults'))),
|
||||
);
|
||||
return [
|
||||
['config.add', ['board3_portal_fa_styles', '']],
|
||||
['custom', [[$this, 'insert_defaults']]],
|
||||
];
|
||||
}
|
||||
|
||||
public function insert_defaults()
|
||||
{
|
||||
$fa_icons = array(
|
||||
$fa_icons = [
|
||||
'\board3\portal\modules\main_menu' => 'fa-bars',
|
||||
'\board3\portal\modules\stylechanger' => 'fa-paint-brush',
|
||||
'\board3\portal\modules\birthday_list' => 'fa-birthday-cake',
|
||||
@@ -55,10 +55,12 @@ class v220_fa extends migration
|
||||
'\board3\portal\modules\leaders' => 'fa-users',
|
||||
'\board3\portal\modules\latest_bots' => 'fa-android',
|
||||
'\board3\portal\modules\links' => 'fa-link',
|
||||
);
|
||||
];
|
||||
foreach ($fa_icons as $key => $value)
|
||||
{
|
||||
$query = 'UPDATE ' . $this->table_prefix . "portal_modules SET module_fa_icon = '" . $value . "' WHERE module_classname = '" . $this->db->sql_escape($key) . "'";
|
||||
$query = 'UPDATE ' . $this->table_prefix . "portal_modules
|
||||
SET module_fa_icon = '" . $value . "'
|
||||
WHERE module_classname = '" . $this->db->sql_escape($key) . "'";
|
||||
$this->db->sql_query($query);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user