Page MenuHomePhabricator

oversight2.patch

Authored By
bzimport
Nov 21 2014, 9:29 PM
Size
8 KB
Referenced Files
None
Subscribers
None

oversight2.patch

Index: HideRevision.i18n.php
===================================================================
--- HideRevision.i18n.php (revision 19540)
+++ HideRevision.i18n.php (working copy)
@@ -37,11 +37,19 @@
'hiderevision-error-current' => 'Cannot delete the latest edit to a page. Revert this change first.',
'hiderevision-error-delete' => 'Could not archive; was it previously deleted?',
'hiderevision-archive-status' => 'Deleted revision from $1: $2',
+'oversight-nodiff' => 'Unable to track changes as there is currently no previous revision for the page. Either:
+*The page was deleted
+*This hidden revision was the first revision',
// Logging
'oversight-log-hiderev' => 'removed an edit from $1',
// Oversight review page
'oversight' => 'Oversight',
'oversight-view' => 'details',
+'oversight-difference' => '(Difference from previous remaining revision)',
+'oversight-prev' => 'Last previous revision',
+'oversight-hidden' => 'Hidden revision',
+'oversight-header' => 'Below is a list of revisions permanantly hidden from public view.
+Releasing this information can result in permanent loss of Oversight priviledges.',
),
/* German (Raymond) */
@@ -108,11 +116,18 @@
'hiderevision-error-current' => 'Ne peut supprimer la dernière révision dans une page. Faites une annulation d’édition auparavant.',
'hiderevision-error-delete' => 'Ne peut être archivé ; la page a peut-être été supprimée ?',
'hiderevision-archive-status' => 'Modification supprimée de $1 : $2',
+'oversight-nodiff' => 'Incapable de dépister des changements en tant que là n\'est actuellement aucune révision précédente pour la page. L\'un ou l\'autre:
+*La page a été supprimée
+*Cette révision cachée était la première révision de la page',
// Logging
'oversight-log-hiderev' => 'a supprimé une édition de $1',
// Oversight review page
'oversight' => 'Oversight',
'oversight-view' => 'détails',
+'oversight-difference' => '(Différence de révision restante précédente)',
+'oversight-prev' => 'Dernière révision précédente',
+'oversight-hidden' => 'Révision cachée',
+'oversight-header' => 'Au-dessous de est une liste de révisions cachées de manière permanente de la vue publique. Libérer cette information peut avoir comme conséquence la perte permanente de priviledges d\'Oversight.',
),
/* Portuguese (Lugusto) */
Index: HideRevision.php
===================================================================
--- HideRevision.php (revision 18857)
+++ HideRevision.php (working copy)
@@ -56,10 +56,8 @@
require_once( dirname( __FILE__ ) . '/HideRevision.i18n.php' );
foreach( hrHideRevisionMessages() as $lang => $messages )
$GLOBALS['wgMessageCache']->addMessages( $messages, $lang );
-
}
-
/**
* Hook for article view, giving us a chance to insert a removal
* tab on old version views.
@@ -195,11 +193,11 @@
'method' => 'post' ) ) .
// Visible fields
- wfInputLabel( wfMsg( 'hiderevision-prompt' ), 'revision[]', 'wpRevision', 10 ) .
+ wfInputLabel( wfMsgHTML( 'hiderevision-prompt' ), 'revision[]', 'wpRevision', 10 ) .
"<br />" .
- wfInputLabel( wfMsg( 'hiderevision-reason' ), 'wpReason', 'wpReason', 60 ) .
+ wfInputLabel( wfMsgHTML( 'hiderevision-reason' ), 'wpReason', 'wpReason', 60 ) .
"<br />" .
- wfSubmitButton( wfMsg( 'hiderevision-continue' ) ) .
+ wfSubmitButton( wfMsgHTML( 'hiderevision-continue' ) ) .
wfCloseElement( 'form' ) );
}
@@ -224,9 +222,9 @@
// Visible fields
"<br />" .
- wfInputLabel( wfMsg( 'hiderevision-reason' ), 'wpReason', 'wpReason', 60, $this->mReason ) .
+ wfInputLabel( wfMsgHTML( 'hiderevision-reason' ), 'wpReason', 'wpReason', 60, $this->mReason ) .
"<br />" .
- wfSubmitButton( wfMsg( 'hiderevision-submit' ) ) .
+ wfSubmitButton( wfMsgHTML( 'hiderevision-submit' ) ) .
// Hidden fields
$this->revisionFields() .
@@ -352,16 +350,16 @@
function hrHideRevisions( $dbw, $title, $revisions, $timestamps, $reason ) {
// Live revisions
foreach( $revisions as $id ) {
- $success[] = wfMsg( 'hiderevision-status', $id,
- wfMsg( hrHideRevision( $dbw, $id, $reason ) ) );
+ $success[] = wfMsgHTML( 'hiderevision-status', $id,
+ wfMsgHTML (hrHideRevision( $dbw, $id, $reason ) ) );
}
// Archived revisions
foreach( $timestamps as $timestamp ) {
global $wgLang;
- $success[] = wfMsg( 'hiderevision-archive-status',
+ $success[] = wfMsgHTML( 'hiderevision-archive-status',
$wgLang->timeanddate( $timestamp ),
- wfMsg( hrHideArchivedRevision( $dbw, $title,
+ wfMsgHTML( hrHideArchivedRevision( $dbw, $title,
$timestamp, $reason ) ) );
}
return $success;
@@ -483,7 +481,9 @@
function wfSpecialOversight( $par=null ) {
global $wgRequest, $wgUser;
$revision = $wgRequest->getIntOrNull( 'revision' );
- if( is_null( $revision ) ) {
+ if ( $wgRequest->getCheck( 'diff' ) && !is_null( $revision )) {
+ sosShowDiff( $revision);
+ } else if( is_null( $revision ) ) {
sosShowList();
} else {
sosShowRevision( $revision );
@@ -498,6 +498,7 @@
array( 'hidden_on_timestamp < ' . $dbr->addQuotes( $fromTime ) ) );
global $wgOut;
+ $wgOut->addWikiText( wfMsgNoTrans( 'oversight-header' ) );
$wgOut->addHtml( '<ul>' );
while( $row = $dbr->fetchObject( $result ) ) {
$wgOut->addHtml( sosListRow( $row ) );
@@ -548,14 +549,18 @@
$userPage = Title::makeTitle( NS_USER, $row->user_name );
$victim = Title::makeTitle( $row->page_namespace, $row->page_title );
return "<li>(" .
- $skin->makeLinkObj( $self, wfMsgHtml( 'oversight-view' ),
+ $skin->makeKnownLinkObj( $self, wfMsgHTML( 'oversight-view' ),
'revision=' . $row->rev_id ) .
") " .
+ "(" .
+ $skin->makeKnownLinkObj( $self, wfMsgHTML( 'diff' ),
+ 'revision=' . $row->rev_id . '&diff=1') .
+ ") " .
$wgLang->timeanddate( $row->hidden_on_timestamp ) .
" " .
$skin->makeLinkObj( $userPage, htmlspecialchars( $userPage->getText() ) ) .
" " .
- wfMsgHtml( 'oversight-log-hiderev', $skin->makeLinkObj( $victim ) ) .
+ wfMsgHTML( 'oversight-log-hiderev', $skin->makeLinkObj( $victim ) ) .
" " .
$skin->commentBlock( $row->hidden_reason ) .
"</li>\n";
@@ -571,12 +576,16 @@
$info = sosListRow( $row );
$list = sosRevisionInfo( $row );
$rev = new Revision( $row );
-
+ $text = $rev->getText();
$wgOut->addHtml(
"<ul>" .
$info .
"</ul>\n" .
- $list .
+ $list );
+ if ( $text === false ) {
+ $wgOut->addWikiText(wfmsg('hiderevision-error-missing'));
+ } else {
+ $wgOut->addHtml(
"<div>" .
wfElement( 'textarea',
array(
@@ -584,8 +593,9 @@
'rows' => 25,
'wrap' => 'virtual',
'readonly' => 'readonly' ),
- strval( $rev->getText() ) ) .
- "</div>\n" );
+ $text) .
+ "</div>" );
+ }
}
$dbr->freeResult( $result );
}
@@ -601,4 +611,52 @@
return $out;
}
+function sosShowDiff( $revision )
+{
+ global $wgOut;
+
+ $dbr = wfGetDB( DB_SLAVE );
+ $result = sosGetRevisions( $dbr, array( 'hidden_rev_id' => $revision ) );
+
+ while( $row = $dbr->fetchObject( $result ) ) {
+ $info = sosListRow( $row );
+ $list = sosRevisionInfo( $row );
+ $rev = new Revision( $row );
+ $rev->mTitle = Title::makeTitle( $row->page_namespace, $row->page_title );
+ $prevId = $rev->mTitle->getPreviousRevisionID( $row->rev_id );
+ if ( $prevId ) {
+ $prev = Revision::newFromTitle( $rev->mTitle, $prevId );
+ $otext = strval( $prev->getText());
+ } else {
+ $wgOut->addHtml(
+ "<ul>" .
+ $info .
+ "</ul>\n" .
+ $list );
+ $wgOut->addWikiText( wfMsgNoTrans( 'oversight-nodiff' ) );
+ return;
+ }
+ $ntext = strval( $rev->getText());
+
+ $wgOut->addHtml(
+ "<ul>" .
+ $info .
+ "</ul>\n" .
+ $list .
+ "<p><strong>" .
+ wfMsgHTML('oversight-difference') .
+ "</strong>" .
+ "</p>" .
+ "<div>" .
+ "<table border='0' width='98%' cellpadding='0' cellspacing='4' class='diff'>" .
+ "<tr>" .
+ "<td colspan='2' width='50%' align='center' class='diff-otitle'>" . wfMsgHTML('oversight-prev') . " (#$prevId)" . "</td>" .
+ "<td colspan='2' width='50%' align='center' class='diff-ntitle'>" . wfMsgHTML('oversight-hidden') . "</td>" .
+ "</tr>" .
+ DifferenceEngine::generateDiffBody( $otext, $ntext ) .
+ "</table>" .
+ "</div>\n" );
+ }
+ $dbr->freeResult( $result );
+}
?>

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2990
Default Alt Text
oversight2.patch (8 KB)

Event Timeline