mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 03:48:51 +08:00
add user ban log from cleanup.php
This commit is contained in:
@@ -559,8 +559,8 @@ class ExamRepository extends BaseRepository
|
||||
$userModcommentUpdate[] = sprintf("when `id` = %s then concat_ws('\n', '%s', modcomment)", $uid, $userModcomment);
|
||||
$banLogReason = nexus_trans('exam.ban_log_reason', [
|
||||
'exam_name' => $exam->name,
|
||||
'begin' => $exam->begin,
|
||||
'end' => $exam->end,
|
||||
'begin' => $examUser->begin,
|
||||
'end' => $examUser->end,
|
||||
], $locale);
|
||||
$userBanLog[] = [
|
||||
'uid' => $uid,
|
||||
@@ -587,7 +587,7 @@ class ExamRepository extends BaseRepository
|
||||
if (!empty($uidToDisable)) {
|
||||
$uidStr = implode(', ', $uidToDisable);
|
||||
$sql = sprintf(
|
||||
'update %s set enabled = %s, set modcomment = case when %s end where id in (%s)',
|
||||
"update %s set enabled = '%s', modcomment = case %s end where id in (%s)",
|
||||
$userTable, User::ENABLED_NO, implode(' ', $userModcommentUpdate), $uidStr
|
||||
);
|
||||
$updateResult = DB::update($sql);
|
||||
|
||||
@@ -21,11 +21,11 @@ class ToolRepository extends BaseRepository
|
||||
return $systemInfo;
|
||||
}
|
||||
|
||||
public function backupWebRoot()
|
||||
public function backupWeb()
|
||||
{
|
||||
$webRoot = base_path();
|
||||
$dirName = basename($webRoot);
|
||||
$filename = sprintf('%s/%s.%s.tar.gz', sys_get_temp_dir(), $dirName, date('Ymd.His'));
|
||||
$filename = sprintf('%s/%s.web.%s.tar.gz', sys_get_temp_dir(), $dirName, date('Ymd.His'));
|
||||
$command = sprintf(
|
||||
'tar --exclude=vendor --exclude=.git -czf %s -C %s %s',
|
||||
$filename, dirname($webRoot), $dirName
|
||||
@@ -57,7 +57,7 @@ class ToolRepository extends BaseRepository
|
||||
|
||||
public function backupAll($uploadToGoogleDrive = false)
|
||||
{
|
||||
$backupWeb = $this->backupWebRoot();
|
||||
$backupWeb = $this->backupWeb();
|
||||
if ($backupWeb['result_code'] != 0) {
|
||||
throw new \RuntimeException("backup web fail: " . json_encode($backupWeb));
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ class UserRepository extends BaseRepository
|
||||
public function getDetail($id)
|
||||
{
|
||||
$with = [
|
||||
'inviter' => function (Builder $query) {return $query->select(User::$commonFields);}
|
||||
'inviter' => function ($query) {return $query->select(User::$commonFields);}
|
||||
];
|
||||
$user = User::query()->with($with)->findOrFail($id, User::$commonFields);
|
||||
$userResource = new UserResource($user);
|
||||
|
||||
Reference in New Issue
Block a user