PiRSquared17 / mediawiki-page-attachment

Automatically exported from code.google.com/p/mediawiki-page-attachment
Other
0 stars 0 forks source link

Update code to handle Local, Foreign, Shared, Swift image/file repositories #75

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Update code to handle Local, Foreign, Shared, Swift image/file repositories.

-- Take security/credential requirement into account if necessary.

Original issue reported on code.google.com by Aldrin.Baroi@gmail.com on 15 May 2013 at 6:24

GoogleCodeExporter commented 9 years ago

Original comment by Aldrin.Baroi@gmail.com on 15 May 2013 at 6:27

GoogleCodeExporter commented 9 years ago

Original comment by Aldrin.Baroi@gmail.com on 15 May 2013 at 6:42

GoogleCodeExporter commented 9 years ago

Original comment by Aldrin.Baroi@gmail.com on 15 May 2013 at 6:46

GoogleCodeExporter commented 9 years ago
Looks like "StreamFile" class was added to MediaWiki core from version 1.19 
which is kind of similar to PageAttachment's "FileStreamer" class that was 
added when MediaWiki was version 1.16.  Let's see if this "StreamFile" class 
can be used across all repositories without figuring out the file/repository 
backend.

Original comment by Aldrin.Baroi@gmail.com on 19 May 2013 at 7:06

GoogleCodeExporter commented 9 years ago
Local repository access working.

Working on Swift file system.

Original comment by Aldrin.Baroi@gmail.com on 12 Jun 2013 at 7:31

GoogleCodeExporter commented 9 years ago
Great!  Thanks for working on this.

I couldn't find the patch for local repos in your hg repo; let me know when you 
have a patch you'd like me to test.

Original comment by t...@cyrius.com on 12 Jun 2013 at 9:15

GoogleCodeExporter commented 9 years ago
Hi tbm:

I haven't checked in the code yet for the following reasons: 

Tested the local repository file streamer by hard coding it, since, I haven't 
figured out a good way to distinguish the repository type being accessed.  In 
addition, restructured the file streaming handler classes & package; however, 
not sure if this is workable for other type of repositories.  Currently working 
on making it work with Swift repository.  

Sincerely yours,

Aldrin

Original comment by Aldrin.Baroi@gmail.com on 13 Jun 2013 at 3:59

GoogleCodeExporter commented 9 years ago
Current approach is not workable...

Need to rethink...

Built in file streamer obtained from repogroup->filebackend not working... pdf 
files are okay when http header is set to "Content-Type: 
application/x-download", however, image files get corrupted!!! why?

Original comment by Aldrin.Baroi@gmail.com on 7 Jul 2013 at 1:50

GoogleCodeExporter commented 9 years ago
Code is now more or less working for both local & Swift repository...

However, it is working only for PHP 5.4 through the use for "Closure" 
functionality.  Need to figure out what to do with PHP 5.3.  Maybe submit a 
enhancement request for MediaWiki to allow/expose file streamer settings 
changed or provide a new method to stream a file for user download.

Code need a little cleanup before checking in.

Original comment by Aldrin.Baroi@gmail.com on 14 Aug 2013 at 8:19

GoogleCodeExporter commented 9 years ago

Original comment by Aldrin.Baroi@gmail.com on 14 Aug 2013 at 8:24

GoogleCodeExporter commented 9 years ago

Original comment by Aldrin.Baroi@gmail.com on 14 Aug 2013 at 8:26

GoogleCodeExporter commented 9 years ago

Original comment by Aldrin.Baroi@gmail.com on 14 Aug 2013 at 8:30

GoogleCodeExporter commented 9 years ago
Great, thanks for working on this, Aldrin!

Original comment by t...@cyrius.com on 14 Aug 2013 at 8:42

GoogleCodeExporter commented 9 years ago
Hi tbm:

The new code to replace old file streaming code for download is checked in.  

New code uses MediaWiki's "streamFile" method.  However, MediaWiki's 
"streamFile" method cannot be used directly; since, it dosen't have the option 
to specify that the file is being streamed for download.  So, a workaround was 
devised.  This workaround is working for the following:

For PHP 5.4 & greater -- will work for any file repository.

For PHP 5.3 -- working for local file repository.  
            -- Work in progress to make it work for Swift.

let me know if you encounter any issues.

Sincerely yours,

Aldrin

Original comment by Aldrin.Baroi@gmail.com on 17 Aug 2013 at 9:37

GoogleCodeExporter commented 9 years ago
That's great, thanks.

Unfortunately, I'm about to go on holidays but I'll check it out when I return 
in 2 weeks.

Thanks!

Original comment by t...@cyrius.com on 20 Aug 2013 at 11:58

GoogleCodeExporter commented 9 years ago
Hi Aldrin,

Sorry this took so long.  I finally got a chance to test your patch.

I checked out the repo with hg.  I then made a diff of src/ between hg branch 
v3.1.0 and v3.2.0 and applied the patch to my MediaWiki installation.

Results:

When *not* logged in, it directs to /index.php/Main_Page and I see the 
following under attachments: » 
<FailedSendTheRequestedFile_ContactSystemAdministrator> «

When logged in, it directs to /index.php/Main_Page and I see the following 
under attachments: » Security Warning: Unable to Authenticate Your Request «

Any idea what's going wrong?

Original comment by t...@cyrius.com on 26 Jun 2014 at 10:54