From 14f691992baf35173a581f1f0f228f595555de86 Mon Sep 17 00:00:00 2001 From: glix08 Date: Fri, 26 Jul 2013 21:49:31 +0000 Subject: [PATCH] r516 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Выпиливание неподдерживаемых типов баз данных из аттач-мода. Логирование отработки сборщика мусора, логирование отвалившейся базы. git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@516 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293 --- upload/ajax.php | 36 +++++++++---------- .../attach_mod/includes/functions_attach.php | 26 ++++---------- upload/config.php | 2 +- upload/includes/cron/jobs/cache_gc.php | 2 +- upload/includes/cron/jobs/tr_maintenance.php | 8 ----- upload/includes/db/mysql.php | 1 + .../includes/report_hack/report_privmsg.php | 10 +----- 7 files changed, 28 insertions(+), 57 deletions(-) diff --git a/upload/ajax.php b/upload/ajax.php index 307bed6e3..7fcc56dea 100644 --- a/upload/ajax.php +++ b/upload/ajax.php @@ -76,8 +76,8 @@ class ajax_common 'manage_user' => array('admin'), 'mod_action' => array('mod'), - 'topic_tpl' => array('mod'), - 'group_membership' => array('mod'), + 'topic_tpl' => array('mod'), + 'group_membership' => array('mod'), 'post_mod_comment' => array('mod'), 'gen_passkey' => array('user'), @@ -284,7 +284,7 @@ class ajax_common $this->send(); } - /** + /** * Verify mod rights */ function verify_mod_rights ($forum_id) @@ -301,7 +301,7 @@ class ajax_common function edit_user_profile () { - require(AJAX_DIR .'edit_user_profile.php'); + require(AJAX_DIR .'edit_user_profile.php'); } function change_user_rank () @@ -327,7 +327,7 @@ class ajax_common $this->response['html'] = ($rank_id != 0) ? $lang['AWARDED_RANK'] . ' '. $ranks[$rank_id]['rank_title'] .'' : $lang['SHOT_RANK']; } - function change_user_opt () + function change_user_opt () { global $bf, $lang; @@ -353,8 +353,8 @@ class ajax_common DB()->query("UPDATE ". BB_USERS ." SET user_opt = {$u_data['user_opt']} WHERE user_id = $user_id LIMIT 1"); - // Удаляем данные из кеша - cache_rm_user_sessions ($user_id); + // Удаляем данные из кеша + cache_rm_user_sessions ($user_id); $this->response['resp_html'] = $lang['SAVED']; } @@ -382,7 +382,7 @@ class ajax_common else $this->ajax_die($lang['NOT_AUTHORISED']); } - // User groups membership + // User groups membership function group_membership () { global $lang, $user; @@ -497,19 +497,19 @@ class ajax_common } function user_register() - { + { require(AJAX_DIR .'user_register.php'); - } + } - function mod_action() - { + function mod_action() + { require(AJAX_DIR .'mod_action.php'); - } + } - function posts() - { + function posts() + { require(AJAX_DIR .'posts.php'); - } + } function manage_user() { @@ -522,7 +522,7 @@ class ajax_common } function index_data() - { + { require(AJAX_DIR .'index_data.php'); } @@ -569,4 +569,4 @@ class ajax_common { require(AJAX_DIR .'view_profile.php'); } -} +} \ No newline at end of file diff --git a/upload/attach_mod/includes/functions_attach.php b/upload/attach_mod/includes/functions_attach.php index adde11971..6e88babe1 100644 --- a/upload/attach_mod/includes/functions_attach.php +++ b/upload/attach_mod/includes/functions_attach.php @@ -768,27 +768,13 @@ function get_var($var_name, $default, $multibyte = false) */ function attach_mod_sql_escape($text) { - switch (SQL_LAYER) + if (function_exists('mysql_real_escape_string')) { - case 'postgresql': - return pg_escape_string($text); - break; - - case 'mysql': - case 'mysql4': - if (function_exists('mysql_real_escape_string')) - { - return DB()->escape_string($text); - } - else - { - return str_replace("'", "''", str_replace('\\', '\\\\', $text)); - } - break; - - default: - return str_replace("'", "''", str_replace('\\', '\\\\', $text)); - break; + return DB()->escape_string($text); + } + else + { + return str_replace("'", "''", str_replace('\\', '\\\\', $text)); } } diff --git a/upload/config.php b/upload/config.php index 23172b625..c2ea7fe15 100644 --- a/upload/config.php +++ b/upload/config.php @@ -57,7 +57,7 @@ $domain_name = (!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : $do // Increase number of revision after update $bb_cfg['tp_version'] = '2.5 pre-stable'; $bb_cfg['tp_release_date'] = '27-07-2013'; -$bb_cfg['tp_release_state'] = 'R515'; +$bb_cfg['tp_release_state'] = 'R516'; // Database $charset = 'utf8'; diff --git a/upload/includes/cron/jobs/cache_gc.php b/upload/includes/cron/jobs/cache_gc.php index ecefc7d7a..55737f71a 100644 --- a/upload/includes/cron/jobs/cache_gc.php +++ b/upload/includes/cron/jobs/cache_gc.php @@ -15,6 +15,6 @@ foreach ($gc_cache as $cache_name) if (method_exists(CACHE($cache_name), 'gc')) { $changes = CACHE($cache_name)->gc(); - $cron_runtime_log = date('Y-m-d H:i:s') ." -- tr -- $changes rows deleted\n"; + $cron_runtime_log .= date('Y-m-d H:i:s') ." -- tr -- $changes rows deleted\n"; } } diff --git a/upload/includes/cron/jobs/tr_maintenance.php b/upload/includes/cron/jobs/tr_maintenance.php index 430e3d495..33093c7aa 100644 --- a/upload/includes/cron/jobs/tr_maintenance.php +++ b/upload/includes/cron/jobs/tr_maintenance.php @@ -29,14 +29,6 @@ $attach_sql = join(',', $attach_sql); if ($dead_tor_sql && $attach_sql) { -/* - // Update topic type - DB()->query(" - UPDATE ". BB_TOPICS ." SET - topic_dl_type = ". TOPIC_DL_TYPE_NORMAL ." - WHERE topic_id IN($dead_tor_sql) - "); -*/ // Delete torstat DB()->query(" DELETE FROM ". BB_BT_TORSTAT ." diff --git a/upload/includes/db/mysql.php b/upload/includes/db/mysql.php index 095bdf146..b35175c21 100644 --- a/upload/includes/db/mysql.php +++ b/upload/includes/db/mysql.php @@ -95,6 +95,7 @@ class sql_db { $server = (DBG_USER) ? $this->cfg['dbhost'] : ''; header("HTTP/1.0 503 Service Unavailable"); + bb_log(' ', "db_err/connect_failed_{$this->cfg['dbhost']}"); die("Could not connect to the server $server"); } diff --git a/upload/includes/report_hack/report_privmsg.php b/upload/includes/report_hack/report_privmsg.php index d4f9324cf..31b3d8955 100644 --- a/upload/includes/report_hack/report_privmsg.php +++ b/upload/includes/report_hack/report_privmsg.php @@ -232,16 +232,8 @@ class report_privmsg extends report_module function _subject_details_prepare(&$message, &$subject, $row) { global $bb_cfg, $userdata, $datastore; - require_once(INC_DIR . "bbcode.php"); - // - // If the board has HTML off but the post has HTML - // on then we process it, else leave it alone - // - /*if ((!$bb_cfg['allow_html'] || !$userdata['user_allowhtml']) && $row['privmsgs_enable_html']) - { - $message = preg_replace('#(<)([\/]?.*?)(>)#is', '<\\2>', $message); - }*/ + require_once(INC_DIR . "bbcode.php"); $message = bbcode2html($message);