edwardspec / mediawiki-aws-s3

Extension:AWS allows MediaWiki to use Amazon S3 (instead of the local directory) to store images.
https://www.mediawiki.org/wiki/Extension:AWS
GNU General Public License v2.0
42 stars 32 forks source link

Avoid the use of deprecated wfSuppressWarnings() #28

Closed samwilson closed 5 years ago

samwilson commented 5 years ago

The wfSuppressWarnings and wfRestoreWarnings functions were deprecated in MediaWiki 1.26 and removed in 1.34. This change switches to using Wikimedia\AtEase\AtEase::suppressWarnings().

https://www.mediawiki.org/wiki/Release_notes/1.34#Breaking_changes_in_1.34

edwardspec commented 5 years ago

Looks good.

Will need to keep it backward compatible, though, because this extension uses "master" compatibility policy (instead of REL_ branches). E.g. by adding a wrapper function that would call Wikimedia\AtEase\AtEase::suppressWarnings() in MW 1.34+, and wfSuppressWarnings() in earlier versions.

samwilson commented 5 years ago

Good point!

Actually, the suppression of warnings at all feels a bit wrong. Maybe the best change here would be to switch to using a MWHttpRequest to retrieve the file. Do you think that'd work? Then it'd get standard error handling etc.

edwardspec commented 5 years ago

Agreed. Something like

file_put_contents( $dstPath, Http::get( $srcPath ) );
samwilson commented 5 years ago

Thanks!