use MediaWiki\MediaWikiServices;
define( 'MW_NO_OUTPUT_COMPRESSION', 1 );
+define( 'MW_ENTRY_POINT', 'thumb' );
require __DIR__ . '/includes/WebStart.php';
// Don't use fancy MIME detection, just check the file extension for jpg/gif/png
wfThumbHandle404();
} else {
// Called directly, use $_GET params
- wfStreamThumb( $wgRequest->getQueryValues() );
+ wfStreamThumb( $wgRequest->getQueryValuesOnly() );
}
$mediawiki = new MediaWiki();
*/
function wfStreamThumb( array $params ) {
global $wgVaryOnXFP;
+ $permissionManager = MediaWikiServices::getInstance()->getPermissionManager();
$headers = []; // HTTP headers to send
// Check permissions if there are read restrictions
$varyHeader = [];
- if ( !in_array( 'read', User::getGroupPermissions( [ '*' ] ), true ) ) {
+ if ( !in_array( 'read', $permissionManager->getGroupPermissions( [ '*' ] ), true ) ) {
$user = RequestContext::getMain()->getUser();
- $permissionManager = MediaWikiServices::getInstance()->getPermissionManager();
$imgTitle = $img->getTitle();
if ( !$imgTitle || !$permissionManager->userCan( 'read', $user, $imgTitle ) ) {
* /w/images/thumb/a/ab/Foo.png/120px-Foo.png. The $thumbRel parameter
* of this function would be set to "a/ab/Foo.png/120px-Foo.png".
* This method is responsible for turning that into an array
- * with the folowing keys:
+ * with the following keys:
* * f => the filename (Foo.png)
* * rel404 => the whole thing (a/ab/Foo.png/120px-Foo.png)
* * archived => 1 (If the request is for an archived thumb)