X-Git-Url: https://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2FSpecialUndelete.php;h=fb7c43bc5baebd6a830df5b8a4ce337a69bfda4c;hb=1e7e73444a9357be1c58301e8707c029f31f5ef7;hp=6718520c1fa5aaa637095c131225bb812201c832;hpb=1f60b024dec5f21b5eae1a1db1a3d8d16e36cb21;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/SpecialUndelete.php b/includes/SpecialUndelete.php index 6718520c1f..fb7c43bc5b 100644 --- a/includes/SpecialUndelete.php +++ b/includes/SpecialUndelete.php @@ -322,12 +322,12 @@ class PageArchive { * @param array $timestamps Pass an empty array to restore all revisions, otherwise list the ones to undelete. * @param string $comment * @param array $fileVersions - * @param bool $Unsuppress + * @param bool $unsuppress * * @return array(number of file revisions restored, number of image revisions restored, log message) * on success, false on failure */ - function undelete( $timestamps, $comment = '', $fileVersions = array(), $Unsuppress = false ) { + function undelete( $timestamps, $comment = '', $fileVersions = array(), $unsuppress = false ) { // If both the set of text revisions and file revisions are empty, // restore everything. Otherwise, just restore the requested items. $restoreAll = empty( $timestamps ) && empty( $fileVersions ); @@ -337,14 +337,14 @@ class PageArchive { if( $restoreFiles && $this->title->getNamespace() == NS_IMAGE ) { $img = wfLocalFile( $this->title ); - $this->fileStatus = $img->restore( $fileVersions, $Unsuppress ); + $this->fileStatus = $img->restore( $fileVersions, $unsuppress ); $filesRestored = $this->fileStatus->successCount; } else { $filesRestored = 0; } if( $restoreText ) { - $textRestored = $this->undeleteRevisions( $timestamps, $Unsuppress ); + $textRestored = $this->undeleteRevisions( $timestamps, $unsuppress ); if($textRestored === false) // It must be one of UNDELETE_* return false; } else { @@ -385,11 +385,11 @@ class PageArchive { * @param array $timestamps Pass an empty array to restore all revisions, otherwise list the ones to undelete. * @param string $comment * @param array $fileVersions - * @param bool $Unsuppress, remove all ar_deleted/fa_deleted restrictions of seletected revs + * @param bool $unsuppress, remove all ar_deleted/fa_deleted restrictions of seletected revs * * @return mixed number of revisions restored or false on failure */ - private function undeleteRevisions( $timestamps, $Unsuppress = false ) { + private function undeleteRevisions( $timestamps, $unsuppress = false ) { if ( wfReadOnly() ) return false; $restoreAll = empty( $timestamps ); @@ -473,7 +473,7 @@ class PageArchive { $ret->seek( $rev_count - 1 ); $last = $ret->fetchObject(); // We don't handle well changing the top revision's settings - if( !$Unsuppress && $last->ar_deleted && $last->ar_timestamp > $previousTimestamp ) { + if( !$unsuppress && $last->ar_deleted && $last->ar_timestamp > $previousTimestamp ) { wfDebug( __METHOD__.": restoration would result in a deleted top revision\n" ); return false; } @@ -511,7 +511,7 @@ class PageArchive { 'timestamp' => $row->ar_timestamp, 'minor_edit' => $row->ar_minor_edit, 'text_id' => $row->ar_text_id, - 'deleted' => $Unsuppress ? 0 : $row->ar_deleted, + 'deleted' => $unsuppress ? 0 : $row->ar_deleted, 'len' => $row->ar_len ) ); $revision->insertOn( $dbw ); @@ -701,7 +701,8 @@ class UndeleteForm { $wgOut->addHTML( ""); @@ -1048,7 +1049,7 @@ class UndeleteForm { return true; } - private function formatRevisionRow( $row, $sk ) { + private function formatRevisionRow( $row, $earliestLiveTime, $remaining, $sk ) { global $wgUser, $wgLang; $rev = new Revision( array( @@ -1059,25 +1060,27 @@ class UndeleteForm { 'timestamp' => $row->ar_timestamp, 'minor_edit' => $row->ar_minor_edit, 'deleted' => $row->ar_deleted, - 'len' => $row->ar_len) ); + 'len' => $row->ar_len ) ); $stxt = ''; - + $ts = wfTimestamp( TS_MW, $row->ar_timestamp ); if( $this->mAllowed ) { - $ts = wfTimestamp( TS_MW, $row->ar_timestamp ); $checkBox = Xml::check( "ts$ts" ); $titleObj = SpecialPage::getTitleFor( "Undelete" ); $pageLink = $this->getPageLink( $rev, $titleObj, $ts, $sk ); # Last link if( !$rev->userCan( Revision::DELETED_TEXT ) ) { $last = wfMsgHtml('diff'); - } else { + } else if( $remaining > 0 || ($earliestLiveTime && $ts > $earliestLiveTime) ) { $last = $sk->makeKnownLinkObj( $titleObj, wfMsgHtml('diff'), - "target=" . $this->mTarget . "×tamp=" . $row->ar_timestamp . "&diff=prev" ); + "target=" . $this->mTargetObj->getPrefixedUrl() . "×tamp=$ts&diff=prev" ); + } else { + $last = wfMsgHtml('diff'); } } else { $checkBox = ''; $pageLink = $wgLang->timeanddate( $ts, true ); + $last = wfMsgHtml('diff'); } $userLink = $sk->revUserTools( $rev ); @@ -1095,10 +1098,10 @@ class UndeleteForm { // If revision was hidden from sysops $del = wfMsgHtml('rev-delundel'); } else { + $ts = wfTimestamp( TS_MW, $row->ar_timestamp ); $del = $sk->makeKnownLinkObj( $revdel, wfMsgHtml('rev-delundel'), - 'target=' . urlencode( $this->mTarget ) . - '&artimestamp=' . urlencode( $row->ar_timestamp ) ); + 'target=' . $this->mTargetObj->getPrefixedUrl() . "&artimestamp=$ts" ); // Bolden oversighted content if( $rev->isDeleted( Revision::DELETED_RESTRICTED ) ) $del = "$del"; @@ -1143,8 +1146,8 @@ class UndeleteForm { } else { $del = $sk->makeKnownLinkObj( $revdel, wfMsgHtml('rev-delundel'), - 'target=' . urlencode( $this->mTarget ) . - '&fileid=' . urlencode( $row->fa_id ) ); + 'target=' . $this->mTargetObj->getPrefixedUrl() . + '&fileid=' . $row->fa_id ); // Bolden oversighted content if( $file->isDeleted( File::DELETED_RESTRICTED ) ) $del = "$del"; @@ -1176,7 +1179,8 @@ class UndeleteForm { if( !$rev->userCan(Revision::DELETED_TEXT) ) { return '' . $wgLang->timeanddate( $ts, true ) . ''; } else { - $link = $sk->makeKnownLinkObj( $titleObj, $wgLang->timeanddate( $ts, true ), "target={$this->mTarget}×tamp=$ts" ); + $link = $sk->makeKnownLinkObj( $titleObj, $wgLang->timeanddate( $ts, true ), + "target=".$this->mTargetObj->getPrefixedUrl()."×tamp=$ts" ); if( $rev->isDeleted(Revision::DELETED_TEXT) ) $link = '' . $link . ''; return $link; @@ -1193,7 +1197,8 @@ class UndeleteForm { if( !$file->userCan(File::DELETED_FILE) ) { return '' . $wgLang->timeanddate( $ts, true ) . ''; } else { - $link = $sk->makeKnownLinkObj( $titleObj, $wgLang->timeanddate( $ts, true ), "target={$this->mTarget}&file=$key" ); + $link = $sk->makeKnownLinkObj( $titleObj, $wgLang->timeanddate( $ts, true ), + "target=".$this->mTargetObj->getPrefixedUrl()."&file=$key" ); if( $file->isDeleted(File::DELETED_FILE) ) $link = '' . $link . ''; return $link;