1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-04-08 18:05:17 +02:00

Merge pull request #4282 from CHItA/ticket/14584

[ticket/14548] Move deprecated globals and functions
This commit is contained in:
Marc Alexander 2016-08-07 21:02:17 +02:00
commit 5acb831f19
10 changed files with 119 additions and 116 deletions

View File

@ -18,6 +18,13 @@ if (!defined('IN_PHPBB'))
exit;
}
//
// Deprecated globals
//
define('ATTACHMENT_CATEGORY_WM', 2); // Windows Media Files - Streaming - @deprecated 3.2
define('ATTACHMENT_CATEGORY_RM', 3); // Real Media Files - Streaming - @deprecated 3.2
define('ATTACHMENT_CATEGORY_QUICKTIME', 6); // Quicktime/Mov files - @deprecated 3.2
/**
* Sets compatibility globals in the global scope
*

View File

@ -171,11 +171,8 @@ define('CONFIRM_REPORT', 4);
// Categories - Attachments
define('ATTACHMENT_CATEGORY_NONE', 0);
define('ATTACHMENT_CATEGORY_IMAGE', 1); // Inline Images
define('ATTACHMENT_CATEGORY_WM', 2); // Windows Media Files - Streaming - @deprecated 3.2
define('ATTACHMENT_CATEGORY_RM', 3); // Real Media Files - Streaming - @deprecated 3.2
define('ATTACHMENT_CATEGORY_THUMB', 4); // Not used within the database, only while displaying posts
define('ATTACHMENT_CATEGORY_FLASH', 5); // Flash/SWF files
define('ATTACHMENT_CATEGORY_QUICKTIME', 6); // Quicktime/Mov files - @deprecated 3.2
// BBCode UID length
define('BBCODE_UID_LEN', 8);

View File

@ -51,18 +51,6 @@ function phpbb_load_extensions_autoloaders($phpbb_root_path)
}
}
/**
* Casts a variable to the given type.
*
* @deprecated
*/
function set_var(&$result, $var, $type, $multibyte = false)
{
// no need for dependency injection here, if you have the object, call the method yourself!
$type_cast_helper = new \phpbb\request\type_cast_helper();
$type_cast_helper->set_var($result, $var, $type, $multibyte);
}
/**
* Generates an alphanumeric random string of given length
*

View File

@ -1122,28 +1122,6 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync =
return sizeof($post_ids);
}
/**
* Delete Attachments
*
* @deprecated 3.2.0-a1 (To be removed: 3.4.0)
*
* @param string $mode can be: post|message|topic|attach|user
* @param mixed $ids can be: post_ids, message_ids, topic_ids, attach_ids, user_ids
* @param bool $resync set this to false if you are deleting posts or topics
*/
function delete_attachments($mode, $ids, $resync = true)
{
global $phpbb_container;
/** @var \phpbb\attachment\manager $attachment_manager */
$attachment_manager = $phpbb_container->get('attachment.manager');
$num_deleted = $attachment_manager->delete($mode, $ids, $resync);
unset($attachment_manager);
return $num_deleted;
}
/**
* Deletes shadow topics pointing to a specified forum.
*
@ -1255,23 +1233,6 @@ function update_posted_info(&$topic_ids)
$db->sql_multi_insert(TOPICS_POSTED_TABLE, $sql_ary);
}
/**
* Delete attached file
*
* @deprecated 3.2.0-a1 (To be removed: 3.4.0)
*/
function phpbb_unlink($filename, $mode = 'file', $entry_removed = false)
{
global $phpbb_container;
/** @var \phpbb\attachment\manager $attachment_manager */
$attachment_manager = $phpbb_container->get('attachment.manager');
$unlink = $attachment_manager->unlink($filename, $mode, $entry_removed);
unset($attachment_manager);
return $unlink;
}
/**
* All-encompasing sync function
*

View File

@ -22,7 +22,7 @@ if (!defined('IN_PHPBB'))
/**
* Get user avatar
*
* @deprecated 3.1.0-a1 (To be removed: 3.3.0)
* @deprecated 3.1.0-a1 (To be removed: 4.0.0)
*
* @param string $avatar Users assigned avatar name
* @param int $avatar_type Type of avatar
@ -50,7 +50,7 @@ function get_user_avatar($avatar, $avatar_type, $avatar_width, $avatar_height, $
/**
* Hash the password
*
* @deprecated 3.1.0-a2 (To be removed: 3.3.0)
* @deprecated 3.1.0-a2 (To be removed: 4.0.0)
*
* @param string $password Password to be hashed
*
@ -68,7 +68,7 @@ function phpbb_hash($password)
/**
* Check for correct password
*
* @deprecated 3.1.0-a2 (To be removed: 3.3.0)
* @deprecated 3.1.0-a2 (To be removed: 4.0.0)
*
* @param string $password The password in plain text
* @param string $hash The stored password hash
@ -92,7 +92,7 @@ function phpbb_check_hash($password, $hash)
* @param string $path Path to clean
* @return string Cleaned path
*
* @deprecated 3.1.0 (To be removed: 3.3.0)
* @deprecated 3.1.0 (To be removed: 4.0.0)
*/
function phpbb_clean_path($path)
{
@ -136,7 +136,7 @@ function phpbb_clean_path($path)
*
* @return string Returns the options for timezone selector only
*
* @deprecated 3.1.0 (To be removed: 3.3.0)
* @deprecated 3.1.0 (To be removed: 4.0.0)
*/
function tz_select($default = '', $truncate = false)
{
@ -150,7 +150,7 @@ function tz_select($default = '', $truncate = false)
* via admin_permissions. Changes of usernames and group names
* must be carried through for the moderators table.
*
* @deprecated 3.1.0 (To be removed: 3.3.0)
* @deprecated 3.1.0 (To be removed: 4.0.0)
* @return null
*/
function cache_moderators()
@ -162,7 +162,7 @@ function cache_moderators()
/**
* Removes moderators and administrators from foe lists.
*
* @deprecated 3.1.0 (To be removed: 3.3.0)
* @deprecated 3.1.0 (To be removed: 4.0.0)
* @param array|bool $group_id If an array, remove all members of this group from foe lists, or false to ignore
* @param array|bool $user_id If an array, remove this user from foe lists, or false to ignore
* @return null
@ -182,7 +182,7 @@ function update_foes($group_id = false, $user_id = false)
* @param string &$rank_img the rank image as full img tag is stored here after execution
* @param string &$rank_img_src the rank image source is stored here after execution
*
* @deprecated 3.1.0-RC5 (To be removed: 3.3.0)
* @deprecated 3.1.0-RC5 (To be removed: 4.0.0)
*
* Note: since we do not want to break backwards-compatibility, this function will only properly assign ranks to guests if you call it for them with user_posts == false
*/
@ -232,7 +232,7 @@ function get_remote_file($host, $directory, $filename, &$errstr, &$errno, $port
*
* @return int|bool Returns the log_id, if the entry was added to the database, false otherwise.
*
* @deprecated 3.1.0 (To be removed: 3.3.0)
* @deprecated 3.1.0 (To be removed: 4.0.0)
*/
function add_log()
{
@ -280,7 +280,7 @@ function add_log()
*
* @return null
*
* @deprecated 3.1.0 (To be removed: 3.3.0)
* @deprecated 3.1.0 (To be removed: 4.0.0)
*/
function set_config($config_name, $config_value, $is_dynamic = false, \phpbb\config\config $set_config = null)
{
@ -310,7 +310,7 @@ function set_config($config_name, $config_value, $is_dynamic = false, \phpbb\con
*
* @return null
*
* @deprecated 3.1.0 (To be removed: 3.3.0)
* @deprecated 3.1.0 (To be removed: 4.0.0)
*/
function set_config_count($config_name, $increment, $is_dynamic = false, \phpbb\config\config $set_config = null)
{
@ -331,7 +331,7 @@ function set_config_count($config_name, $increment, $is_dynamic = false, \phpbb\
* See {@link \phpbb\request\request_interface::variable \phpbb\request\request_interface::variable} for
* documentation of this function's use.
*
* @deprecated 3.1.0 (To be removed: 3.3.0)
* @deprecated 3.1.0 (To be removed: 4.0.0)
* @param mixed $var_name The form variable's name from which data shall be retrieved.
* If the value is an array this may be an array of indizes which will give
* direct access to a value at any depth. E.g. if the value of "var" is array(1 => "a")
@ -389,7 +389,7 @@ function request_var($var_name, $default, $multibyte = false, $cookie = false, $
/**
* Get tables of a database
*
* @deprecated 3.1.0 (To be removed: 3.3.0)
* @deprecated 3.1.0 (To be removed: 4.0.0)
*/
function get_tables(&$db)
{
@ -492,7 +492,7 @@ function phpbb_realpath($path)
* @param $number int|float The number we want to get the plural case for. Float numbers are floored.
* @return int The plural-case we need to use for the number plural-rule combination
*
* @deprecated 3.2.0-dev (To be removed: 3.3.0)
* @deprecated 3.2.0-dev (To be removed: 4.0.0)
*/
function phpbb_get_plural_form($rule, $number)
{
@ -511,3 +511,93 @@ function phpbb_pcre_utf8_support()
{
return true;
}
/**
* Casts a variable to the given type.
*
* @deprecated 3.1 (To be removed 4.0.0)
*/
function set_var(&$result, $var, $type, $multibyte = false)
{
// no need for dependency injection here, if you have the object, call the method yourself!
$type_cast_helper = new \phpbb\request\type_cast_helper();
$type_cast_helper->set_var($result, $var, $type, $multibyte);
}
/**
* Delete Attachments
*
* @deprecated 3.2.0-a1 (To be removed: 4.0.0)
*
* @param string $mode can be: post|message|topic|attach|user
* @param mixed $ids can be: post_ids, message_ids, topic_ids, attach_ids, user_ids
* @param bool $resync set this to false if you are deleting posts or topics
*/
function delete_attachments($mode, $ids, $resync = true)
{
global $phpbb_container;
/** @var \phpbb\attachment\manager $attachment_manager */
$attachment_manager = $phpbb_container->get('attachment.manager');
$num_deleted = $attachment_manager->delete($mode, $ids, $resync);
unset($attachment_manager);
return $num_deleted;
}
/**
* Delete attached file
*
* @deprecated 3.2.0-a1 (To be removed: 4.0.0)
*/
function phpbb_unlink($filename, $mode = 'file', $entry_removed = false)
{
global $phpbb_container;
/** @var \phpbb\attachment\manager $attachment_manager */
$attachment_manager = $phpbb_container->get('attachment.manager');
$unlink = $attachment_manager->unlink($filename, $mode, $entry_removed);
unset($attachment_manager);
return $unlink;
}
/**
* Display reasons
*
* @deprecated 3.2.0-dev (To be removed: 4.0.0)
*/
function display_reasons($reason_id = 0)
{
global $phpbb_container;
$phpbb_container->get('phpbb.report.report_reason_list_provider')->display_reasons($reason_id);
}
/**
* Upload Attachment - filedata is generated here
* Uses upload class
*
* @deprecated 3.2.0-a1 (To be removed: 4.0.0)
*
* @param string $form_name The form name of the file upload input
* @param int $forum_id The id of the forum
* @param bool $local Whether the file is local or not
* @param string $local_storage The path to the local file
* @param bool $is_message Whether it is a PM or not
* @param array $local_filedata A filespec object created for the local file
*
* @return array File data array
*/
function upload_attachment($form_name, $forum_id, $local = false, $local_storage = '', $is_message = false, $local_filedata = false)
{
global $phpbb_container;
/** @var \phpbb\attachment\manager $attachment_manager */
$attachment_manager = $phpbb_container->get('attachment.manager');
$file = $attachment_manager->upload($form_name, $forum_id, $local, $local_storage, $is_message, $local_filedata);
unset($attachment_manager);
return $file;
}

View File

@ -1145,18 +1145,6 @@ function display_custom_bbcodes()
$phpbb_dispatcher->dispatch('core.display_custom_bbcodes');
}
/**
* Display reasons
*
* @deprecated 3.2.0-dev
*/
function display_reasons($reason_id = 0)
{
global $phpbb_container;
$phpbb_container->get('phpbb.report.report_reason_list_provider')->display_reasons($reason_id);
}
/**
* Display user activity (action forum/topic)
*/

View File

@ -386,34 +386,6 @@ function posting_gen_topic_types($forum_id, $cur_topic_type = POST_NORMAL)
//
// Attachment related functions
//
/**
* Upload Attachment - filedata is generated here
* Uses upload class
*
* @deprecated 3.2.0-a1 (To be removed: 3.4.0)
*
* @param string $form_name The form name of the file upload input
* @param int $forum_id The id of the forum
* @param bool $local Whether the file is local or not
* @param string $local_storage The path to the local file
* @param bool $is_message Whether it is a PM or not
* @param array $local_filedata A filespec object created for the local file
*
* @return array File data array
*/
function upload_attachment($form_name, $forum_id, $local = false, $local_storage = '', $is_message = false, $local_filedata = false)
{
global $phpbb_container;
/** @var \phpbb\attachment\manager $attachment_manager */
$attachment_manager = $phpbb_container->get('attachment.manager');
$file = $attachment_manager->upload($form_name, $forum_id, $local, $local_storage, $is_message, $local_filedata);
unset($attachment_manager);
return $file;
}
/**
* Calculate the needed size for Thumbnail
*/

View File

@ -121,7 +121,7 @@ class helper
* @param int $code The error code (e.g. 404, 500, 503, etc.)
* @return Response A Response instance
*
* @deprecated 3.1.3 (To be removed: 3.3.0) Use exceptions instead.
* @deprecated 3.1.3 (To be removed: 4.0.0) Use exceptions instead.
*/
public function error($message, $code = 500)
{

View File

@ -14,7 +14,7 @@
namespace phpbb;
/**
* @deprecated 3.2.0-dev (To be removed 3.3.0) use \phpbb\filesystem\filesystem instead
* @deprecated 3.2.0-dev (To be removed 4.0.0) use \phpbb\filesystem\filesystem instead
*/
class filesystem extends \phpbb\filesystem\filesystem
{

View File

@ -461,7 +461,7 @@ class user extends \phpbb\session
* @return int|bool The plural-case we need to use for the number plural-rule combination, false if $force_rule
* was invalid.
*
* @deprecated: 3.2.0-dev (To be removed: 3.3.0)
* @deprecated: 3.2.0-dev (To be removed: 4.0.0)
*/
function get_plural_form($number, $force_rule = false)
{
@ -472,8 +472,8 @@ class user extends \phpbb\session
* Add Language Items - use_db and use_help are assigned where needed (only use them to force inclusion)
*
* @param mixed $lang_set specifies the language entries to include
* @param bool $use_db internal variable for recursion, do not use @deprecated 3.2.0-dev (To be removed: 3.3.0)
* @param bool $use_help internal variable for recursion, do not use @deprecated 3.2.0-dev (To be removed: 3.3.0)
* @param bool $use_db internal variable for recursion, do not use @deprecated 3.2.0-dev (To be removed: 4.0.0)
* @param bool $use_help internal variable for recursion, do not use @deprecated 3.2.0-dev (To be removed: 4.0.0)
* @param string $ext_name The extension to load language from, or empty for core files
*
* Examples:
@ -488,7 +488,7 @@ class user extends \phpbb\session
* Note: $use_db and $use_help should be removed. The old function was kept for BC purposes,
* so the BC logic is handled here.
*
* @deprecated: 3.2.0-dev (To be removed: 3.3.0)
* @deprecated: 3.2.0-dev (To be removed: 4.0.0)
*/
function add_lang($lang_set, $use_db = false, $use_help = false, $ext_name = '')
{
@ -529,7 +529,7 @@ class user extends \phpbb\session
/**
* BC function for loading language files
*
* @deprecated 3.2.0-dev (To be removed: 3.3.0)
* @deprecated 3.2.0-dev (To be removed: 4.0.0)
*/
private function set_lang($lang_set, $use_help, $ext_name)
{
@ -565,7 +565,7 @@ class user extends \phpbb\session
*
* Note: $use_db and $use_help should be removed. Kept for BC purposes.
*
* @deprecated: 3.2.0-dev (To be removed: 3.3.0)
* @deprecated: 3.2.0-dev (To be removed: 4.0.0)
*/
function add_lang_ext($ext_name, $lang_set, $use_db = false, $use_help = false)
{