本文整理汇总了PHP中cleanup_log函数的典型用法代码示例。如果您正苦于以下问题:PHP cleanup_log函数的具体用法?PHP cleanup_log怎么用?PHP cleanup_log使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cleanup_log函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Copyright
/**
|--------------------------------------------------------------------------|
| https://github.com/Bigjoos/ |
|--------------------------------------------------------------------------|
| Licence Info: GPL |
|--------------------------------------------------------------------------|
| Copyright (C) 2010 U-232 V5 |
|--------------------------------------------------------------------------|
| A bittorrent tracker source based on TBDev.net/tbsource/bytemonsoon. |
|--------------------------------------------------------------------------|
| Project Leaders: Mindless, Autotron, whocares, Swizzles. |
|--------------------------------------------------------------------------|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/ \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \
( U | - | 2 | 3 | 2 )-( S | o | u | r | c | e )-( C | o | d | e )
\_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/
*/
function docleanup($data)
{
global $INSTALLER09, $queries, $mc1;
set_time_limit(1200);
ignore_user_abort(1);
//== Delete inactive user accounts
$secs = 350 * 86400;
$dt = TIME_NOW - $secs;
$maxclass = UC_STAFF;
sql_query("SELECT FROM users WHERE parked='no' AND status='confirmed' AND class < {$maxclass} AND last_access < {$dt}");
//== Delete parked user accounts
$secs = 675 * 86400;
// change the time to fit your needs
$dt = TIME_NOW - $secs;
$maxclass = UC_STAFF;
sql_query("SELECT FROM users WHERE parked='yes' AND status='confirmed' AND class < {$maxclass} AND last_access < {$dt}");
if ($queries > 0) {
write_log("Inactive Clean -------------------- Inactive Clean Complete using {$queries} queries--------------------");
}
if (false !== mysqli_affected_rows($GLOBALS["___mysqli_ston"])) {
$data['clean_desc'] = mysqli_affected_rows($GLOBALS["___mysqli_ston"]) . " items deleted/updated";
}
if ($data['clean_log']) {
cleanup_log($data);
}
}
示例2: Copyright
/**
|--------------------------------------------------------------------------|
| https://github.com/Bigjoos/ |
|--------------------------------------------------------------------------|
| Licence Info: GPL |
|--------------------------------------------------------------------------|
| Copyright (C) 2010 U-232 V5 |
|--------------------------------------------------------------------------|
| A bittorrent tracker source based on TBDev.net/tbsource/bytemonsoon. |
|--------------------------------------------------------------------------|
| Project Leaders: Mindless, Autotron, whocares, Swizzles. |
|--------------------------------------------------------------------------|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/ \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \
( U | - | 2 | 3 | 2 )-( S | o | u | r | c | e )-( C | o | d | e )
\_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/
*/
function docleanup($data)
{
global $INSTALLER09, $queries, $mc1;
set_time_limit(0);
ignore_user_abort(1);
require_once INCL_DIR . 'function_happyhour.php';
//==Putyns HappyHour
$f = $INSTALLER09['happyhour'];
$happy = unserialize(file_get_contents($f));
$happyHour = strtotime($happy["time"]);
$curDate = TIME_NOW;
$happyEnd = $happyHour + 3600;
if ($happy["status"] == 0 && $INSTALLER09['happy_hour'] == true) {
write_log("Happy hour was @ " . get_date($happyHour, 'LONG', 1, 0) . " and Catid " . $happy["catid"] . " ");
happyFile("set");
} elseif ($curDate > $happyEnd && $happy["status"] == 1) {
happyFile("reset");
}
//== End
if ($queries > 0) {
write_log("Happyhour Clean -------------------- Happyhour cleanup Complete using {$queries} queries --------------------");
}
if (false !== mysqli_affected_rows($GLOBALS["___mysqli_ston"])) {
$data['clean_desc'] = mysqli_affected_rows($GLOBALS["___mysqli_ston"]) . " items deleted/updated";
}
if ($data['clean_log']) {
cleanup_log($data);
}
}
示例3: docleanup
/**
* https://github.com/Bigjoos/
* Licence Info: GPL
* Copyright (C) 2010 U-232 v.3
* A bittorrent tracker source based on TBDev.net/tbsource/bytemonsoon.
* Project Leaders: Mindless, putyn.
*
*/
function docleanup($data)
{
global $INSTALLER09, $queries, $mc1;
set_time_limit(0);
ignore_user_abort(1);
//=== delete from now viewing after 15 minutes
sql_query('DELETE FROM now_viewing WHERE added < ' . (TIME_NOW - 900));
//=== fix any messed up counts
$forums = sql_query('SELECT f.id, count( DISTINCT t.id ) AS topics, count(p.id) AS posts
FROM forums f
LEFT JOIN topics t ON f.id = t.forum_id
LEFT JOIN posts p ON t.id = p.topic_id
GROUP BY f.id');
while ($forum = mysqli_fetch_assoc($forums)) {
$forum['posts'] = $forum['topics'] > 0 ? $forum['posts'] : 0;
sql_query('update forums set post_count = ' . sqlesc($forum['posts']) . ', topic_count = ' . sqlesc($forum['topics']) . ' where id=' . sqlesc($forum['id']));
}
if ($queries > 0) {
write_log("Forum clean-------------------- Forum cleanup Complete using {$queries} queries --------------------");
}
if (false !== mysqli_affected_rows($GLOBALS["___mysqli_ston"])) {
$data['clean_desc'] = mysqli_affected_rows($GLOBALS["___mysqli_ston"]) . " items updated";
}
if ($data['clean_log']) {
cleanup_log($data);
}
}
示例4: Copyright
/**
|--------------------------------------------------------------------------|
| https://github.com/Bigjoos/ |
|--------------------------------------------------------------------------|
| Licence Info: GPL |
|--------------------------------------------------------------------------|
| Copyright (C) 2010 U-232 V5 |
|--------------------------------------------------------------------------|
| A bittorrent tracker source based on TBDev.net/tbsource/bytemonsoon. |
|--------------------------------------------------------------------------|
| Project Leaders: Mindless, Autotron, whocares, Swizzles. |
|--------------------------------------------------------------------------|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/ \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \
( U | - | 2 | 3 | 2 )-( S | o | u | r | c | e )-( C | o | d | e )
\_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/
*/
function docleanup($data)
{
global $INSTALLER09, $queries, $mc1;
set_time_limit(0);
ignore_user_abort(1);
//== Delete snatched
$dt = TIME_NOW - 30 * 86400;
sql_query("DELETE FROM snatched WHERE complete_date < " . sqlesc($dt)) or sqlerr(__FILE__, __LINE__);
if (false !== mysqli_affected_rows($GLOBALS["___mysqli_ston"])) {
$data['clean_desc'] = mysqli_affected_rows($GLOBALS["___mysqli_ston"]) . " items deleted/updated";
}
$snatchedcounts = array();
$snatchedres = sql_query("SELECT torrentid, COUNT(*) AS count FROM snatched WHERE complete_date > 0 GROUP BY torrentid");
while ($row = mysqli_fetch_assoc($snatchedres)) {
$snatchedcounts[$row['torrentid']] = (int) $row['count'];
}
$tcompletedres = sql_query("SELECT id, times_completed FROM torrents");
while ($row2 = mysqli_fetch_assoc($tcompletedres)) {
if (!array_key_exists($row2['id'], $snatchedcounts) || array_key_exists($row2['id'], $snatchedcounts) && $row2['times_completed'] != $snatchedcounts[$row2['id']]) {
sql_query("UPDATE torrents SET times_completed = " . $snatchedcounts[$row2['id']] . " WHERE id = " . $row2['id']);
++$snatchedcounts;
}
}
if ($queries > 0) {
write_log("Snatch list clean-------------------- Removed snatches not seeded for 99 days. Cleanup Complete using {$queries} queries --------------------");
}
if ($data['clean_log']) {
cleanup_log($data);
}
}
示例5: Copyright
/**
|--------------------------------------------------------------------------|
| https://github.com/Bigjoos/ |
|--------------------------------------------------------------------------|
| Licence Info: GPL |
|--------------------------------------------------------------------------|
| Copyright (C) 2010 U-232 V4 |
|--------------------------------------------------------------------------|
| A bittorrent tracker source based on TBDev.net/tbsource/bytemonsoon. |
|--------------------------------------------------------------------------|
| Project Leaders: Mindless,putyn. |
|--------------------------------------------------------------------------|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/ \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \
( U | - | 2 | 3 | 2 )-( S | o | u | r | c | e )-( C | o | d | e )
\_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/
*/
function docleanup($data)
{
global $INSTALLER09, $queries, $mc1;
set_time_limit(0);
ignore_user_abort(1);
$deadtime = TIME_NOW - $INSTALLER09['signup_timeout'];
$res = sql_query("SELECT id, username, added, downloaded, uploaded, last_access, class, donor, warned, enabled, status FROM users WHERE status = 'pending' AND added < {$deadtime} AND last_login < {$deadtime} AND last_access < {$deadtime} ORDER BY username DESC");
if (mysqli_num_rows($res) != 0) {
while ($arr = mysqli_fetch_assoc($res)) {
$userid = $arr['id'];
$res_del = sql_query("DELETE FROM users WHERE id=" . sqlesc($userid)) or sqlerr(__FILE__, __LINE__);
$mc1->delete_value('MyUser_' . $userid);
$mc1->delete_value('user' . $userid);
write_log("User: {$arr['username']} Was deleted by Expired Signup clean");
}
}
if ($queries > 0) {
write_log("Expired Signup clean-------------------- Expired Signup cleanup Complete using {$queries} queries --------------------");
}
if (false !== mysqli_affected_rows($GLOBALS["___mysqli_ston"])) {
$data['clean_desc'] = mysqli_affected_rows($GLOBALS["___mysqli_ston"]) . " items deleted/updated";
}
if ($data['clean_log']) {
cleanup_log($data);
}
}
示例6: docleanup
function docleanup($data)
{
global $INSTALLER09, $queries, $mc1;
set_time_limit(0);
ignore_user_abort(1);
//== Delete old backup's
$days = 3;
$res = sql_query("SELECT id, name FROM dbbackup WHERE added < " . sqlesc(TIME_NOW - $days * 86400)) or sqlerr(__FILE__, __LINE__);
if (mysqli_num_rows($res) > 0) {
$ids = array();
while ($arr = mysqli_fetch_assoc($res)) {
$ids[] = (int) $arr['id'];
$filename = $INSTALLER09['backup_dir'] . '/' . $arr['name'];
if (is_file($filename)) {
unlink($filename);
}
}
sql_query('DELETE FROM dbbackup WHERE id IN (' . implode(', ', $ids) . ')') or sqlerr(__FILE__, __LINE__);
}
//== end
if ($queries > 0) {
write_log("Backup Clean -------------------- Backup Clean Complete using {$queries} queries--------------------");
}
if (false !== mysqli_affected_rows($GLOBALS["___mysqli_ston"])) {
$data['clean_desc'] = mysqli_affected_rows($GLOBALS["___mysqli_ston"]) . " items deleted/updated";
}
if ($data['clean_log']) {
cleanup_log($data);
}
}
示例7: docleanup
function docleanup($data)
{
global $INSTALLER09, $queries, $bdir;
set_time_limit(0);
ignore_user_abort(1);
$mysql_host = $INSTALLER09['mysql_host'];
$mysql_user = $INSTALLER09['mysql_user'];
$mysql_pass = $INSTALLER09['mysql_pass'];
$mysql_db = $INSTALLER09['mysql_db'];
$bdir = $_SERVER["DOCUMENT_ROOT"] . "/include/backup";
$c1 = "mysqldump -h " . $mysql_host . " -u " . $mysql_user . " -p" . $mysql_pass . " " . $mysql_db . " -d > " . $bdir . "/db_structure.sql";
$c = "mysqldump -h " . $mysql_host . " -u " . $mysql_user . " -p" . $mysql_pass . " " . $mysql_db . " " . tables("peers|messages|sitelog") . " | bzip2 -cq9 > " . $bdir . "/db_" . date("m_d_y", TIME_NOW) . ".sql.bz2";
system($c1);
system($c);
$files = glob($bdir . "/db_*");
foreach ($files as $file) {
if (TIME_NOW - filemtime($file) > 3 * 86400) {
unlink($file);
}
}
$ext = "db_" . date("m_d_y", TIME_NOW) . ".sql.bz2";
sql_query("INSERT INTO dbbackup (name, added, userid) VALUES (" . sqlesc($ext) . ", " . TIME_NOW . ", " . $INSTALLER09['site']['owner'] . ")") or sqlerr(__FILE__, __LINE__);
if ($queries > 0) {
write_log("Auto-dbbackup----------------------Auto Back Up Complete using {$queries} queries---------------------");
}
if (false !== mysqli_affected_rows($GLOBALS["___mysqli_ston"])) {
$data['clean_desc'] = mysqli_affected_rows($GLOBALS["___mysqli_ston"]) . " items deleted/updated";
}
if ($data['clean_log']) {
cleanup_log($data);
}
}
示例8: docleanup
function docleanup($data)
{
global $INSTALLER09, $queries;
set_time_limit(1200);
ignore_user_abort(1);
$sql = sql_query("SHOW TABLE STATUS FROM {$INSTALLER09['mysql_db']}");
$oht = '';
while ($row = mysqli_fetch_assoc($sql)) {
if ($row['Data_free'] > 100) {
$oht .= $row['Data_free'] . ',';
}
}
$oht = rtrim($oht, ',');
if ($oht != '') {
$sql = sql_query("OPTIMIZE TABLE {$oht}");
}
if ($queries > 0) {
write_log("Auto-optimizedb--------------------Auto Optimization Complete using {$queries} queries --------------------");
}
if ($oht != '') {
$data['clean_desc'] = "MySQLCleanup optimized {$oht} table(s)";
}
if ($data['clean_log']) {
cleanup_log($data);
}
}
示例9: docleanup
function docleanup($data)
{
global $INSTALLER09, $queries, $mc1;
set_time_limit(1200);
ignore_user_abort(1);
sql_query("UPDATE `freeslots` SET `addedup` = 0 WHERE `addedup` != 0 AND `addedup` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__);
sql_query("UPDATE `freeslots` SET `addedfree` = 0 WHERE `addedfree` != 0 AND `addedfree` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__);
sql_query("DELETE FROM `freeslots` WHERE `addedup` = 0 AND `addedfree` = 0") or sqlerr(__FILE__, __LINE__);
sql_query("UPDATE `users` SET `free_switch` = 0 WHERE `free_switch` > 1 AND `free_switch` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__);
sql_query("UPDATE `torrents` SET `free` = 0 WHERE `free` > 1 AND `free` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__);
sql_query("UPDATE `users` SET `downloadpos` = 1 WHERE `downloadpos` > 1 AND `downloadpos` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__);
sql_query("UPDATE `users` SET `uploadpos` = 1 WHERE `uploadpos` > 1 AND `uploadpos` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__);
sql_query("UPDATE `users` SET `chatpost` = 1 WHERE `chatpost` > 1 AND `chatpost` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__);
sql_query("UPDATE `users` SET `avatarpos` = 1 WHERE `avatarpos` > 1 AND `avatarpos` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__);
sql_query("UPDATE `users` SET `immunity` = 0 WHERE `immunity` > 1 AND `immunity` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__);
sql_query("UPDATE `users` SET `warned` = 0 WHERE `warned` > 1 AND `warned` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__);
sql_query("UPDATE `users` SET `pirate` = 0 WHERE `pirate` > 1 AND `pirate` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__);
sql_query("UPDATE `users` SET `king` = 0 WHERE `king` > 1 AND `king` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__);
if ($queries > 0) {
write_log("User Clean -------------------- User Clean Complete using {$queries} queries--------------------");
}
if (false !== mysqli_affected_rows($GLOBALS["___mysqli_ston"])) {
$data['clean_desc'] = mysqli_affected_rows($GLOBALS["___mysqli_ston"]) . " items deleted/updated";
}
if ($data['clean_log']) {
cleanup_log($data);
}
}
示例10: docleanup
function docleanup($data)
{
global $INSTALLER09, $queries, $mc1;
set_time_limit(1200);
ignore_user_abort(1);
//== delete torrents - ????
$days = 30;
$dt = TIME_NOW - $days * 86400;
sql_query("UPDATE torrents SET flags='1' WHERE added < {$dt} AND seeders='0' AND leechers='0'") or sqlerr(__FILE__, __LINE__);
$res = sql_query("SELECT id, name FROM torrents WHERE mtime < {$dt} AND seeders='0' AND leechers='0' AND flags='1'") or sqlerr(__FILE__, __LINE__);
while ($arr = mysqli_fetch_assoc($res)) {
sql_query("DELETE files.*, comments.*, thankyou.*, thanks.*, thumbsup.*, bookmarks.*, coins.*, rating.*, xbt_files_users.* FROM xbt_files_users\n LEFT JOIN files ON files.torrent = xbt_files_users.fid\n LEFT JOIN comments ON comments.torrent = xbt_files_users.fid\n LEFT JOIN thankyou ON thankyou.torid = xbt_files_users.fid\n LEFT JOIN thanks ON thanks.torrentid = xbt_files_users.fid\n LEFT JOIN bookmarks ON bookmarks.torrentid = xbt_files_users.fid\n LEFT JOIN coins ON coins.torrentid = xbt_files_users.fid\n LEFT JOIN rating ON rating.torrent = xbt_files_users.fid\n LEFT JOIN thumbsup ON thumbsup.torrentid = xbt_files_users.fid\n WHERE xbt_files_users.fid =" . sqlesc($arr['id'])) or sqlerr(__FILE__, __LINE__);
@unlink("{$INSTALLER09['torrent_dir']}/{$arr['id']}.torrent");
write_log("Torrent " . (int) $arr['id'] . " (" . htmlsafechars($arr['name']) . ") was deleted by system (older than {$days} days and no seeders)");
}
if ($queries > 0) {
write_log("Delete Old Torrents XBT Clean -------------------- Delete Old XBT Torrents cleanup Complete using {$queries} queries --------------------");
}
if (false !== mysqli_affected_rows($GLOBALS["___mysqli_ston"])) {
$data['clean_desc'] = mysqli_affected_rows($GLOBALS["___mysqli_ston"]) . " items deleted/updated";
}
if ($data['clean_log']) {
cleanup_log($data);
}
}
示例11: Copyright
/**
|--------------------------------------------------------------------------|
| https://github.com/Bigjoos/ |
|--------------------------------------------------------------------------|
| Licence Info: GPL |
|--------------------------------------------------------------------------|
| Copyright (C) 2010 U-232 V5 |
|--------------------------------------------------------------------------|
| A bittorrent tracker source based on TBDev.net/tbsource/bytemonsoon. |
|--------------------------------------------------------------------------|
| Project Leaders: Mindless, Autotron, whocares, Swizzles. |
|--------------------------------------------------------------------------|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/ \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \
( U | - | 2 | 3 | 2 )-( S | o | u | r | c | e )-( C | o | d | e )
\_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/
*/
function docleanup($data)
{
global $INSTALLER09, $queries, $mc1;
set_time_limit(0);
ignore_user_abort(1);
//=== Clean silver
$res = sql_query("SELECT id, silver FROM torrents WHERE silver > 1 AND silver < " . TIME_NOW) or sqlerr(__FILE__, __LINE__);
$Silver_buffer = array();
if (mysqli_num_rows($res) > 0) {
while ($arr = mysqli_fetch_assoc($res)) {
$Silver_buffer[] = '(' . $arr['id'] . ', \'0\')';
$mc1->begin_transaction('torrent_details_' . $arr['id']);
$mc1->update_row(false, array('silver' => 0));
$mc1->commit_transaction($INSTALLER09['expires']['torrent_details']);
}
$count = count($Silver_buffer);
if ($count > 0) {
sql_query("INSERT INTO torrents (id, silver) VALUES " . implode(', ', $Silver_buffer) . " ON DUPLICATE key UPDATE silver=values(silver)") or sqlerr(__FILE__, __LINE__);
write_log("Cleanup - Removed Silver from " . $count . " torrents");
}
unset($Silver_buffer, $count);
}
//==End
if ($queries > 0) {
write_log("Free clean-------------------- Silver Torrents cleanup Complete using {$queries} queries --------------------");
}
if (false !== mysqli_affected_rows($GLOBALS["___mysqli_ston"])) {
$data['clean_desc'] = mysqli_affected_rows($GLOBALS["___mysqli_ston"]) . " items updated";
}
if ($data['clean_log']) {
cleanup_log($data);
}
}
示例12: Copyright
/**
|--------------------------------------------------------------------------|
| https://github.com/Bigjoos/ |
|--------------------------------------------------------------------------|
| Licence Info: GPL |
|--------------------------------------------------------------------------|
| Copyright (C) 2010 U-232 V4 |
|--------------------------------------------------------------------------|
| A bittorrent tracker source based on TBDev.net/tbsource/bytemonsoon. |
|--------------------------------------------------------------------------|
| Project Leaders: Mindless,putyn. |
|--------------------------------------------------------------------------|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/ \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \
( U | - | 2 | 3 | 2 )-( S | o | u | r | c | e )-( C | o | d | e )
\_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/
*/
function docleanup($data)
{
global $INSTALLER09, $queries, $mc1;
set_time_limit(0);
ignore_user_abort(1);
do {
$res = sql_query("SELECT id FROM torrents");
$ar = array();
while ($row = mysqli_fetch_array($res, MYSQLI_NUM)) {
$id = $row[0];
$ar[$id] = 1;
}
if (!count($ar)) {
break;
}
$dp = opendir($INSTALLER09['torrent_dir']);
if (!$dp) {
break;
}
$ar2 = array();
while (($file = readdir($dp)) !== false) {
if (!preg_match('/^(\\d+)\\.torrent$/', $file, $m)) {
continue;
}
$id = $m[1];
$ar2[$id] = 1;
if (isset($ar[$id]) && $ar[$id]) {
continue;
}
$ff = $INSTALLER09['torrent_dir'] . "/{$file}";
unlink($ff);
}
closedir($dp);
if (!count($ar2)) {
break;
}
$delids = array();
foreach (array_keys($ar) as $k) {
if (isset($ar2[$k]) && $ar2[$k]) {
continue;
}
$delids[] = $k;
unset($ar[$k]);
}
if (count($delids)) {
$ids = join(",", $delids);
sql_query("DELETE torrents t, peers p, files f FROM torrents t\n left join files f on f.torrent=t.id\n left join peers p on p.torrent=t.id\n WHERE f.torrent IN ({$ids}) \n OR p.torrent IN ({$ids}) \n OR t.id IN ({$ids})");
}
} while (0);
if ($queries > 0) {
write_log("Normalize clean-------------------- Normalize cleanup Complete using {$queries} queries --------------------");
}
if (false !== mysqli_affected_rows($GLOBALS["___mysqli_ston"])) {
$data['clean_desc'] = mysqli_affected_rows($GLOBALS["___mysqli_ston"]) . " items deleted/updated";
}
if ($data['clean_log']) {
cleanup_log($data);
}
}
示例13: docleanup
function docleanup($data)
{
global $INSTALLER09, $queries;
set_time_limit(0);
ignore_user_abort(1);
$lconf = sql_query('SELECT * FROM lottery_config') or sqlerr(__FILE__, __LINE__);
while ($aconf = mysqli_fetch_assoc($lconf)) {
$lottery_config[$aconf['name']] = $aconf['value'];
}
if ($lottery_config['enable'] && TIME_NOW > $lottery_config['end_date']) {
$q = mysqli_query($GLOBALS["___mysqli_ston"], 'SELECT t.user as uid, u.seedbonus, u.modcomment FROM tickets as t LEFT JOIN users as u ON u.id = t.user ORDER BY RAND() ') or sqlerr(__FILE__, __LINE__);
while ($a = mysqli_fetch_assoc($q)) {
$tickets[] = $a;
}
shuffle($tickets);
$lottery['winners'] = array();
$lottery['total_tickets'] = count($tickets);
for ($i = 0; $i < $lottery['total_tickets']; $i++) {
if (!isset($lottery['winners'][$tickets[$i]['uid']])) {
$lottery['winners'][$tickets[$i]['uid']] = $tickets[$i];
}
if ($lottery_config['total_winners'] == count($lottery['winners'])) {
break;
}
}
if ($lottery_config['use_prize_fund']) {
$lottery['total_pot'] = $lottery_config['prize_fund'];
} else {
$lottery['total_pot'] = $lottery['total_tickets'] * $lottery_config['ticket_amount'];
}
$lottery['user_pot'] = round($lottery['total_pot'] / $lottery_config['total_winners'], 2);
$msg['subject'] = sqlesc('You have won the lottery');
$msg['body'] = sqlesc('Congratulations, You have won : ' . $lottery['user_pot'] . '. This has been added to your seedbonus total amount. Thanks for playing Lottery.');
foreach ($lottery['winners'] as $winner) {
$_userq[] = '(' . $winner['uid'] . ',' . ($winner['seedbonus'] + $lottery['user_pot']) . ',' . sqlesc("User won the lottery: " . $lottery['user_pot'] . " at " . get_date(TIME_NOW, 'LONG') . "\n" . $winner['modcomment']) . ')';
$_pms[] = '(0,' . $winner['uid'] . ',' . $msg['subject'] . ',' . $msg['body'] . ',' . TIME_NOW . ')';
}
$lconfig_update = array('(\'enable\',0)', '(\'lottery_winners_time\',' . TIME_NOW . ')', '(\'lottery_winners_amount\',' . $lottery['user_pot'] . ')', '(\'lottery_winners\',\'' . join('|', array_keys($lottery['winners'])) . '\')');
if (count($_userq)) {
sql_query('INSERT INTO users(id,seedbonus,modcomment) VALUES ' . join(',', $_userq) . ' ON DUPLICATE KEY UPDATE seedbonus = values(seedbonus), modcomment = values(modcomment)') or die(is_object($GLOBALS["___mysqli_ston"]) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false));
}
if (count($_pms)) {
sql_query('INSERT INTO messages(sender, receiver, subject, msg, added) VALUES ' . join(',', $_pms)) or die(is_object($GLOBALS["___mysqli_ston"]) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false));
}
sql_query('INSERT INTO lottery_config(name,value) VALUES ' . join(',', $lconfig_update) . ' ON DUPLICATE KEY UPDATE value=values(value)') or die(is_object($GLOBALS["___mysqli_ston"]) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false));
sql_query('DELETE FROM tickets') or die(is_object($GLOBALS["___mysqli_ston"]) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false));
}
//==End 09 seedbonus lottery by putyn
if ($queries > 0) {
write_log("Lottery clean-------------------- lottery Complete using {$queries} queries --------------------");
}
if (false !== mysqli_affected_rows($GLOBALS["___mysqli_ston"])) {
$data['clean_desc'] = mysqli_affected_rows($GLOBALS["___mysqli_ston"]) . " items deleted";
}
if ($data['clean_log']) {
cleanup_log($data);
}
}
示例14: docleanup
function docleanup($data)
{
global $INSTALLER09, $queries, $mc1;
set_time_limit(1200);
ignore_user_abort(1);
// ===Clear funds on first day of the month
if (date("d") == 1) {
sql_query("TRUNCATE funds");
}
//if (mysqli_affected_rows() > 0)
$mc1->delete_value('totalfunds_');
// ===End
//== Donation Progress Mod Updated For Tbdev 2009/2010 by Bigjoos/pdq
$res = sql_query("SELECT id, modcomment, vipclass_before FROM users WHERE donor='yes' AND donoruntil < " . TIME_NOW . " AND donoruntil <> '0'") or sqlerr(__FILE__, __LINE__);
$msgs_buffer = $users_buffer = array();
if (mysqli_num_rows($res) > 0) {
$subject = "Donor status removed by system.";
$msg = "Your Donor status has timed out and has been auto-removed by the system, and your Vip status has been removed. We would like to thank you once again for your support to {$INSTALLER09['site_name']}. If you wish to re-new your donation, Visit the site paypal link. Cheers!\n";
while ($arr = mysqli_fetch_assoc($res)) {
$modcomment = $arr['modcomment'];
$modcomment = get_date(TIME_NOW, 'DATE', 1) . " - Donation status Automatically Removed By System.\n" . $modcomment;
$modcom = sqlesc($modcomment);
$msgs_buffer[] = '(0,' . $arr['id'] . ',' . TIME_NOW . ', ' . sqlesc($msg) . ',' . sqlesc($subject) . ')';
$users_buffer[] = '(' . $arr['id'] . ',' . $arr['vipclass_before'] . ',\'no\',\'0\', ' . $modcom . ')';
$update['class'] = $arr['vipclass_before'];
$mc1->begin_transaction('user' . $arr['id']);
$mc1->update_row(false, array('class' => $update['class'], 'donor' => 'no', 'donoruntil' => 0));
$mc1->commit_transaction($INSTALLER09['expires']['user_cache']);
$mc1->begin_transaction('user_stats_' . $arr['id']);
$mc1->update_row(false, array('modcomment' => $modcomment));
$mc1->commit_transaction($INSTALLER09['expires']['user_stats']);
$mc1->begin_transaction('MyUser_' . $arr['id']);
$mc1->update_row(false, array('class' => $update['class'], 'donor' => 'no', 'donoruntil' => 0));
$mc1->commit_transaction($INSTALLER09['expires']['curuser']);
$mc1->delete_value('inbox_new_' . $arr['id']);
$mc1->delete_value('inbox_new_sb_' . $arr['id']);
}
$count = count($users_buffer);
if ($count > 0) {
sql_query("INSERT INTO messages (sender,receiver,added,msg,subject) VALUES " . implode(', ', $msgs_buffer)) or sqlerr(__FILE__, __LINE__);
sql_query("INSERT INTO users (id, class, donor, donoruntil, modcomment) VALUES " . implode(', ', $users_buffer) . " ON DUPLICATE key UPDATE class=values(class),\n donor=values(donor),donoruntil=values(donoruntil),modcomment=concat(values(modcomment),modcomment)") or sqlerr(__FILE__, __LINE__);
write_log("Cleanup: Donation status expired - " . $count . " Member(s)");
}
unset($users_buffer, $msgs_buffer, $update, $count);
}
//===End===//
if ($queries > 0) {
write_log("Delete Old Funds Clean -------------------- Delete Old Funds cleanup Complete using {$queries} queries --------------------");
}
if (false !== mysqli_affected_rows($GLOBALS["___mysqli_ston"])) {
$data['clean_desc'] = mysqli_affected_rows($GLOBALS["___mysqli_ston"]) . " items deleted/updated";
}
if ($data['clean_log']) {
cleanup_log($data);
}
}
示例15: docleanup
function docleanup($data)
{
global $INSTALLER09, $queries, $mc1;
set_time_limit(1200);
ignore_user_abort(1);
//== Updated promote power users
$limit = 25 * 1024 * 1024 * 1024;
$minratio = 1.05;
$maxdt = TIME_NOW - 86400 * 28;
$res = sql_query("SELECT id, uploaded, downloaded, invites, modcomment FROM users WHERE class = " . UC_USER . " AND uploaded >= {$limit} AND uploaded / downloaded >= {$minratio} AND enabled='yes' AND added < {$maxdt}") or sqlerr(__FILE__, __LINE__);
$msgs_buffer = $users_buffer = array();
if (mysqli_num_rows($res) > 0) {
$subject = "Auto Promotion";
$msg = "Congratulations, you have been Auto-Promoted to [b]Power User[/b]. :)\n You get one extra invite.\n";
while ($arr = mysqli_fetch_assoc($res)) {
$ratio = number_format($arr['uploaded'] / $arr['downloaded'], 3);
$modcomment = $arr['modcomment'];
$modcomment = get_date(TIME_NOW, 'DATE', 1) . " - Promoted to Power User by System (UL=" . mksize($arr['uploaded']) . ", DL=" . mksize($arr['downloaded']) . ", R=" . $ratio . ").\n" . $modcomment;
$modcom = sqlesc($modcomment);
$msgs_buffer[] = '(0,' . $arr['id'] . ', ' . TIME_NOW . ', ' . sqlesc($msg) . ', ' . sqlesc($subject) . ')';
$users_buffer[] = '(' . $arr['id'] . ', 1, 1, ' . $modcom . ')';
$update['invites'] = $arr['invites'] + 1;
$mc1->begin_transaction('user' . $arr['id']);
$mc1->update_row(false, array('class' => 1, 'invites' => $update['invites']));
$mc1->commit_transaction($INSTALLER09['expires']['user_cache']);
$mc1->begin_transaction('user_stats_' . $arr['id']);
$mc1->update_row(false, array('modcomment' => $modcomment));
$mc1->commit_transaction($INSTALLER09['expires']['user_stats']);
$mc1->begin_transaction('MyUser_' . $arr['id']);
$mc1->update_row(false, array('class' => 1, 'invites' => $update['invites']));
$mc1->commit_transaction($INSTALLER09['expires']['curuser']);
$mc1->delete_value('inbox_new_' . $arr['id']);
$mc1->delete_value('inbox_new_sb_' . $arr['id']);
}
$count = count($users_buffer);
if ($count > 0) {
sql_query("INSERT INTO messages (sender,receiver,added,msg,subject) VALUES " . implode(', ', $msgs_buffer)) or sqlerr(__FILE__, __LINE__);
sql_query("INSERT INTO users (id, class, invites, modcomment) VALUES " . implode(', ', $users_buffer) . " ON DUPLICATE key UPDATE class=values(class), invites = invites+values(invites), modcomment=concat(values(modcomment),modcomment)") or sqlerr(__FILE__, __LINE__);
write_log("Cleanup: Promoted " . $count . " member(s) from User to Power User");
}
unset($users_buffer, $msgs_buffer, $update, $count);
status_change($arr['id']);
//== For Retros announcement mod
}
//==
if ($queries > 0) {
write_log("Power User Updates -------------------- Power User Updates Clean Complete using {$queries} queries--------------------");
}
if (false !== mysqli_affected_rows($GLOBALS["___mysqli_ston"])) {
$data['clean_desc'] = mysqli_affected_rows($GLOBALS["___mysqli_ston"]) . " items deleted/updated";
}
if ($data['clean_log']) {
cleanup_log($data);
}
}