| @@ 45-65 (lines=21) @@ | ||
| 42 | * @param UploadStash|bool $stash Default: false |
|
| 43 | * @param FileRepo|bool $repo Default: false |
|
| 44 | */ |
|
| 45 | public function __construct( $user = null, $stash = false, $repo = false ) { |
|
| 46 | // user object. sometimes this won't exist, as when running from cron. |
|
| 47 | $this->user = $user; |
|
| 48 | ||
| 49 | if ( $repo ) { |
|
| 50 | $this->repo = $repo; |
|
| 51 | } else { |
|
| 52 | $this->repo = RepoGroup::singleton()->getLocalRepo(); |
|
| 53 | } |
|
| 54 | ||
| 55 | if ( $stash ) { |
|
| 56 | $this->stash = $stash; |
|
| 57 | } else { |
|
| 58 | if ( $user ) { |
|
| 59 | wfDebug( __METHOD__ . " creating new UploadFromChunks instance for " . $user->getId() . "\n" ); |
|
| 60 | } else { |
|
| 61 | wfDebug( __METHOD__ . " creating new UploadFromChunks instance with no user\n" ); |
|
| 62 | } |
|
| 63 | $this->stash = new UploadStash( $this->repo, $this->user ); |
|
| 64 | } |
|
| 65 | } |
|
| 66 | ||
| 67 | /** |
|
| 68 | * Calls the parent stashFile and updates the uploadsession table to handle "chunks" |
|
| @@ 47-68 (lines=22) @@ | ||
| 44 | * @param UploadStash|bool $stash Default: false |
|
| 45 | * @param FileRepo|bool $repo Default: false |
|
| 46 | */ |
|
| 47 | public function __construct( $user = false, $stash = false, $repo = false ) { |
|
| 48 | // user object. sometimes this won't exist, as when running from cron. |
|
| 49 | $this->user = $user; |
|
| 50 | ||
| 51 | if ( $repo ) { |
|
| 52 | $this->repo = $repo; |
|
| 53 | } else { |
|
| 54 | $this->repo = RepoGroup::singleton()->getLocalRepo(); |
|
| 55 | } |
|
| 56 | ||
| 57 | if ( $stash ) { |
|
| 58 | $this->stash = $stash; |
|
| 59 | } else { |
|
| 60 | if ( $user ) { |
|
| 61 | wfDebug( __METHOD__ . " creating new UploadStash instance for " . $user->getId() . "\n" ); |
|
| 62 | } else { |
|
| 63 | wfDebug( __METHOD__ . " creating new UploadStash instance with no user\n" ); |
|
| 64 | } |
|
| 65 | ||
| 66 | $this->stash = new UploadStash( $this->repo, $this->user ); |
|
| 67 | } |
|
| 68 | } |
|
| 69 | ||
| 70 | /** |
|
| 71 | * @param string $key |
|