Avoid shadowing global variable

When we aren't referencing the current `global $user`, we should give it
a different name to avoid confusion
This commit is contained in:
Shish
2019-11-11 16:24:13 +00:00
parent bde49c4f5e
commit 247cfcbd77
8 changed files with 31 additions and 31 deletions

View File

@@ -269,13 +269,13 @@ class CronUploader extends Extension
if (empty($user_id)) {
throw new SCoreException("Cron upload user not set");
}
$user = User::by_id($user_id);
if ($user == null) {
$my_user = User::by_id($user_id);
if ($my_user == null) {
throw new SCoreException("No user found for cron upload user $user_id");
}
send_event(new UserLoginEvent($user));
$this->log_message(SCORE_LOG_INFO, "Logged in as user {$user->name}");
send_event(new UserLoginEvent($my_user));
$this->log_message(SCORE_LOG_INFO, "Logged in as user {$my_user->name}");
$lockfile = fopen($this->get_lock_file(), "w");
if (!flock($lockfile, LOCK_EX | LOCK_NB)) {