Skip to content

Commit

Permalink
Fixed issue: Update 446 should not create a session when called from …
Browse files Browse the repository at this point in the history
…command-line
  • Loading branch information
olleharstedt committed Oct 28, 2021
1 parent 3f63b85 commit 117979f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion application/helpers/update/updatedb_helper.php
Expand Up @@ -5887,7 +5887,8 @@ function upgradeArchivedTableSettings446()
$DBPrefix = Yii::app()->db->tablePrefix;
$datestamp = time();
$DBDate = date('Y-m-d H:i:s', $datestamp);
$userID = Yii::app()->user->getId();
// TODO: Inject user model instead. Polling for user will create a session, which breaks on command-line.
$userID = php_sapi_name() === 'cli' ? null : Yii::app()->user->getId();
$forcedSuperadmin = Yii::app()->getConfig('forcedsuperadmin');
$adminUserId = 1;

Expand Down

1 comment on commit 117979f

@olleharstedt
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ptelu Please review.

Please sign in to comment.