mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-22 10:57:27 +08:00
fix cleanup + attendance bonus
This commit is contained in:
@@ -12,6 +12,7 @@ Complete PT website building solution. Based on NexusPHP + Laravel Framework + E
|
||||
- H&R
|
||||
- Attendance
|
||||
- Medal
|
||||
- Custom tags
|
||||
- Forum
|
||||
- Multi-language
|
||||
- Automatic backup
|
||||
|
||||
@@ -3,6 +3,7 @@ namespace App\Repositories;
|
||||
|
||||
use App\Models\Attendance;
|
||||
use App\Models\Setting;
|
||||
use App\Models\User;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class AttendanceRepository extends BaseRepository
|
||||
@@ -55,6 +56,7 @@ class AttendanceRepository extends BaseRepository
|
||||
}
|
||||
do_log("[DO_UPDATE]: " . nexus_json_encode($update));
|
||||
$attendance->update($update);
|
||||
User::query()->where('id', $uid)->increment('seedbonus', $update['points']);
|
||||
}
|
||||
}
|
||||
$attendance->added_time = $now->toTimeString();
|
||||
|
||||
+12
-8
@@ -308,8 +308,9 @@ function docleanup($forceAll = 0, $printProgress = false) {
|
||||
$row = mysql_fetch_array($res);
|
||||
if (!$row) {
|
||||
sql_query("INSERT INTO avps (arg, value_u) VALUES ('lastcleantime2',".sqlesc($now).")") or sqlerr(__FILE__, __LINE__);
|
||||
do_log("no value for arg: 'lastcleantime2', return");
|
||||
return;
|
||||
$log = "no value for arg: 'lastcleantime2', return";
|
||||
do_log($log);
|
||||
return $log;
|
||||
}
|
||||
$ts = $row[0];
|
||||
if ($ts + $autoclean_interval_two > $now && !$forceAll) {
|
||||
@@ -333,8 +334,9 @@ function docleanup($forceAll = 0, $printProgress = false) {
|
||||
$row = mysql_fetch_array($res);
|
||||
if (!$row) {
|
||||
sql_query("INSERT INTO avps (arg, value_u) VALUES ('lastcleantime3',$now)") or sqlerr(__FILE__, __LINE__);
|
||||
do_log("no value for arg: 'lastcleantime3', return");
|
||||
return;
|
||||
$log = "no value for arg: 'lastcleantime3', return";
|
||||
do_log($log);
|
||||
return $log;
|
||||
}
|
||||
$ts = $row[0];
|
||||
if ($ts + $autoclean_interval_three > $now && !$forceAll) {
|
||||
@@ -492,8 +494,9 @@ function docleanup($forceAll = 0, $printProgress = false) {
|
||||
$row = mysql_fetch_array($res);
|
||||
if (!$row) {
|
||||
sql_query("INSERT INTO avps (arg, value_u) VALUES ('lastcleantime4',$now)") or sqlerr(__FILE__, __LINE__);
|
||||
do_log("no value for arg: 'lastcleantime4', return");
|
||||
return;
|
||||
$log = "no value for arg: 'lastcleantime4', return";
|
||||
do_log($log);
|
||||
return $log;
|
||||
}
|
||||
$ts = $row[0];
|
||||
if ($ts + $autoclean_interval_four > $now && !$forceAll) {
|
||||
@@ -818,8 +821,9 @@ function docleanup($forceAll = 0, $printProgress = false) {
|
||||
$row = mysql_fetch_array($res);
|
||||
if (!$row) {
|
||||
sql_query("INSERT INTO avps (arg, value_u) VALUES ('lastcleantime5',$now)") or sqlerr(__FILE__, __LINE__);
|
||||
do_log("no value for arg: 'lastcleantime5', return");
|
||||
return;
|
||||
$log = "no value for arg: 'lastcleantime5', return";
|
||||
do_log($log);
|
||||
return $log;
|
||||
}
|
||||
$ts = $row[0];
|
||||
if ($ts + $autoclean_interval_five > $now && !$forceAll) {
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
require "bittorrent.php";
|
||||
require 'cleanup.php';
|
||||
|
||||
$fd = fopen(sprintf('%s/nexus_cleanup_cli.lock', sys_get_temp_dir()), 'w+');
|
||||
if (!flock($fd, LOCK_EX|LOCK_NB)) {
|
||||
@@ -21,19 +22,18 @@ $force = 0;
|
||||
if (isset($_SERVER['argv'][1])) {
|
||||
$force = $_SERVER['argv'][1] ? 1 : 0;
|
||||
}
|
||||
|
||||
$logPrefix = "[CLEANUP_CLI]";
|
||||
try {
|
||||
if ($force) {
|
||||
require_once(ROOT_PATH . 'include/cleanup.php');
|
||||
$result = docleanup(1, true);
|
||||
} else {
|
||||
$result = autoclean();
|
||||
$result = autoclean(true);
|
||||
}
|
||||
$log = "[CLEANUP_CLI DONE!] $result";
|
||||
$log = "$logPrefix, DONE: $result";
|
||||
do_log($log);
|
||||
printProgress($log);
|
||||
} catch (\Exception $exception) {
|
||||
$log = "ERROR: " . $exception->getMessage();
|
||||
$log = "$logPrefix, ERROR: " . $exception->getMessage();
|
||||
do_log($log);
|
||||
printProgress($log);
|
||||
throw new \RuntimeException($exception->getMessage());
|
||||
|
||||
@@ -1902,7 +1902,7 @@ function userlogin() {
|
||||
return $loginResult = true;
|
||||
}
|
||||
|
||||
function autoclean() {
|
||||
function autoclean($printProgress = false) {
|
||||
global $autoclean_interval_one, $rootpath;
|
||||
$now = TIMENOW;
|
||||
$res = sql_query("SELECT value_u FROM avps WHERE arg = 'lastcleantime'");
|
||||
@@ -1923,7 +1923,7 @@ function autoclean() {
|
||||
return false;
|
||||
}
|
||||
require_once($rootpath . 'include/cleanup.php');
|
||||
return docleanup();
|
||||
return docleanup(0, $printProgress);
|
||||
}
|
||||
|
||||
function unesc($x) {
|
||||
|
||||
+1
-1
@@ -168,7 +168,7 @@ if (!$row) {
|
||||
}
|
||||
}
|
||||
}
|
||||
print("<td class=\"embedded\"><form method=\"get\" action=\"http://shooter.cn/sub/\" target=\"_blank\"><input type=\"text\" name=\"searchword\" id=\"keyword\" style=\"width: 250px\" value=\"".$moviename."\" /><input type=\"submit\" value=\"".$lang_details['submit_search_at_shooter']."\" /></form></td><td class=\"embedded\"><form method=\"get\" action=\"http://www.opensubtitles.org/en/search2/\" target=\"_blank\"><input type=\"hidden\" id=\"moviename\" name=\"MovieName\" /><input type=\"hidden\" name=\"action\" value=\"search\" /><input type=\"hidden\" name=\"SubLanguageID\" value=\"all\" /><input onclick=\"document.getElementById('moviename').value=document.getElementById('keyword').value;\" type=\"submit\" value=\"".$lang_details['submit_search_at_opensubtitles']."\" /></form></td>\n");
|
||||
print("<td class=\"embedded\"><form method=\"get\" action=\"https://assrt.net/sub/\" target=\"_blank\"><input type=\"text\" name=\"searchword\" id=\"keyword\" style=\"width: 250px\" value=\"".$moviename."\" /><input type=\"submit\" value=\"".$lang_details['submit_search_at_shooter']."\" /></form></td><td class=\"embedded\"><form method=\"get\" action=\"https://www.opensubtitles.org/en/search2/\" target=\"_blank\"><input type=\"hidden\" id=\"moviename\" name=\"MovieName\" /><input type=\"hidden\" name=\"action\" value=\"search\" /><input type=\"hidden\" name=\"SubLanguageID\" value=\"all\" /><input onclick=\"document.getElementById('moviename').value=document.getElementById('keyword').value;\" type=\"submit\" value=\"".$lang_details['submit_search_at_opensubtitles']."\" /></form></td>\n");
|
||||
print("</tr></table>");
|
||||
print("</td></tr>\n");
|
||||
// ---------------- end subtitle block -------------------//
|
||||
|
||||
Reference in New Issue
Block a user