Minor improvements (#906)

This commit is contained in:
Roman Kelesidis 2023-09-19 17:00:17 +07:00 committed by GitHub
commit 34fd7ba2f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 26 additions and 15 deletions

View file

@ -11,6 +11,8 @@ if (!defined('BB_ROOT')) {
die(basename(__FILE__));
}
global $attach_config;
DB()->expect_slow_query(600);
$fix_errors = true;
@ -35,6 +37,16 @@ DB()->add_shutdown_query("DROP TEMPORARY TABLE IF EXISTS $tmp_attach_tbl");
// Get attach_mod config
$attach_dir = get_attachments_dir();
// Creates thumb directory if not exists
if ((int)$attach_config['img_create_thumbnail']) {
$thumb_dir = "$attach_dir/" . THUMB_DIR;
if (!is_dir($thumb_dir)) {
bb_mkdir($thumb_dir, 0755);
@chmod($thumb_dir, 0777);
}
}
// Get all names of existed attachments and insert them into $tmp_attach_tbl
if ($dir = @opendir($attach_dir)) {
$check_attachments = true;

View file

@ -13,7 +13,6 @@ if (!defined('BB_ROOT')) {
$log_days_keep = (int)$bb_cfg['log_days_keep'];
DB()->query("
DELETE FROM " . BB_LOG . "
WHERE log_time < " . (TIMENOW - 86400 * $log_days_keep) . "
");
if ($log_days_keep !== 0) {
DB()->query("DELETE FROM " . BB_LOG . " WHERE log_time < " . (TIMENOW - 86400 * $log_days_keep));
}

View file

@ -13,7 +13,6 @@ if (!defined('BB_ROOT')) {
$pm_days_keep = (int)$bb_cfg['pm_days_keep'];
DB()->query("
DELETE FROM " . BB_PRIVMSGS . "
WHERE privmsgs_date < " . (TIMENOW - 86400 * $pm_days_keep) . "
");
if ($pm_days_keep !== 0) {
DB()->query("DELETE FROM " . BB_PRIVMSGS . " WHERE privmsgs_date < " . (TIMENOW - 86400 * $pm_days_keep));
}