mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-21 13:54:02 -07:00
Minor improvements (#882)
* Minor improvements * Updated * Updated * Updated * Update privmsg.php * Updated * Update admin_attach_cp.php
This commit is contained in:
parent
2c07660435
commit
4b453de64a
75 changed files with 699 additions and 735 deletions
|
@ -35,7 +35,7 @@ if ($cron_jobs) {
|
|||
require(CRON_DIR . 'cron_run.php');
|
||||
|
||||
// Update cron_last_check
|
||||
bb_update_config(array('cron_last_check' => TIMENOW + 10));
|
||||
bb_update_config(['cron_last_check' => TIMENOW + 10]);
|
||||
} else {
|
||||
bb_log(date('H:i:s - ') . getmypid() . ' --x- no active jobs found ----------------------------------------------' . LOG_LF, CRON_LOG_DIR . '/cron_check');
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ foreach ($cron_jobs as $job) {
|
|||
$cron_sql_log_file = CRON_LOG_DIR . '/SQL-' . basename($job['cron_script']);
|
||||
|
||||
if ($cron_write_log) {
|
||||
$msg = array();
|
||||
$msg = [];
|
||||
$msg[] = 'start';
|
||||
$msg[] = date('m-d');
|
||||
$msg[] = date('H:i:s');
|
||||
|
@ -74,7 +74,7 @@ foreach ($cron_jobs as $job) {
|
|||
}
|
||||
|
||||
if ($cron_write_log) {
|
||||
$msg = array();
|
||||
$msg = [];
|
||||
$msg[] = ' end';
|
||||
$msg[] = date('m-d');
|
||||
$msg[] = date('H:i:s');
|
||||
|
|
|
@ -21,8 +21,8 @@ $db_max_packet = 800000;
|
|||
$sql_limit = 3000;
|
||||
|
||||
$check_attachments = false;
|
||||
$orphan_files = $orphan_db_attach = $orphan_tor = array();
|
||||
$posts_without_attach = $topics_without_attach = array();
|
||||
$orphan_files = $orphan_db_attach = $orphan_tor = [];
|
||||
$posts_without_attach = $topics_without_attach = [];
|
||||
|
||||
DB()->query("
|
||||
CREATE TEMPORARY TABLE $tmp_attach_tbl (
|
||||
|
@ -38,7 +38,7 @@ $attach_dir = get_attachments_dir();
|
|||
// Get all names of existed attachments and insert them into $tmp_attach_tbl
|
||||
if ($dir = @opendir($attach_dir)) {
|
||||
$check_attachments = true;
|
||||
$files = array();
|
||||
$files = [];
|
||||
$f_len = 0;
|
||||
|
||||
while (false !== ($f = readdir($dir))) {
|
||||
|
@ -52,7 +52,7 @@ if ($dir = @opendir($attach_dir)) {
|
|||
if ($f_len > $db_max_packet) {
|
||||
$files = implode(',', $files);
|
||||
DB()->query("INSERT INTO $tmp_attach_tbl VALUES $files");
|
||||
$files = array();
|
||||
$files = [];
|
||||
$f_len = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,14 +12,14 @@ if (!defined('BB_ROOT')) {
|
|||
}
|
||||
|
||||
// Delete staled dl-status records
|
||||
$keeping_dlstat = array(
|
||||
$keeping_dlstat = [
|
||||
DL_STATUS_WILL => (int)$bb_cfg['dl_will_days_keep'],
|
||||
DL_STATUS_DOWN => (int)$bb_cfg['dl_down_days_keep'],
|
||||
DL_STATUS_COMPLETE => (int)$bb_cfg['dl_complete_days_keep'],
|
||||
DL_STATUS_CANCEL => (int)$bb_cfg['dl_cancel_days_keep'],
|
||||
);
|
||||
DL_STATUS_CANCEL => (int)$bb_cfg['dl_cancel_days_keep']
|
||||
];
|
||||
|
||||
$delete_dlstat_sql = array();
|
||||
$delete_dlstat_sql = [];
|
||||
|
||||
foreach ($keeping_dlstat as $dl_status => $days_to_keep) {
|
||||
if ($days_to_keep) {
|
||||
|
|
|
@ -12,10 +12,10 @@ if (!defined('BB_ROOT')) {
|
|||
}
|
||||
|
||||
// Lock tables
|
||||
DB()->lock(array(
|
||||
DB()->lock([
|
||||
BB_TOPICS . ' t',
|
||||
BUF_TOPIC_VIEW . ' buf',
|
||||
));
|
||||
BUF_TOPIC_VIEW . ' buf'
|
||||
]);
|
||||
|
||||
// Flash buffered records
|
||||
DB()->query("
|
||||
|
|
|
@ -16,7 +16,7 @@ $users_per_cycle = 1000;
|
|||
while (true) {
|
||||
@set_time_limit(600);
|
||||
|
||||
$prune_users = $not_activated_users = $not_active_users = array();
|
||||
$prune_users = $not_activated_users = $not_active_users = [];
|
||||
|
||||
if ($not_activated_days = (int)$bb_cfg['user_not_activated_days_keep']) {
|
||||
$sql = DB()->fetch_rowset("SELECT user_id FROM " . BB_USERS . "
|
||||
|
|
|
@ -18,10 +18,10 @@ $user_session_gc_time = $user_session_expire_time - (int)$bb_cfg['user_session_g
|
|||
$admin_session_gc_time = $admin_session_expire_time;
|
||||
|
||||
// ############################ Tables LOCKED ################################
|
||||
DB()->lock(array(
|
||||
DB()->lock([
|
||||
BB_USERS . ' u',
|
||||
BB_SESSIONS . ' s',
|
||||
));
|
||||
BB_SESSIONS . ' s'
|
||||
]);
|
||||
|
||||
// Update user's session time
|
||||
DB()->query("
|
||||
|
|
|
@ -29,10 +29,10 @@ DB()->expect_slow_query(600);
|
|||
// Update dlstat (part 1)
|
||||
if ($bb_cfg['tracker']['update_dlstat']) {
|
||||
// ############################ Tables LOCKED ################################
|
||||
DB()->lock(array(
|
||||
DB()->lock([
|
||||
BB_BT_TRACKER,
|
||||
NEW_BB_BT_LAST_TORSTAT,
|
||||
));
|
||||
NEW_BB_BT_LAST_TORSTAT
|
||||
]);
|
||||
|
||||
// Get PER TORRENT user's dlstat from tracker
|
||||
DB()->query("
|
||||
|
|
|
@ -19,7 +19,7 @@ $last_seen_time = TIMENOW - 86400 * $bb_cfg['seeder_last_seen_days_keep'];
|
|||
$never_seen_time = TIMENOW - 86400 * $bb_cfg['seeder_never_seen_days_keep'];
|
||||
$limit_sql = 3000;
|
||||
|
||||
$topics_sql = $attach_sql = array();
|
||||
$topics_sql = $attach_sql = [];
|
||||
|
||||
$sql = "SELECT topic_id, attach_id
|
||||
FROM " . BB_BT_TORRENTS . "
|
||||
|
|
|
@ -35,7 +35,7 @@ while (true) {
|
|||
set_time_limit(600);
|
||||
$end_id = $start_id + $per_cycle - 1;
|
||||
|
||||
$val = array();
|
||||
$val = [];
|
||||
|
||||
if (!$bb_cfg['ocelot']['enabled']) {
|
||||
$sql = "
|
||||
|
@ -135,7 +135,7 @@ if ($bb_cfg['torhelp_enabled']) {
|
|||
$tor_downloaded_days_ago = 60; // ">="
|
||||
$user_last_seen_online = 15; // minutes
|
||||
$users_limit = 3000;
|
||||
$dl_status_ary = array(DL_STATUS_COMPLETE);
|
||||
$dl_status_ary = [DL_STATUS_COMPLETE];
|
||||
|
||||
define('NEW_BB_BT_TORHELP', 'new_torhelp');
|
||||
define('OLD_BB_BT_TORHELP', 'old_torhelp');
|
||||
|
@ -153,7 +153,7 @@ if ($bb_cfg['torhelp_enabled']) {
|
|||
ORDER BY session_time DESC
|
||||
LIMIT $users_limit
|
||||
";
|
||||
$online_users_ary = array();
|
||||
$online_users_ary = [];
|
||||
|
||||
foreach (DB()->fetch_rowset($sql) as $row) {
|
||||
$online_users_ary[] = $row['uid'];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue