mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-14 18:48:21 -07:00
PHP 7+ deprecations of old cache systems
Signed-off-by: Yuriy Pikhtarev <iglix@me.com>
This commit is contained in:
parent
1296f58f8c
commit
a4845b4514
14 changed files with 39 additions and 476 deletions
|
@ -11,18 +11,6 @@
|
|||
* All Attachment Functions needed everywhere
|
||||
*/
|
||||
|
||||
/**
|
||||
* html_entity_decode replacement (from php manual)
|
||||
*/
|
||||
if (!function_exists('html_entity_decode')) {
|
||||
function html_entity_decode($given_html, $quote_style = ENT_QUOTES)
|
||||
{
|
||||
$trans_table = array_flip(get_html_translation_table(HTML_SPECIALCHARS, $quote_style));
|
||||
$trans_table['''] = "'";
|
||||
return (strtr($given_html, $trans_table));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A simple dectobase64 function
|
||||
*/
|
||||
|
|
|
@ -55,7 +55,7 @@ $bb_cfg['db_alias'] = [
|
|||
$bb_cfg['cache'] = [
|
||||
'pconnect' => true,
|
||||
'db_dir' => realpath(BB_ROOT) . '/internal_data/cache/filecache/',
|
||||
'prefix' => 'tp_', // Префикс кеша ('tp_')
|
||||
'prefix' => 'tp_',
|
||||
'memcache' => [
|
||||
'host' => '127.0.0.1',
|
||||
'port' => 11211,
|
||||
|
@ -67,7 +67,7 @@ $bb_cfg['cache'] = [
|
|||
'port' => 6379,
|
||||
'con_required' => true,
|
||||
],
|
||||
// Available cache types: memcache, sqlite, redis, apc, xcache (default of filecache)
|
||||
// Available cache types: memcache, sqlite, redis, (filecache by default)
|
||||
'engines' => [
|
||||
'bb_cache' => ['filecache', []],
|
||||
'bb_config' => ['filecache', []],
|
||||
|
@ -80,12 +80,12 @@ $bb_cfg['cache'] = [
|
|||
];
|
||||
|
||||
// Datastore
|
||||
// Available datastore types: memcache, sqlite, redis, apc, xcache (default filecache)
|
||||
// Available datastore types: memcache, sqlite, redis (filecache by default)
|
||||
$bb_cfg['datastore_type'] = 'filecache';
|
||||
|
||||
// Server
|
||||
$bb_cfg['server_name'] = $domain_name; // The domain name from which this board runs
|
||||
$bb_cfg['server_port'] = (!empty($_SERVER['SERVER_PORT'])) ? $_SERVER['SERVER_PORT'] : 80; // The port your server is running on
|
||||
$bb_cfg['server_port'] = !empty($_SERVER['SERVER_PORT']) ? $_SERVER['SERVER_PORT'] : 80; // The port your server is running on
|
||||
$bb_cfg['script_path'] = '/'; // The path where FORUM is located relative to the domain name
|
||||
|
||||
// GZip
|
||||
|
@ -494,7 +494,7 @@ $bb_cfg['group_members_per_page'] = 50;
|
|||
$bb_cfg['tidy_post'] = (!in_array('tidy', get_loaded_extensions(), true)) ? false : true;
|
||||
|
||||
// Misc
|
||||
$bb_cfg['mem_on_start'] = MEM_USAGE ? memory_get_usage() : 0;
|
||||
$bb_cfg['mem_on_start'] = memory_get_usage();
|
||||
$bb_cfg['translate_dates'] = true; // in displaying time
|
||||
$bb_cfg['use_word_censor'] = true;
|
||||
|
||||
|
|
|
@ -75,9 +75,6 @@ define('BB_DISABLED', TRIGGERS_DIR . '/$off');
|
|||
define('CRON_ALLOWED', TRIGGERS_DIR . '/cron_allowed');
|
||||
define('CRON_RUNNING', TRIGGERS_DIR . '/cron_running');
|
||||
|
||||
// Misc
|
||||
define('MEM_USAGE', function_exists('memory_get_usage'));
|
||||
|
||||
// Gzip
|
||||
define('GZIP_OUTPUT_ALLOWED', extension_loaded('zlib') && !ini_get('zlib.output_compression'));
|
||||
define('UA_GZIP_SUPPORTED', isset($_SERVER['HTTP_ACCEPT_ENCODING']) && strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false);
|
||||
|
|
|
@ -1475,98 +1475,6 @@ function topic_attachment_image($switch_attachment)
|
|||
return '<img src="styles/images/icon_clip.gif" alt="" border="0" /> ';
|
||||
}
|
||||
|
||||
/**
|
||||
* array_combine()
|
||||
*
|
||||
* @package PHP_Compat
|
||||
* @link http://php.net/function.array_combine
|
||||
* @author Aidan Lister <aidan@php.net>
|
||||
* @version $Revision: 1.21 $
|
||||
* @since PHP 5
|
||||
*/
|
||||
if (!function_exists('array_combine')) {
|
||||
function array_combine($keys, $values)
|
||||
{
|
||||
if (!is_array($keys)) {
|
||||
user_error('array_combine() expects parameter 1 to be array, ' .
|
||||
gettype($keys) . ' given', E_USER_WARNING);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!is_array($values)) {
|
||||
user_error('array_combine() expects parameter 2 to be array, ' .
|
||||
gettype($values) . ' given', E_USER_WARNING);
|
||||
return;
|
||||
}
|
||||
|
||||
$key_count = count($keys);
|
||||
$value_count = count($values);
|
||||
if ($key_count !== $value_count) {
|
||||
user_error('array_combine() both parameters should have equal number of elements', E_USER_WARNING);
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($key_count === 0 || $value_count === 0) {
|
||||
user_error('array_combine() both parameters should have number of elements at least 0', E_USER_WARNING);
|
||||
return false;
|
||||
}
|
||||
|
||||
$keys = array_values($keys);
|
||||
$values = array_values($values);
|
||||
|
||||
$combined = array();
|
||||
for ($i = 0; $i < $key_count; $i++) {
|
||||
$combined[$keys[$i]] = $values[$i];
|
||||
}
|
||||
|
||||
return $combined;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* array_intersect_key()
|
||||
*
|
||||
* @package PHP_Compat
|
||||
* @link http://php.net/function.array_intersect_key
|
||||
* @author Tom Buskens <ortega@php.net>
|
||||
* @version $Revision: 1.4 $
|
||||
* @since PHP 5.0.2
|
||||
*/
|
||||
if (!function_exists('array_intersect_key')) {
|
||||
function array_intersect_key()
|
||||
{
|
||||
$args = func_get_args();
|
||||
if (count($args) < 2) {
|
||||
user_error('Wrong parameter count for array_intersect_key()', E_USER_WARNING);
|
||||
return;
|
||||
}
|
||||
|
||||
// Check arrays
|
||||
$array_count = count($args);
|
||||
foreach ($args as $i => $iValue) {
|
||||
if (!is_array($args[$i])) {
|
||||
user_error('array_intersect_key() Argument #' .
|
||||
($i + 1) . ' is not an array', E_USER_WARNING);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Compare entries
|
||||
$result = array();
|
||||
foreach ($args[0] as $key1 => $value1) {
|
||||
for ($i = 1; $i !== $array_count; $i++) {
|
||||
foreach ($args[$i] as $key2 => $value2) {
|
||||
if ((string)$key1 === (string)$key2) {
|
||||
$result[$key1] = $value1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
function clear_dl_list($topics_csv)
|
||||
{
|
||||
DB()->query("DELETE FROM " . BB_BT_DLSTATUS . " WHERE topic_id IN($topics_csv)");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue