[ticket/346] Use phpBB log class instead of add_log()
B3P-346
This commit is contained in:
@@ -15,13 +15,13 @@ class portal_module
|
||||
public $new_config = array();
|
||||
protected $c_class;
|
||||
protected $db, $user, $cache, $template, $display_vars, $config, $phpbb_root_path, $phpbb_admin_path, $phpEx, $phpbb_container;
|
||||
protected $root_path, $version_check, $request, $php_ext, $portal_helper, $modules_helper;
|
||||
protected $root_path, $version_check, $request, $php_ext, $portal_helper, $modules_helper, $log;
|
||||
public $module_column = array();
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
global $db, $user, $cache, $request, $template, $table_prefix;
|
||||
global $config, $phpbb_root_path, $phpbb_admin_path, $phpbb_container, $phpEx;
|
||||
global $config, $phpbb_root_path, $phpbb_admin_path, $phpbb_container, $phpEx, $phpbb_log;
|
||||
|
||||
$user->add_lang_ext('board3/portal', array('portal', 'portal_acp'));
|
||||
|
||||
@@ -42,6 +42,7 @@ class portal_module
|
||||
$this->version_check = $this->phpbb_container->get('board3.version.check');
|
||||
$this->portal_helper = $this->phpbb_container->get('board3.portal.helper');
|
||||
$this->modules_helper = $this->phpbb_container->get('board3.portal.modules_helper');
|
||||
$this->log = $phpbb_log;
|
||||
define('PORTAL_MODULES_TABLE', $this->phpbb_container->getParameter('board3.modules.table'));
|
||||
define('PORTAL_CONFIG_TABLE', $this->phpbb_container->getParameter('board3.config.table'));
|
||||
|
||||
@@ -269,12 +270,12 @@ class portal_module
|
||||
{
|
||||
if (isset($module_data) && $module_data['module_classname'] !== '\board3\portal\modules\custom')
|
||||
{
|
||||
add_log('admin', 'LOG_PORTAL_CONFIG', $module_name);
|
||||
$this->log->add('admin', $this->user->data['user_id'], $this->user->data['user_ip'], 'LOG_PORTAL_CONFIG', false, array($module_name));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
add_log('admin', 'LOG_PORTAL_CONFIG', $this->user->lang['ACP_PORTAL_' . strtoupper($mode) . '_INFO']);
|
||||
$this->log->add('admin', $this->user->data['user_id'], $this->user->data['user_ip'], 'LOG_PORTAL_CONFIG', false, array($this->user->lang['ACP_PORTAL_' . strtoupper($mode) . '_INFO']));
|
||||
}
|
||||
trigger_error($this->user->lang['CONFIG_UPDATED'] . ((!empty($img_error) ? '<br /><br />' . $this->user->lang['MODULE_IMAGE_ERROR'] . '<br />' . $img_error : '')) . adm_back_link(($module_id) ? append_sid("{$this->phpbb_root_path}adm/index.{$this->php_ext}", 'i=\board3\portal\acp\portal_module&mode=modules') : $this->u_action));
|
||||
}
|
||||
|
||||
@@ -53,6 +53,7 @@ services:
|
||||
- %core.php_ext%
|
||||
- @user
|
||||
- @path_helper
|
||||
- @log
|
||||
tags:
|
||||
- { name: board3.module }
|
||||
|
||||
@@ -71,6 +72,7 @@ services:
|
||||
- %core.root_path%
|
||||
- %core.php_ext%
|
||||
- @user
|
||||
- @log
|
||||
tags:
|
||||
- { name: board3.module }
|
||||
|
||||
@@ -158,6 +160,7 @@ services:
|
||||
- %core.root_path%
|
||||
- %core.php_ext%
|
||||
- @user
|
||||
- @log
|
||||
tags:
|
||||
- { name: board3.module }
|
||||
|
||||
@@ -171,6 +174,7 @@ services:
|
||||
- %core.root_path%
|
||||
- %core.php_ext%
|
||||
- @user
|
||||
- @log
|
||||
tags:
|
||||
- { name: board3.module }
|
||||
|
||||
|
||||
@@ -112,6 +112,9 @@ class calendar extends module_base
|
||||
/** @var string Portal root path */
|
||||
protected $portal_root_path;
|
||||
|
||||
/** @var \phpbb\log\log phpBB log */
|
||||
protected $log;
|
||||
|
||||
/**
|
||||
* Construct a calendar object
|
||||
*
|
||||
@@ -123,8 +126,9 @@ class calendar extends module_base
|
||||
* @param string $phpbb_root_path phpBB root path
|
||||
* @param \phpbb\user $user phpBB user object
|
||||
* @param \phpbb\path_helper $path_helper phpBB path helper
|
||||
* @param \phpbb\log\log $log phpBB log object
|
||||
*/
|
||||
public function __construct($config, $template, $db, $request, $phpbb_root_path, $phpEx, $user, $path_helper)
|
||||
public function __construct($config, $template, $db, $request, $phpbb_root_path, $phpEx, $user, $path_helper, $log)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->template = $template;
|
||||
@@ -134,6 +138,7 @@ class calendar extends module_base
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->user = $user;
|
||||
$this->path_helper = $path_helper;
|
||||
$this->log = $log;
|
||||
$this->portal_root_path = $this->path_helper->get_web_root_path() . $this->phpbb_root_path . 'ext/board3/portal/';
|
||||
}
|
||||
|
||||
@@ -497,7 +502,7 @@ class calendar extends module_base
|
||||
'url' => htmlspecialchars_decode($event_url),
|
||||
);
|
||||
|
||||
add_log('admin', 'LOG_PORTAL_EVENT_UPDATED', $event_title);
|
||||
$this->log->add('admin', $this->user->data['user_id'], $this->user->data['user_ip'], 'LOG_PORTAL_EVENT_UPDATED', false, array($event_title));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -512,7 +517,7 @@ class calendar extends module_base
|
||||
'permission' => $event_permission,
|
||||
'url' => $event_url, // optional
|
||||
);
|
||||
add_log('admin', 'LOG_PORTAL_EVENT_ADDED', $event_title);
|
||||
$this->log->add('admin', $this->user->data['user_id'], $this->user->data['user_ip'], 'LOG_PORTAL_EVENT_ADDED', false, array($event_title));
|
||||
}
|
||||
|
||||
// we sort the $events array by the start time
|
||||
@@ -546,7 +551,7 @@ class calendar extends module_base
|
||||
$board3_events_array = serialize($events);
|
||||
set_portal_config('board3_calendar_events_' . $module_id, $board3_events_array);
|
||||
|
||||
add_log('admin', 'LOG_PORTAL_EVENT_REMOVED', $cur_event_title);
|
||||
$this->log->add('admin', $this->user->data['user_id'], $this->user->data['user_ip'], 'LOG_PORTAL_EVENT_REMOVED', false, array($cur_event_title));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -68,6 +68,9 @@ class custom extends module_base
|
||||
/** @var \phpbb\user */
|
||||
protected $user;
|
||||
|
||||
/** @var \phpbb\log\log phpBB log*/
|
||||
protected $log;
|
||||
|
||||
/**
|
||||
* Construct a custom module object
|
||||
*
|
||||
@@ -78,8 +81,9 @@ class custom extends module_base
|
||||
* @param string $phpEx php file extension
|
||||
* @param string $phpbb_root_path phpBB root path
|
||||
* @param \phpbb\user $user phpBB user object
|
||||
* @param \phpbb\log\log $log phpBB log
|
||||
*/
|
||||
public function __construct($config, $template, $db, $request, $phpbb_root_path, $phpEx, $user)
|
||||
public function __construct($config, $template, $db, $request, $phpbb_root_path, $phpEx, $user, $log)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->template = $template;
|
||||
@@ -88,6 +92,7 @@ class custom extends module_base
|
||||
$this->php_ext = $phpEx;
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->user = $user;
|
||||
$this->log = $log;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -232,7 +237,7 @@ class custom extends module_base
|
||||
$log_title = $custom_title;
|
||||
}
|
||||
|
||||
add_log('admin', 'LOG_PORTAL_CONFIG', $this->user->lang['PORTAL_CUSTOM'] . ': ' . $log_title);
|
||||
$this->log->add('admin', $this->user->data['user_id'], $this->user->data['user_ip'], 'LOG_PORTAL_CONFIG', false, array($this->user->lang['PORTAL_CUSTOM'] . ': ' . $log_title));
|
||||
|
||||
// set_portal_config will take care of escaping the welcome message
|
||||
set_portal_config('board3_custom_' . $module_id . '_code', $custom_code);
|
||||
|
||||
@@ -74,6 +74,9 @@ class links extends module_base
|
||||
/** @var \phpbb\user */
|
||||
protected $user;
|
||||
|
||||
/** @var \phpbb\log\log phpBB log */
|
||||
protected $log;
|
||||
|
||||
/**
|
||||
* Construct a links object
|
||||
*
|
||||
@@ -84,8 +87,9 @@ class links extends module_base
|
||||
* @param string $phpEx php file extension
|
||||
* @param string $phpbb_root_path phpBB root path
|
||||
* @param \phpbb\user $user phpBB user object
|
||||
* @param \phpbb\log\log phpBB log
|
||||
*/
|
||||
public function __construct($config, $db, $request, $template, $phpbb_root_path, $phpEx, $user)
|
||||
public function __construct($config, $db, $request, $template, $phpbb_root_path, $phpEx, $user, $log)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->db = $db;
|
||||
@@ -94,6 +98,7 @@ class links extends module_base
|
||||
$this->php_ext = $phpEx;
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->user = $user;
|
||||
$this->log = $log;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -297,7 +302,7 @@ class links extends module_base
|
||||
'permission' => $link_permissions,
|
||||
);
|
||||
|
||||
add_log('admin', 'LOG_PORTAL_LINK_UPDATED', $link_title);
|
||||
$this->log->add('admin', $this->user->data['user_id'], $this->user->data['user_ip'], 'LOG_PORTAL_LINK_UPDATED', false, array($link_title));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -309,7 +314,7 @@ class links extends module_base
|
||||
'type' => $link_type,
|
||||
'permission' => $link_permissions,
|
||||
);
|
||||
add_log('admin', 'LOG_PORTAL_LINK_ADDED', $link_title);
|
||||
$this->log->add('admin', $this->user->data['user_id'], $this->user->data['user_ip'],'LOG_PORTAL_LINK_ADDED', false, array($link_title));
|
||||
}
|
||||
|
||||
$board3_links_array = serialize($links);
|
||||
@@ -337,7 +342,7 @@ class links extends module_base
|
||||
$board3_links_array = serialize($links);
|
||||
set_portal_config('board3_links_array_' . $module_id, $board3_links_array);
|
||||
|
||||
add_log('admin', 'LOG_PORTAL_LINK_REMOVED', $cur_link_title);
|
||||
$this->log->add('admin', $this->user->data['user_id'], $this->user->data['user_ip'], 'LOG_PORTAL_LINK_REMOVED', false, array($cur_link_title));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -75,6 +75,9 @@ class main_menu extends module_base
|
||||
/** @var \phpbb\user */
|
||||
protected $user;
|
||||
|
||||
/** @var \phpbb\log\log phpBB log */
|
||||
protected $log;
|
||||
|
||||
/**
|
||||
* Construct a main menu object
|
||||
*
|
||||
@@ -85,8 +88,9 @@ class main_menu extends module_base
|
||||
* @param string $phpbb_root_path phpBB root path
|
||||
* @param string $phpEx php file extension
|
||||
* @param \phpbb\user $user phpBB user object
|
||||
* @param \phpbb\log\log $log phpBB log
|
||||
*/
|
||||
public function __construct($config, $db, $request, $template, $phpbb_root_path, $phpEx, $user)
|
||||
public function __construct($config, $db, $request, $template, $phpbb_root_path, $phpEx, $user, $log)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->db = $db;
|
||||
@@ -95,6 +99,7 @@ class main_menu extends module_base
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->php_ext = $phpEx;
|
||||
$this->user = $user;
|
||||
$this->log = $log;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -353,7 +358,7 @@ class main_menu extends module_base
|
||||
'permission' => $link_permissions,
|
||||
);
|
||||
|
||||
add_log('admin', 'LOG_PORTAL_LINK_UPDATED', $link_title);
|
||||
$this->log->add('admin', $this->user->data['user_id'], $this->user->data['user_ip'], 'LOG_PORTAL_LINK_UPDATED', false, array($link_title));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -369,7 +374,7 @@ class main_menu extends module_base
|
||||
'type' => $link_type,
|
||||
'permission' => $link_permissions,
|
||||
);
|
||||
add_log('admin', 'LOG_PORTAL_LINK_ADDED', $link_title);
|
||||
$this->log->add('admin', $this->user->data['user_id'], $this->user->data['user_ip'], 'LOG_PORTAL_LINK_ADDED', false, array($link_title));
|
||||
}
|
||||
|
||||
$board3_menu_array = serialize($links);
|
||||
@@ -397,7 +402,7 @@ class main_menu extends module_base
|
||||
$board3_menu_array = serialize($links);
|
||||
set_portal_config('board3_menu_array_' . $module_id, $board3_menu_array);
|
||||
|
||||
add_log('admin', 'LOG_PORTAL_LINK_REMOVED', $cur_link_title);
|
||||
$this->log->add('admin', $this->user->data['user_id'], $this->user->data['user_ip'], 'LOG_PORTAL_LINK_REMOVED', false, array($cur_link_title));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -40,7 +40,7 @@ class phpbb_unit_modules_calendar_test extends \board3\portal\tests\testframewor
|
||||
'php'
|
||||
);
|
||||
self::$config = new \phpbb\config\config(array());
|
||||
$this->calendar = new \board3\portal\modules\calendar(self::$config, null, null, null, dirname(__FILE__) . '/../../../', 'php', null, $this->path_helper);
|
||||
$this->calendar = new \board3\portal\modules\calendar(self::$config, null, null, null, dirname(__FILE__) . '/../../../', 'php', null, $this->path_helper, null);
|
||||
define('PORTAL_MODULES_TABLE', 'phpbb_portal_modules');
|
||||
define('PORTAL_CONFIG_TABLE', 'phpbb_portal_config');
|
||||
$cache = $this->getMock('\phpbb\cache\cache', array('destroy', 'sql_exists', 'get', 'put'));
|
||||
|
||||
Reference in New Issue
Block a user