X-Git-Url: https://git.cyclocoop.org/%27.%24link.%27?a=blobdiff_plain;f=includes%2Fupload%2FUploadStash.php;h=1c3e13b985ab92403b1a2b884b414a94ed3170f0;hb=58713d2b1611e55fcd0cf7647af8d96ebc1e88bf;hp=c171ded7da02abc554456fe4a9de6671c95b9b5a;hpb=d3b49d9ebba16ac400f6a3aa4d85662c3e5545ef;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/upload/UploadStash.php b/includes/upload/UploadStash.php index c171ded7da..1c3e13b985 100644 --- a/includes/upload/UploadStash.php +++ b/includes/upload/UploadStash.php @@ -73,8 +73,8 @@ class UploadStash { // fileprops cache protected $fileProps = []; - // current user - protected $user, $userId, $isLoggedIn; + // current user info + protected $userId, $isLoggedIn; /** * Represents a temporary filestore, with metadata in the database. @@ -82,25 +82,15 @@ class UploadStash { * (should replace it eventually). * * @param FileRepo $repo - * @param User $user (default null) + * @param User $user */ - public function __construct( FileRepo $repo, $user = null ) { + public function __construct( FileRepo $repo, User $user ) { // this might change based on wiki's configuration. $this->repo = $repo; - // if a user was passed, use it. otherwise, attempt to use the global. - // this keeps FileRepo from breaking when it creates an UploadStash object - if ( $user ) { - $this->user = $user; - } else { - global $wgUser; - $this->user = $wgUser; - } - - if ( is_object( $this->user ) ) { - $this->userId = $this->user->getId(); - $this->isLoggedIn = $this->user->isLoggedIn(); - } + // We only need the logged in status and user id. + $this->userId = $user->getId(); + $this->isLoggedIn = $user->isLoggedIn(); } /**