Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Paste
P2198
Maybe?
Active
Public
Actions
Authored by
Anomie
on Oct 14 2015, 6:31 PM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
None
Referenced Files
F2721291: Maybe?
Oct 14 2015, 6:31 PM
2015-10-14 18:31:04 (UTC+0)
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
edited the content of this paste.
(Show Details)
Oct 14 2015, 6:31 PM
2015-10-14 18:31:04 (UTC+0)
Anomie
changed the title of this paste from untitled to
Maybe?
.
Anomie
updated the paste's language from
autodetect
to
php
.
matmarex
mentioned this in
T115328: Add a change Tag to media uploaded to Commons through the cross-wiki upload tool
.
Oct 14 2015, 7:22 PM
2015-10-14 19:22:31 (UTC+0)
Log In to Comment