$result = $this->getResult();
try {
- $stash = new UploadStash();
+ $stash = RepoGroup::singleton()->getLocalRepo()->getUploadStash();
foreach ( $params['sessionkey'] as $sessionkey ) {
$file = $stash->getFile( $sessionkey );
array_unshift( $args, 'filerepo', $this->getName() );
return call_user_func_array( 'wfMemcKey', $args );
}
+
+ /**
+ * Get an UploadStash associated with this repo.
+ */
+ function getUploadStash() {
+ return new UploadStash( $this );
+ }
}
global $wgUser;
if ( $this->mSessionKey ) {
- $stash = new UploadStash;
+ $stash = RepoGroup::singleton()->getLocalRepo()->getUploadStash();
try {
$file = $stash->getFile( $this->mSessionKey );
} catch ( MWException $e ) {
parent::__construct( 'UploadStash', 'upload' );
try {
- $this->stash = new UploadStash( );
+ $this->stash = RepoGroup::singleton()->getLocalRepo()->getUploadStash();
} catch ( UploadStashNotAvailableException $e ) {
return null;
}
* @return File: stashed file
*/
public function stashSessionFile( $key = null ) {
- $stash = new UploadStash();
+ $stash = RepoGroup::singleton()->getLocalRepo()->getUploadStash();;
$data = array(
'mFileProps' => $this->mFileProps,
'mSourceType' => $this->getSourceType(),
* Represents the session which contains temporarily stored files.
* Designed to be compatible with the session stashing code in UploadBase (should replace it eventually)
*/
- public function __construct() {
+ public function __construct( $repo ) {
// this might change based on wiki's configuration.
- $this->repo = RepoGroup::singleton()->getLocalRepo();
+ $this->repo = $repo;
if ( ! isset( $_SESSION ) ) {
throw new UploadStashNotAvailableException( 'no session variable' );