Files
Files
This commit is contained in:
29
migrations/mchat_module.php
Normal file
29
migrations/mchat_module.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package phpBB Extension - mChat
|
||||
* @copyright (c) 2015 dmzx - http://www.dmzx-web.net
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
namespace dmzx\mchat\migrations;
|
||||
|
||||
class mchat_module extends \phpbb\db\migration\migration
|
||||
{
|
||||
|
||||
public function update_data()
|
||||
{
|
||||
return array(
|
||||
array('module.add', array('acp', 'ACP_CAT_DOT_MODS', 'ACP_CAT_MCHAT')),
|
||||
array('module.add', array(
|
||||
'acp', 'ACP_CAT_MCHAT', array(
|
||||
'module_basename' => '\dmzx\mchat\acp\acp_mchat_module',
|
||||
'modes' => array('configuration'),
|
||||
'module_auth' => 'a_mchat',
|
||||
),
|
||||
)),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
30
migrations/mchat_module1.php
Normal file
30
migrations/mchat_module1.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package phpBB Extension - mChat
|
||||
* @copyright (c) 2015 dmzx - http://www.dmzx-web.net
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
namespace dmzx\mchat\migrations;
|
||||
|
||||
class mchat_module1 extends \phpbb\db\migration\migration
|
||||
{
|
||||
|
||||
public function update_data()
|
||||
{
|
||||
return array(
|
||||
array('module.add', array('ucp', 'UCP_MAIN', 'UCP_MCHAT_CONFIG')),
|
||||
array('module.add', array(
|
||||
'ucp', 'UCP_MCHAT_CONFIG', array(
|
||||
'module_basename' => '\dmzx\mchat\ucp\ucp_mchat_module',
|
||||
'modes' => array('configuration'),
|
||||
'module_auth' => 'acl_u_mchat_use',
|
||||
))),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
84
migrations/mchat_schema.php
Normal file
84
migrations/mchat_schema.php
Normal file
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package phpBB Extension - mChat
|
||||
* @copyright (c) 2015 dmzx - http://www.dmzx-web.net
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
namespace dmzx\mchat\migrations;
|
||||
|
||||
class mchat_schema extends \phpbb\db\migration\migration
|
||||
{
|
||||
|
||||
public function update_data()
|
||||
{
|
||||
return array(
|
||||
// Add configs
|
||||
array('config.add', array('mchat_enable', true)),
|
||||
array('config.add', array('mchat_on_index', true)),
|
||||
array('config.add', array('mchat_new_posts', false)),
|
||||
array('config.add', array('mchat_stats_index', false)),
|
||||
array('config.add', array('mchat_version','0.0.1')),
|
||||
|
||||
array('permission.add', array('u_mchat_use')),
|
||||
array('permission.add', array('u_mchat_view')),
|
||||
array('permission.add', array('u_mchat_edit')),
|
||||
array('permission.add', array('u_mchat_delete')),
|
||||
array('permission.add', array('u_mchat_ip')),
|
||||
array('permission.add', array('u_mchat_flood_ignore')),
|
||||
array('permission.add', array('u_mchat_archive')),
|
||||
array('permission.add', array('u_mchat_bbcode')),
|
||||
array('permission.add', array('u_mchat_smilies')),
|
||||
array('permission.add', array('u_mchat_urls')),
|
||||
array('permission.add', array('a_mchat')),
|
||||
|
||||
// Set permissions
|
||||
array('permission.permission_set', array('ADMINISTRATORS', 'u_mchat_use', 'group')),
|
||||
array('permission.permission_set', array('ADMINISTRATORS', 'u_mchat_view', 'group')),
|
||||
array('permission.permission_set', array('ADMINISTRATORS', 'u_mchat_edit', 'group')),
|
||||
array('permission.permission_set', array('ADMINISTRATORS', 'u_mchat_delete', 'group')),
|
||||
array('permission.permission_set', array('ADMINISTRATORS', 'u_mchat_ip', 'group')),
|
||||
array('permission.permission_set', array('ADMINISTRATORS', 'u_mchat_flood_ignore', 'group')),
|
||||
array('permission.permission_set', array('ADMINISTRATORS', 'u_mchat_archive', 'group')),
|
||||
array('permission.permission_set', array('ADMINISTRATORS', 'u_mchat_bbcode', 'group')),
|
||||
array('permission.permission_set', array('ADMINISTRATORS', 'u_mchat_smilies', 'group')),
|
||||
array('permission.permission_set', array('ADMINISTRATORS', 'u_mchat_urls', 'group')),
|
||||
array('permission.permission_set', array('ADMINISTRATORS', 'a_mchat', 'group')),
|
||||
array('permission.permission_set', array('REGISTERED', 'u_mchat_use', 'group')),
|
||||
array('permission.permission_set', array('REGISTERED', 'u_mchat_view', 'group')),
|
||||
array('permission.permission_set', array('REGISTERED', 'u_mchat_archive', 'group')),
|
||||
array('permission.permission_set', array('REGISTERED', 'u_mchat_bbcode', 'group')),
|
||||
array('permission.permission_set', array('REGISTERED', 'u_mchat_smilies', 'group')),
|
||||
array('permission.permission_set', array('REGISTERED', 'u_mchat_urls', 'group')),
|
||||
);
|
||||
}
|
||||
|
||||
public function update_schema()
|
||||
{
|
||||
return array(
|
||||
'add_tables' => array(
|
||||
$this->table_prefix . 'mchat_config' => array(
|
||||
'COLUMNS' => array(
|
||||
'config_name' => array('VCHAR', ''),
|
||||
'config_value' => array('VCHAR', ''),
|
||||
),
|
||||
'PRIMARY_KEY' => 'config_name',
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public function revert_schema()
|
||||
{
|
||||
return array(
|
||||
'drop_tables' => array(
|
||||
$this->table_prefix . 'mchat_config',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
52
migrations/mchat_schema_2.php
Normal file
52
migrations/mchat_schema_2.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package phpBB Extension - mChat
|
||||
* @copyright (c) 2015 dmzx - http://www.dmzx-web.net
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
namespace dmzx\mchat\migrations;
|
||||
|
||||
class mchat_schema_2 extends \phpbb\db\migration\migration
|
||||
{
|
||||
|
||||
static public function depends_on()
|
||||
{
|
||||
return array(
|
||||
'\dmzx\mchat\migrations\mchat_schema',
|
||||
);
|
||||
}
|
||||
public function update_schema()
|
||||
{
|
||||
return array(
|
||||
'add_tables' => array(
|
||||
$this->table_prefix . 'mchat' => array(
|
||||
'COLUMNS' => array(
|
||||
'message_id' => array('UINT', NULL, 'auto_increment'),
|
||||
'user_id' => array('UINT', 0),
|
||||
'user_ip' => array('VCHAR:40', ''),
|
||||
'message' => array('MTEXT_UNI', ''),
|
||||
'bbcode_bitfield' => array('VCHAR', ''),
|
||||
'bbcode_uid' => array('VCHAR:8', ''),
|
||||
'bbcode_options' => array('BOOL', '7'),
|
||||
'message_time' => array('INT:11', 0),
|
||||
'forum_id' => array('UINT', 0),
|
||||
'post_id' => array('UINT', 0),
|
||||
),
|
||||
'PRIMARY_KEY' => 'message_id',
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
public function revert_schema()
|
||||
{
|
||||
return array(
|
||||
'drop_tables' => array(
|
||||
$this->table_prefix . 'mchat',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
132
migrations/mchat_schema_3.php
Normal file
132
migrations/mchat_schema_3.php
Normal file
@@ -0,0 +1,132 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package phpBB Extension - mChat
|
||||
* @copyright (c) 2015 dmzx - http://www.dmzx-web.net
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
namespace dmzx\mchat\migrations;
|
||||
|
||||
class mchat_schema_3 extends \phpbb\db\migration\migration
|
||||
{
|
||||
|
||||
static public function depends_on()
|
||||
{
|
||||
return array(
|
||||
'\dmzx\mchat\migrations\mchat_schema_2',
|
||||
);
|
||||
}
|
||||
public function update_data()
|
||||
{
|
||||
return array(
|
||||
array('custom', array(array($this, 'insert_sample_data'))),
|
||||
);
|
||||
}
|
||||
public function insert_sample_data()
|
||||
{
|
||||
global $user;
|
||||
|
||||
|
||||
|
||||
// Define sample rule data
|
||||
$sample_data = array(
|
||||
array(
|
||||
'config_name' => 'refresh',
|
||||
'config_value' => '10',
|
||||
),
|
||||
array(
|
||||
'config_name' => 'message_limit',
|
||||
'config_value' => '10',
|
||||
),
|
||||
array(
|
||||
'config_name' => 'archive_limit',
|
||||
'config_value' => '25',
|
||||
),
|
||||
array(
|
||||
'config_name' => 'flood_time',
|
||||
'config_value' => '20',
|
||||
),
|
||||
array(
|
||||
'config_name' => 'max_message_lngth',
|
||||
'config_value' => '500',
|
||||
),
|
||||
array(
|
||||
'config_name' => 'custom_page',
|
||||
'config_value' => '1',
|
||||
),
|
||||
array(
|
||||
'config_name' => 'date',
|
||||
'config_value' => 'D M d, Y g:i a',
|
||||
),
|
||||
array(
|
||||
'config_name' => 'whois',
|
||||
'config_value' => '0',
|
||||
),
|
||||
array(
|
||||
'config_name' => 'bbcode_disallowed',
|
||||
'config_value' => '',
|
||||
),
|
||||
array(
|
||||
'config_name' => 'prune_enable',
|
||||
'config_value' => '0',
|
||||
),
|
||||
array(
|
||||
'config_name' => 'prune_num',
|
||||
'config_value' => '0',
|
||||
),
|
||||
array(
|
||||
'config_name' => 'location',
|
||||
'config_value' => '1',
|
||||
),
|
||||
array(
|
||||
'config_name' => 'whois_refresh',
|
||||
'config_value' => '30',
|
||||
),
|
||||
array(
|
||||
'config_name' => 'static_message',
|
||||
'config_value' => '',
|
||||
),
|
||||
array(
|
||||
'config_name' => 'index_height',
|
||||
'config_value' => '250',
|
||||
),
|
||||
array(
|
||||
'config_name' => 'custom_height',
|
||||
'config_value' => '350',
|
||||
),
|
||||
array(
|
||||
'config_name' => 'override_min_post_chars',
|
||||
'config_value' => '0',
|
||||
),
|
||||
array(
|
||||
'config_name' => 'timeout',
|
||||
'config_value' => '0',
|
||||
),
|
||||
array(
|
||||
'config_name' => 'override_smilie_limit',
|
||||
'config_value' => '0',
|
||||
),
|
||||
array(
|
||||
'config_name' => 'pause_on_input',
|
||||
'config_value' => '0',
|
||||
),
|
||||
array(
|
||||
'config_name' => 'rules',
|
||||
'config_value' => '',
|
||||
),
|
||||
array(
|
||||
'config_name' => 'avatars',
|
||||
'config_value' => '0',
|
||||
),
|
||||
array(
|
||||
'config_name' => 'message_num',
|
||||
'config_value' => '10',
|
||||
),
|
||||
);
|
||||
|
||||
// Insert sample PM data
|
||||
$this->db->sql_multi_insert($this->table_prefix . 'mchat_config', $sample_data);
|
||||
}
|
||||
}
|
||||
36
migrations/mchat_schema_4.php
Normal file
36
migrations/mchat_schema_4.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package phpBB Extension - mChat
|
||||
* @copyright (c) 2015 dmzx - http://www.dmzx-web.net
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
namespace dmzx\mchat\migrations;
|
||||
|
||||
class mchat_schema_4 extends \phpbb\db\migration\migration
|
||||
{
|
||||
|
||||
static public function depends_on()
|
||||
{
|
||||
return array(
|
||||
'\dmzx\mchat\migrations\mchat_schema_3',
|
||||
);
|
||||
}
|
||||
public function update_schema()
|
||||
{
|
||||
return array(
|
||||
'add_columns' => array(
|
||||
$this->table_prefix . 'users' => array(
|
||||
'user_mchat_index' => array('BOOL', '1'),
|
||||
'user_mchat_sound' => array('BOOL', '1'),
|
||||
'user_mchat_stats_index' => array('BOOL', '1'),
|
||||
'user_mchat_topics' => array('BOOL', '1'),
|
||||
'user_mchat_avatars' => array('BOOL', '1'),
|
||||
'user_mchat_input_area' => array('BOOL', '1'),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
45
migrations/mchat_schema_5.php
Normal file
45
migrations/mchat_schema_5.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package phpBB Extension - mChat
|
||||
* @copyright (c) 2015 dmzx - http://www.dmzx-web.net
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
namespace dmzx\mchat\migrations;
|
||||
|
||||
class mchat_schema_5 extends \phpbb\db\migration\migration
|
||||
{
|
||||
|
||||
static public function depends_on()
|
||||
{
|
||||
return array(
|
||||
'\dmzx\mchat\migrations\mchat_schema_4',
|
||||
);
|
||||
}
|
||||
public function update_schema()
|
||||
{
|
||||
return array(
|
||||
'add_tables' => array(
|
||||
$this->table_prefix . 'mchat_sessions' => array(
|
||||
'COLUMNS' => array(
|
||||
'user_id' => array('UINT', 0),
|
||||
'user_lastupdate' => array('TIMESTAMP', 0),
|
||||
'user_ip' => array('VCHAR:40', ''),
|
||||
),
|
||||
'PRIMARY_KEY' => 'user_id',
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
public function revert_schema()
|
||||
{
|
||||
return array(
|
||||
'drop_tables' => array(
|
||||
$this->table_prefix . 'mchat_sessions',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
47
migrations/mchat_schema_6.php
Normal file
47
migrations/mchat_schema_6.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package phpBB Extension - mChat
|
||||
* @copyright (c) 2015 dmzx - http://www.dmzx-web.net
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
namespace dmzx\mchat\migrations;
|
||||
|
||||
class mchat_schema_6 extends \phpbb\db\migration\migration
|
||||
{
|
||||
|
||||
static public function depends_on()
|
||||
{
|
||||
return array(
|
||||
'\dmzx\mchat\migrations\mchat_schema_5',
|
||||
);
|
||||
}
|
||||
public function update_data()
|
||||
{
|
||||
return array(
|
||||
array('module.add', array('acp', 'ACP_CAT_USERS', array(
|
||||
'module_basename' => 'users',
|
||||
'module_enabled' => 1,
|
||||
'module_display' => 0,
|
||||
'module_langname' => 'ACP_USER_MCHAT',
|
||||
'module_mode' => 'mchat',
|
||||
'module_auth' => 'acl_a_user',
|
||||
),
|
||||
),
|
||||
// First, lets add a new category named UCP_CAT_MCHAT
|
||||
array('ucp', false, 'UCP_CAT_MCHAT'),
|
||||
|
||||
// next let's add our module
|
||||
array('ucp', 'UCP_CAT_MCHAT', array(
|
||||
'module_basename' => 'mchat',
|
||||
'modes' => array('configuration'),
|
||||
'module_auth' => 'u_mchat_use',
|
||||
),
|
||||
),
|
||||
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user