Page MenuHomePhabricator
Paste P2198

Maybe?
ActivePublic

Authored by Anomie on Oct 14 2015, 6:31 PM.
Tags
None
Referenced Files
F2721291: Maybe?
Oct 14 2015, 6:31 PM
Subscribers
None
/** In the WikimediaEvents extension, */
$wgHooks['UploadComplete'][] = function ( $u ) {
if ( !defined( 'MW_API' ) ) {
return true;
}
$request = RequestContext::getMain()->getRequest();
if ( !$request->response()->getHeader( 'Access-Control-Allow-Origin' ) ) {
return true;
}
// If necessary, add a request header to check instead of a 'crosswikiuploadtag' parameter.
// Or just do the parameter, if you don't mind unused parameter warnings.
$revId = $u->getLocalFile()->getTitle()->getLatestRevID( Title::GAID_FOR_UPDATE );
DeferredUpdates::addCallableUpdate( function () use ( $revId ) {
ChangeTags::addTags( 'Cross-wiki upload', null, $revId );
} );
return true;
};

Event Timeline

Anomie changed the title of this paste from untitled to Maybe?.
Anomie updated the paste's language from autodetect to php.