remove leech warn

This commit is contained in:
xiaomlove
2022-05-13 15:56:09 +08:00
parent 6eeac797a4
commit 155d4ddcb6
10 changed files with 77 additions and 23 deletions
+4 -4
View File
@@ -45,7 +45,7 @@ class NexusUpdate extends Command
require ROOT_PATH . 'nexus/Database/helpers.php';
//Step 1
$step = $this->update->currentStep();
$log = "Step 1, Checking environment...";
$log = sprintf('Step %s, %s...', $step, $this->update->getStepName($step));
$this->doLog($log);
$requirements = $this->update->listRequirementTableRows();
$fails = $requirements['fails'];
@@ -58,17 +58,17 @@ class NexusUpdate extends Command
$this->update->gotoStep(++$step);
//Step 2
$log = "Step 2, get files, cli skip...";
$log = sprintf('Step %s, %s, cli skip...', $step, $this->update->getStepName($step));
$this->doLog($log);
$this->update->gotoStep(++$step);
//Step 3
$log = "Step 3, update .env, cli skip...";
$log = sprintf('Step %s, %s, cli skip...', $step, $this->update->getStepName($step));
$this->doLog($log);
$this->update->gotoStep(++$step);
//Step 4
$log = "Step 4, perform update...";
$log = sprintf('Step %s, %s...', $step, $this->update->getStepName($step));
$this->doLog($log);
$settingTableRows = $this->update->listSettingTableRows();
$settings = $settingTableRows['settings'];
+16
View File
@@ -282,6 +282,22 @@ class UserRepository extends BaseRepository
return true;
}
public function removeLeechWarn($operator, $uid): bool
{
if (!$operator instanceof User) {
$operator = User::query()->findOrFail(intval($operator), User::$commonFields);
}
$classRequire = Setting::get('authority.prfmanage');
if ($operator->class < $classRequire) {
throw new \RuntimeException("No permission.");
}
$user = User::query()->findOrFail($uid, User::$commonFields);
NexusDB::cache_del('user_'.$uid.'_content');
$user->leechwarn = 'no';
$user->leechwarnuntil = null;
return $user->save();
}
}