mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-20 13:24:01 -07:00
Отделение крон-задачи начисления сидбонусов
Отделение задачи из-за проблем с ее выполнением; исправление с присовением значений переменных массивам в задаче начисления сидбонусов; исправление ошибкис кодировкой админки после изменения конфига языков; исправление ошибки с отправкой почты из-за неверного email-адреса.
This commit is contained in:
parent
5745161a54
commit
7d2dc28fbe
6 changed files with 64 additions and 58 deletions
|
@ -269,6 +269,7 @@ else
|
||||||
{
|
{
|
||||||
// Generate frameset
|
// Generate frameset
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
|
'CONTENT_ENCODING' => $bb_cfg['lang'][$userdata['user_lang']]['encoding'],
|
||||||
'TPL_ADMIN_FRAMESET' => true,
|
'TPL_ADMIN_FRAMESET' => true,
|
||||||
));
|
));
|
||||||
send_no_cache_headers();
|
send_no_cache_headers();
|
||||||
|
|
|
@ -574,6 +574,7 @@ INSERT INTO `bb_cron` VALUES ('', '1', 'DS update stats', 'ds_update_stats.php',
|
||||||
INSERT INTO `bb_cron` VALUES ('', '1', 'Flash topic view', 'flash_topic_view.php', 'interval', '', '', '255', '', '', '00:10:00', '0', '', '0', '0', '0');
|
INSERT INTO `bb_cron` VALUES ('', '1', 'Flash topic view', 'flash_topic_view.php', 'interval', '', '', '255', '', '', '00:10:00', '0', '', '0', '0', '0');
|
||||||
INSERT INTO `bb_cron` VALUES ('', '1', 'Clean search results', 'clean_search_results.php', 'interval', '', '', '255', '', '', '00:10:00', '0', '', '0', '0', '0');
|
INSERT INTO `bb_cron` VALUES ('', '1', 'Clean search results', 'clean_search_results.php', 'interval', '', '', '255', '', '', '00:10:00', '0', '', '0', '0', '0');
|
||||||
INSERT INTO `bb_cron` VALUES ('', '1', 'Tracker cleanup and dlstat', 'tr_cleanup_and_dlstat.php', 'interval', '', '', '20', '', '', '00:15:00', '0', '', '0', '0', '0');
|
INSERT INTO `bb_cron` VALUES ('', '1', 'Tracker cleanup and dlstat', 'tr_cleanup_and_dlstat.php', 'interval', '', '', '20', '', '', '00:15:00', '0', '', '0', '0', '0');
|
||||||
|
INSERT INTO `bb_cron` VALUES ('', '1', 'Accrual seedbonus', 'tr_seed_bonus.php', 'interval', '', '', '25', '', '', '00:10:00', '0', '', '0', '0', '0');
|
||||||
INSERT INTO `bb_cron` VALUES ('', '1', 'Make tracker snapshot', 'tr_make_snapshot.php', 'interval', '', '', '10', '', '', '00:10:00', '0', '', '0', '0', '0');
|
INSERT INTO `bb_cron` VALUES ('', '1', 'Make tracker snapshot', 'tr_make_snapshot.php', 'interval', '', '', '10', '', '', '00:10:00', '0', '', '0', '0', '0');
|
||||||
INSERT INTO `bb_cron` VALUES ('', '1', 'Seeder last seen', 'tr_update_seeder_last_seen.php', 'interval', '', '', '255', '', '', '01:00:00', '0', '', '0', '0', '0');
|
INSERT INTO `bb_cron` VALUES ('', '1', 'Seeder last seen', 'tr_update_seeder_last_seen.php', 'interval', '', '', '255', '', '', '01:00:00', '0', '', '0', '0', '0');
|
||||||
INSERT INTO `bb_cron` VALUES ('', '1', 'Tracker dl-complete count', 'tr_complete_count.php', 'interval', '', '', '255', '', '', '06:00:00', '0', '', '0', '0', '0');
|
INSERT INTO `bb_cron` VALUES ('', '1', 'Tracker dl-complete count', 'tr_complete_count.php', 'interval', '', '', '255', '', '', '06:00:00', '0', '', '0', '0', '0');
|
||||||
|
|
|
@ -23,3 +23,4 @@ UPDATE `bb_cron` SET `cron_script` = 'board_maintenance.php' WHERE `cron_script`
|
||||||
// 2.1.5
|
// 2.1.5
|
||||||
DROP TABLE IF EXISTS `bb_captcha`;
|
DROP TABLE IF EXISTS `bb_captcha`;
|
||||||
DELETE FROM `bb_cron` WHERE `cron_script` = 'captcha_gen_gc.php';
|
DELETE FROM `bb_cron` WHERE `cron_script` = 'captcha_gen_gc.php';
|
||||||
|
INSERT INTO `bb_cron` VALUES ('', '1', 'Accrual seedbonus', 'tr_seed_bonus.php', 'interval', '', '', '25', '', '', '00:10:00', '0', '', '0', '0', '0');
|
|
@ -151,55 +151,3 @@ DB()->query("
|
||||||
". NEW_BB_BT_LAST_USERSTAT ." TO ". BB_BT_LAST_USERSTAT ."
|
". NEW_BB_BT_LAST_USERSTAT ." TO ". BB_BT_LAST_USERSTAT ."
|
||||||
");
|
");
|
||||||
DB()->query("DROP TABLE IF EXISTS ". NEW_BB_BT_LAST_USERSTAT .", ". OLD_BB_BT_LAST_USERSTAT);
|
DB()->query("DROP TABLE IF EXISTS ". NEW_BB_BT_LAST_USERSTAT .", ". OLD_BB_BT_LAST_USERSTAT);
|
||||||
|
|
||||||
DB()->expect_slow_query(10);
|
|
||||||
|
|
||||||
if ($bb_cfg['seed_bonus_enabled'] && $bb_cfg['seed_bonus_points'] && $bb_cfg['seed_bonus_release'])
|
|
||||||
{
|
|
||||||
DB()->query("
|
|
||||||
CREATE TEMPORARY TABLE tmp_bonus (
|
|
||||||
user_id INT UNSIGNED NOT NULL DEFAULT '0',
|
|
||||||
release_count INT UNSIGNED NOT NULL DEFAULT '0'
|
|
||||||
) ENGINE = MEMORY
|
|
||||||
");
|
|
||||||
|
|
||||||
$tor_size = ($bb_cfg['seed_bonus_tor_size'] * 1073741824);
|
|
||||||
|
|
||||||
DB()->query("INSERT INTO tmp_bonus
|
|
||||||
SELECT bt.user_id, count(bt.seeder) AS release_count
|
|
||||||
FROM ". BB_BT_TRACKER ." bt, ". BB_BT_TORRENTS ." tor
|
|
||||||
WHERE tor.topic_id = bt.topic_id
|
|
||||||
AND tor.size > $tor_size
|
|
||||||
AND bt.seeder > 0
|
|
||||||
GROUP BY user_id
|
|
||||||
");
|
|
||||||
|
|
||||||
$seed_bonus = (float) unserialize($bb_cfg['seed_bonus_points']);
|
|
||||||
$seed_release = (int) unserialize($bb_cfg['seed_bonus_release']);
|
|
||||||
|
|
||||||
foreach($seed_bonus as $i => $points)
|
|
||||||
{
|
|
||||||
if (!$points || !$seed_release[$i]) continue;
|
|
||||||
|
|
||||||
$user_points = ($points / 4);
|
|
||||||
$release = $seed_release[$i];
|
|
||||||
$user_regdate = (TIMENOW - $bb_cfg['seed_bonus_user_regdate'] * 86400);
|
|
||||||
|
|
||||||
DB()->query("
|
|
||||||
UPDATE ". BB_USERS ." u, ". BB_BT_USERS ." bu, tmp_bonus b
|
|
||||||
SET
|
|
||||||
u.user_points = u.user_points + $user_points,
|
|
||||||
bu.points_today = bu.points_today + $user_points,
|
|
||||||
b.user_id = 0
|
|
||||||
WHERE
|
|
||||||
b.user_id = u.user_id
|
|
||||||
AND bu.user_id = u.user_id
|
|
||||||
AND b.release_count <= $release
|
|
||||||
AND u.user_regdate < $user_regdate
|
|
||||||
AND u.user_active = 1
|
|
||||||
AND u.user_id not IN(". EXCLUDED_USERS_CSV .")
|
|
||||||
");
|
|
||||||
}
|
|
||||||
|
|
||||||
DB()->query("DROP TEMPORARY TABLE IF EXISTS tmp_bonus");
|
|
||||||
}
|
|
55
library/includes/cron/jobs/tr_seed_bonus.php
Normal file
55
library/includes/cron/jobs/tr_seed_bonus.php
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
||||||
|
|
||||||
|
DB()->expect_slow_query(600);
|
||||||
|
|
||||||
|
if ($bb_cfg['seed_bonus_enabled'] && $bb_cfg['seed_bonus_points'] && $bb_cfg['seed_bonus_release'])
|
||||||
|
{
|
||||||
|
DB()->query("
|
||||||
|
CREATE TEMPORARY TABLE tmp_bonus (
|
||||||
|
user_id INT UNSIGNED NOT NULL DEFAULT '0',
|
||||||
|
release_count INT UNSIGNED NOT NULL DEFAULT '0'
|
||||||
|
) ENGINE = MEMORY
|
||||||
|
");
|
||||||
|
|
||||||
|
$tor_size = ($bb_cfg['seed_bonus_tor_size'] * 1073741824);
|
||||||
|
|
||||||
|
DB()->query("INSERT INTO tmp_bonus
|
||||||
|
SELECT bt.user_id, count(bt.seeder) AS release_count
|
||||||
|
FROM ". BB_BT_TRACKER ." bt, ". BB_BT_TORRENTS ." tor
|
||||||
|
WHERE tor.topic_id = bt.topic_id
|
||||||
|
AND tor.size > $tor_size
|
||||||
|
AND bt.seeder > 0
|
||||||
|
GROUP BY user_id
|
||||||
|
");
|
||||||
|
|
||||||
|
$seed_bonus = unserialize($bb_cfg['seed_bonus_points']);
|
||||||
|
$seed_release = unserialize($bb_cfg['seed_bonus_release']);
|
||||||
|
|
||||||
|
foreach($seed_bonus as $i => $points)
|
||||||
|
{
|
||||||
|
if (!$points || !$seed_release[$i]) continue;
|
||||||
|
|
||||||
|
$user_points = ((float) $points / 4);
|
||||||
|
$release = (int) $seed_release[$i];
|
||||||
|
$user_regdate = (TIMENOW - $bb_cfg['seed_bonus_user_regdate'] * 86400);
|
||||||
|
|
||||||
|
DB()->query("
|
||||||
|
UPDATE ". BB_USERS ." u, ". BB_BT_USERS ." bu, tmp_bonus b
|
||||||
|
SET
|
||||||
|
u.user_points = u.user_points + $user_points,
|
||||||
|
bu.points_today = bu.points_today + $user_points,
|
||||||
|
b.user_id = 0
|
||||||
|
WHERE
|
||||||
|
b.user_id = u.user_id
|
||||||
|
AND bu.user_id = u.user_id
|
||||||
|
AND b.release_count <= $release
|
||||||
|
AND u.user_regdate < $user_regdate
|
||||||
|
AND u.user_active = 1
|
||||||
|
AND u.user_id not IN(". EXCLUDED_USERS_CSV .")
|
||||||
|
");
|
||||||
|
}
|
||||||
|
|
||||||
|
DB()->query("DROP TEMPORARY TABLE IF EXISTS tmp_bonus");
|
||||||
|
}
|
|
@ -653,7 +653,7 @@ if ($submit && !$errors)
|
||||||
$emailer = new emailer($bb_cfg['smtp_delivery']);
|
$emailer = new emailer($bb_cfg['smtp_delivery']);
|
||||||
|
|
||||||
$emailer->from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
|
$emailer->from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
|
||||||
$emailer->email_address("$username <$email>");
|
$emailer->email_address($username . "<" . $db_data['user_email'] . ">");
|
||||||
|
|
||||||
$emailer->use_template($email_template, $user_lang);
|
$emailer->use_template($email_template, $user_lang);
|
||||||
|
|
||||||
|
@ -693,7 +693,7 @@ if ($submit && !$errors)
|
||||||
|
|
||||||
$emailer->from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
|
$emailer->from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
|
||||||
$emailer->use_template('user_activate', $pr_data['user_lang']);
|
$emailer->use_template('user_activate', $pr_data['user_lang']);
|
||||||
$emailer->email_address("$username <$email>");
|
$emailer->email_address($username . "<" . $pr_data['user_email'] . ">");
|
||||||
|
|
||||||
$emailer->assign_vars(array(
|
$emailer->assign_vars(array(
|
||||||
'SITENAME' => $bb_cfg['sitename'],
|
'SITENAME' => $bb_cfg['sitename'],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue