Go to the documentation of this file.
72 'check-label' =>
'revdelete-hide-text',
73 'success' =>
'revdelete-success',
74 'failure' =>
'revdelete-failure',
75 'text' =>
'revdelete-text-text',
76 'selected'=>
'revdelete-selected-text',
79 'check-label' =>
'revdelete-hide-text',
80 'success' =>
'revdelete-success',
81 'failure' =>
'revdelete-failure',
82 'text' =>
'revdelete-text-text',
83 'selected'=>
'revdelete-selected-text',
86 'check-label' =>
'revdelete-hide-image',
87 'success' =>
'revdelete-success',
88 'failure' =>
'revdelete-failure',
89 'text' =>
'revdelete-text-file',
90 'selected'=>
'revdelete-selected-file',
92 'filearchive' =>
array(
93 'check-label' =>
'revdelete-hide-image',
94 'success' =>
'revdelete-success',
95 'failure' =>
'revdelete-failure',
96 'text' =>
'revdelete-text-file',
97 'selected'=>
'revdelete-selected-file',
100 'check-label' =>
'revdelete-hide-name',
101 'success' =>
'logdelete-success',
102 'failure' =>
'logdelete-failure',
103 'text' =>
'logdelete-text',
104 'selected' =>
'logdelete-selected',
109 parent::__construct(
'Revisiondelete',
'deletedhistory' );
112 public function execute( $par ) {
122 $this->submitClicked = $request->wasPosted() && $request->getBool(
'wpSubmit' );
123 # Handle our many different possible input types.
124 $ids = $request->getVal(
'ids' );
125 if ( !is_null(
$ids ) ) {
126 # Allow CSV, for backwards compatibility, or a single ID for show/hide links
127 $this->ids = explode(
',',
$ids );
130 $this->ids = array_keys( $request->getArray(
'ids',
array() ) );
133 $this->ids = array_unique( array_filter( $this->ids ) );
135 if ( $request->getVal(
'action' ) ==
'historysubmit' || $request->getVal(
'action' ) ==
'revisiondelete' ) {
140 $this->typeName =
'revision';
142 $this->typeName = $request->getVal(
'type' );
146 # For reviewing deleted files...
147 $this->archiveName = $request->getVal(
'file' );
148 $this->
token = $request->getVal(
'token' );
149 if ( $this->archiveName && $this->targetObj ) {
158 if ( !$this->typeName || count( $this->ids ) == 0 ) {
159 throw new ErrorPageError(
'revdelete-nooldid-title',
'revdelete-nooldid-text' );
164 # Allow the list type to adjust the passed target
167 $this->otherReason = $request->getVal(
'wpReason' );
168 # We need a target page!
169 if ( is_null( $this->targetObj ) ) {
170 $output->addWikiMsg(
'undelete-header' );
174 # Give a link to the logs/hist for this page
177 # Initialise checkboxes
178 $this->checks =
array(
179 # Messages: revdelete-hide-
text, revdelete-hide-image, revdelete-hide-
name
180 array( $this->typeLabels[
'check-label'],
'wpHidePrimary',
186 if (
$user->isAllowed(
'suppressrevision' ) ) {
187 $this->checks[] =
array(
'revdelete-hide-restricted',
191 # Either submit or create our form
192 if ( $this->mIsAllowed && $this->submitClicked ) {
193 $this->
submit( $request );
199 # Show relevant lines from the deletion log
200 $deleteLogPage =
new LogPage(
'delete' );
201 $output->addHTML(
"<h2>" . $deleteLogPage->getName()->escaped() .
"</h2>\n" );
207 array(
'lim' => 25,
'conds' => $qc,
'useMaster' => $this->wasSaved )
209 # Show relevant lines from the suppression log
210 if (
$user->isAllowed(
'suppressionlog' ) ) {
211 $suppressLogPage =
new LogPage(
'suppress' );
212 $output->addHTML(
"<h2>" . $suppressLogPage->getName()->escaped() .
"</h2>\n" );
218 array(
'lim' => 25,
'conds' => $qc,
'useMaster' => $this->wasSaved )
227 # Give a link to the logs/hist for this page
228 if ( $this->targetObj ) {
230 $this->
getSkin()->setRelevantTitle( $this->targetObj );
235 $this->
msg(
'viewpagelogs' )->escaped(),
237 array(
'page' => $this->targetObj->getPrefixedText() )
239 if ( !$this->targetObj->isSpecialPage() ) {
240 # Give a link to the page history
243 $this->
msg(
'pagehist' )->escaped(),
245 array(
'action' =>
'history' )
247 # Link to deleted edits
248 if ( $this->
getUser()->isAllowed(
'undelete' ) ) {
252 $this->
msg(
'deletedhist' )->escaped(),
254 array(
'target' => $this->targetObj->getPrefixedDBkey() )
258 # Logs themselves don't have histories or archived revisions
270 $conds[
'log_type'] =
array(
'delete',
'suppress' );
271 $conds[
'log_action'] = $this->
getList()->getLogAction();
284 $oimage = $repo->newFromArchiveName( $this->targetObj,
$archiveName );
287 if ( !$oimage->exists() ) {
288 $this->
getOutput()->addWikiMsg(
'revdelete-no-file' );
302 $this->
getOutput()->addWikiMsg(
'revdelete-show-file-confirm',
303 $this->targetObj->getText(),
304 $lang->userDate( $oimage->getTimestamp(),
$user ),
305 $lang->userTime( $oimage->getTimestamp(),
$user ) );
310 'target' => $this->targetObj->getPrefixedDBkey(),
323 # We mustn't allow the output to be Squid cached, otherwise
324 # if an admin previews a deleted image, and it's cached, then
325 # a user without appropriate permissions can toddle off and
326 # nab the image, and Squid will serve it
327 $this->
getRequest()->response()->header(
'Expires: ' . gmdate(
'D, d M Y H:i:s', 0 ) .
' GMT' );
328 $this->
getRequest()->response()->header(
'Cache-Control: no-cache, no-store, max-age=0, must-revalidate' );
329 $this->
getRequest()->response()->header(
'Pragma: no-cache' );
331 $key = $oimage->getStorageKey();
332 $path = $repo->getZonePath(
'deleted' ) .
'/' . $repo->getDeletedHashPath( $key ) . $key;
333 $repo->streamFile(
$path );
340 if ( is_null( $this->revDelList ) ) {
342 $this->typeName, $this->
getContext(), $this->targetObj, $this->ids
357 $this->
getOutput()->wrapWikiMsg(
"<strong>$1</strong>",
array( $this->typeLabels[
'selected'],
358 $this->
getLanguage()->formatNum( count( $this->ids ) ), $this->targetObj->getPrefixedText() ) );
365 for ( $list->reset(); $list->current(); $list->next() ) {
366 $item = $list->current();
367 if ( !$item->canView() ) {
368 if ( !$this->submitClicked ) {
371 $userAllowed =
false;
374 $this->
getOutput()->addHTML( $item->getHTML() );
377 if ( !$numRevisions ) {
378 throw new ErrorPageError(
'revdelete-nooldid-title',
'revdelete-nooldid-text' );
386 if ( !$userAllowed ) {
391 if ( $this->mIsAllowed ) {
394 'id' =>
'mw-revdel-form-revisions' ) ) .
399 '<td class="mw-label">' .
402 '<td class="mw-input">' .
404 $this->
msg(
'revdelete-reason-dropdown' )->inContentLanguage()->
text(),
405 $this->
msg(
'revdelete-reasonotherlist' )->inContentLanguage()->
text(),
406 $this->
getRequest()->getText(
'wpRevDeleteReasonList',
'other' ),
'wpReasonDropDown', 1
410 '<td class="mw-label">' .
413 '<td class="mw-input">' .
414 Xml::input(
'wpReason', 60, $this->otherReason,
array(
'id' =>
'wpReason',
'maxlength' => 100 ) ) .
418 '<td class="mw-submit">' .
420 array(
'name' =>
'wpSubmit' ) ) .
425 Html::hidden(
'target', $this->targetObj->getPrefixedText() ) .
432 if ( $this->mIsAllowed ) {
435 if ( $this->
getUser()->isAllowed(
'editinterface' ) ) {
439 $this->
msg(
'revdelete-edit-reasonlist' )->escaped(),
441 array(
'action' =>
'edit' )
455 $this->
getOutput()->wrapWikiMsg(
"<strong>$1</strong>\n$2", $this->typeLabels[
'text'],
'revdelete-text-others' );
456 if ( $this->
getUser()->isAllowed(
'suppressrevision' ) ) {
457 $this->
getOutput()->addWikiMsg(
'revdelete-suppress-text' );
459 if ( $this->mIsAllowed ) {
460 $this->
getOutput()->addWikiMsg(
'revdelete-confirm' );
471 if ( $list->length() == 1 ) {
473 $bitfield = $list->current()->getBits();
474 if ( $this->submitClicked ) {
477 foreach ( $this->checks
as $item ) {
483 $innerHTML =
"<b>$innerHTML</b>";
486 $html .=
"<tr>$line</tr>\n";
491 $html .=
'<th class="mw-revdel-checkbox">' . $this->
msg(
'revdelete-radio-same' )->escaped() .
'</th>';
492 $html .=
'<th class="mw-revdel-checkbox">' . $this->
msg(
'revdelete-radio-unset' )->escaped() .
'</th>';
493 $html .=
'<th class="mw-revdel-checkbox">' . $this->
msg(
'revdelete-radio-set' )->escaped() .
'</th>';
494 $html .=
"<th></th></tr>\n";
495 foreach ( $this->checks
as $item ) {
500 if ( $this->submitClicked ) {
508 $label = $this->
msg( $message )->escaped();
510 $label =
"<b>$label</b>";
512 $line .=
"<td>$label</td>";
513 $html .=
"<tr>$line</tr>\n";
527 protected function submit() {
528 # Check edit token on submission
530 if ( $this->submitClicked && !$this->
getUser()->matchEditToken(
$token ) ) {
531 $this->
getOutput()->addWikiMsg(
'sessionfailure' );
536 $listReason = $this->
getRequest()->getText(
'wpRevDeleteReasonList',
'other' );
538 if (
$comment !=
'other' && $this->otherReason !=
'' ) {
544 # Can the user set this field?
548 # If the save went through, go to success message...
549 $status = $this->
save( $bitParams,
$comment, $this->targetObj );
550 if ( $status->isGood() ) {
555 # ...otherwise, bounce back to form...
567 $this->
getOutput()->setPageTitle( $this->
msg(
'actioncomplete' ) );
568 $this->
getOutput()->wrapWikiMsg(
"<span class=\"success\">\n$1\n</span>", $this->typeLabels[
'success'] );
569 $this->wasSaved =
true;
570 $this->revDelList->reloadFromMaster();
577 protected function failure( $status ) {
579 $this->
getOutput()->setPageTitle( $this->
msg(
'actionfailed' ) );
580 $this->
getOutput()->addWikiText( $status->getWikiText( $this->typeLabels[
'failure'] ) );
591 foreach ( $this->checks
as $item ) {
594 if ( $val < -1 || $val > 1 ) {
597 $bitfield[$field] = $val;
613 protected function save( $bitfield, $reason,
$title ) {
614 return $this->
getList()->setVisibility(
615 array(
'value' => $bitfield,
'comment' => $reason )
static checkLabel( $label, $name, $id, $checked=false, $attribs=array())
Convenience function to build an HTML checkbox with a label.
getPageTitle( $subpage=false)
Get a self-referential title object.
static & makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
static singleton()
Get a RepoGroup instance.
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses & $html
static tags( $element, $attribs=null, $contents)
Same as Xml::element(), but does not escape contents.
getOutput()
Get the OutputPage being used for this instance.
bool $wasSaved
Was the DB modified in this request *.
Shortcut to construct a special page which is unlisted by default.
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text
as a message key or array as accepted by ApiBase::dieUsageMsg after processing request parameters Return false to let the request returning an error message or an< edit result="Failure"> tag if $resultArr was filled which will be used in the intoken parameter and in the and a callback function which should return the token
array $typeLabels
UI Labels about the current type *.
checkPermissions()
Checks if userCanExecute, and if not throws a PermissionsError.
Special page allowing users with the appropriate permissions to view and hide revisions.
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name.
getSkin()
Shortcut to get the skin being used for this instance.
static hidden( $name, $value, $attribs=array())
Convenience function to produce an input element with type=hidden.
Show an error when a user tries to do something they do not have the necessary permissions for.
getLanguage()
Shortcut to get user's language.
set to $title object and return false for a match for latest after cache objects are set use the ContentHandler facility to handle CSS and JavaScript for highlighting & $link
static openElement( $element, $attribs=null)
This opens an XML element.
getList()
Get the list object for this request.
static linkKnown( $target, $html=null, $customAttribs=array(), $query=array(), $options=array( 'known', 'noclasses'))
Identical to link(), except $options defaults to 'known'.
bool $submitClicked
True if the submit button was clicked, and the form was posted *.
showConvenienceLinks()
Show some useful links in the subtitle.
static link( $target, $html=null, $customAttribs=array(), $query=array(), $options=array())
This function returns an HTML link to the given target.
getLogQueryCond()
Get the condition used for fetching log snippets.
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
string $typeName
Deletion type, may be revision, archive, oldimage, filearchive, logging.
failure( $status)
Report that the submit operation failed.
getFullTitle()
Return the full title, including $par.
Class to simplify the use of log pages.
static extractBitfield( $bitPars, $oldfield)
Put together a rev_deleted bitfield.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getUser()
Shortcut to get the User executing this instance.
string $archiveName
Archive name, for reviewing deleted files *.
array $checks
of checkbox specs (message, name, deletion bits) *
extractBitParams()
Put together an array that contains -1, 0, or the *_deleted const for each bit.
static createList( $typeName, IContextSource $context, Title $title, array $ids)
Instantiate the appropriate list class for a given list of IDs.
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
getContext()
Gets the context this SpecialPage is executed in.
Title $targetObj
object for target parameter *
showForm()
Show a list of items that we will operate on, and show a form with checkboxes which will allow the us...
static getRevdelConstant( $typeName)
Get the revision deletion constant for the RevDel type.
presenting them properly to the user as errors is done by the caller $title
Allows to change the fields on the form that will be generated $name
msg()
Wrapper around wfMessage that sets the current context.
success()
Report that the submit operation succeeded.
tryShowFile( $archiveName)
Show a deleted file version requested by the visitor.
getRequest()
Get the WebRequest being used for this instance.
addUsageText()
Show some introductory text.
static $UILabels
UI labels for each type.
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
Represents a title within MediaWiki.
static closeElement( $element)
Shortcut to close an XML element.
static listDropDown( $name='', $list='', $other='', $selected='', $class='', $tabindex=null)
Build a drop-down box from a textual list.
string $token
Edit token for securing image views against XSS *.
array $ids
Target ID list *.
static radio( $name, $value, $checked=false, $attribs=array())
Convenience function to build an HTML radio button.
static getRelationType( $typeName)
Get DB field name for URL param...
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
static submitButton( $value, $attribs=array())
Convenience function to build an HTML submit button.
static getCanonicalTypeName( $typeName)
Gets the canonical type name, if any.
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at name
checkReadOnly()
If the wiki is currently in readonly mode, throws a ReadOnlyError.
execute( $par)
Default execute method Checks user permissions, calls the function given in mFunction.
static input( $name, $size=false, $value=false, $attribs=array())
Convenience function to build an HTML text input field.
static label( $label, $id, $attribs=array())
Convenience function to build an HTML form label.
An error page which can definitely be safely rendered using the OutputPage.
static suggestTarget( $typeName, $target, array $ids)
Suggest a target for the revision deletion.
submit()
UI entry point for form submission.
static getRestriction( $typeName)
Get the user right required for the RevDel type.
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
save( $bitfield, $reason, $title)
Do the write operations.
bool $mIsAllowed
Whether user is allowed to perform the action *.
static fieldset( $legend=false, $content=false, $attribs=array())
Shortcut for creating fieldsets.
static showLogExtract(&$out, $types=array(), $page='', $user='', $param=array())
Show log extract.