X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22calendrier%22%2C%22type=semaine%22%29%20.%20%22?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialUndelete.php;fp=includes%2Fspecials%2FSpecialUndelete.php;h=f242b425e8a5780d0bb44883c5d84edc4d3bec42;hb=d87135d706004373b2cfdc4c588ce6d80358631f;hp=611b3b92120779b794a8dd2ded4375ec0643d4ba;hpb=4bed2c4a9515433400ec4cc25052822c8ef40640;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialUndelete.php b/includes/specials/SpecialUndelete.php index 611b3b9212..f242b425e8 100644 --- a/includes/specials/SpecialUndelete.php +++ b/includes/specials/SpecialUndelete.php @@ -112,12 +112,22 @@ class PageArchive { * @return ResultWrapper */ function listRevisions() { + global $wgContentHandlerNoDB; + $dbr = wfGetDB( DB_SLAVE ); + + $fields = array( + 'ar_minor_edit', 'ar_timestamp', 'ar_user', 'ar_user_text', + 'ar_comment', 'ar_len', 'ar_deleted', 'ar_rev_id', 'ar_sha1', + ); + + if ( !$wgContentHandlerNoDB ) { + $fields[] = 'ar_content_format'; + $fields[] = 'ar_content_model'; + } + $res = $dbr->select( 'archive', - array( - 'ar_minor_edit', 'ar_timestamp', 'ar_user', 'ar_user_text', - 'ar_comment', 'ar_len', 'ar_deleted', 'ar_rev_id', 'ar_sha1' - ), + $fields, array( 'ar_namespace' => $this->title->getNamespace(), 'ar_title' => $this->title->getDBkey() ), 'PageArchive::listRevisions', @@ -174,22 +184,32 @@ class PageArchive { * @return Revision */ function getRevision( $timestamp ) { + global $wgContentHandlerNoDB; + $dbr = wfGetDB( DB_SLAVE ); + + $fields = array( + 'ar_rev_id', + 'ar_text', + 'ar_comment', + 'ar_user', + 'ar_user_text', + 'ar_timestamp', + 'ar_minor_edit', + 'ar_flags', + 'ar_text_id', + 'ar_deleted', + 'ar_len', + 'ar_sha1', + ); + + if ( !$wgContentHandlerNoDB ) { + $fields[] = 'ar_content_format'; + $fields[] = 'ar_content_model'; + } + $row = $dbr->selectRow( 'archive', - array( - 'ar_rev_id', - 'ar_text', - 'ar_comment', - 'ar_user', - 'ar_user_text', - 'ar_timestamp', - 'ar_minor_edit', - 'ar_flags', - 'ar_text_id', - 'ar_deleted', - 'ar_len', - 'ar_sha1', - ), + $fields, array( 'ar_namespace' => $this->title->getNamespace(), 'ar_title' => $this->title->getDBkey(), 'ar_timestamp' => $dbr->timestamp( $timestamp ) ), @@ -403,6 +423,8 @@ class PageArchive { * @return Mixed: number of revisions restored or false on failure */ private function undeleteRevisions( $timestamps, $unsuppress = false, $comment = '' ) { + global $wgContentHandlerNoDB; + if ( wfReadOnly() ) { return false; } @@ -456,24 +478,31 @@ class PageArchive { $oldones = "ar_timestamp IN ( {$oldts} )"; } + $fields = array( + 'ar_rev_id', + 'ar_text', + 'ar_comment', + 'ar_user', + 'ar_user_text', + 'ar_timestamp', + 'ar_minor_edit', + 'ar_flags', + 'ar_text_id', + 'ar_deleted', + 'ar_page_id', + 'ar_len', + 'ar_sha1'); + + if ( !$wgContentHandlerNoDB ) { + $fields[] = 'ar_content_format'; + $fields[] = 'ar_content_model'; + } + /** * Select each archived revision... */ $result = $dbw->select( 'archive', - /* fields */ array( - 'ar_rev_id', - 'ar_text', - 'ar_comment', - 'ar_user', - 'ar_user_text', - 'ar_timestamp', - 'ar_minor_edit', - 'ar_flags', - 'ar_text_id', - 'ar_deleted', - 'ar_page_id', - 'ar_len', - 'ar_sha1' ), + $fields, /* WHERE */ array( 'ar_namespace' => $this->title->getNamespace(), 'ar_title' => $this->title->getDBkey(), @@ -854,6 +883,7 @@ class SpecialUndelete extends SpecialPage { if( $this->mPreview ) { // Hide [edit]s + //FIXME: ContentHandler will have to provide some specialized magic to do this $popts = $out->parserOptions(); $popts->setEditSection( false ); $out->parserOptions( $popts ); @@ -865,7 +895,7 @@ class SpecialUndelete extends SpecialPage { 'readonly' => 'readonly', 'cols' => intval( $user->getOption( 'cols' ) ), 'rows' => intval( $user->getOption( 'rows' ) ) ), - $rev->getText( Revision::FOR_THIS_USER, $user ) . "\n" ) . + $rev->getText( Revision::FOR_THIS_USER, $user ) . "\n" ) . //FIXME: ContentHandler will have to provide some specialized magic to do this Xml::openElement( 'div' ) . Xml::openElement( 'form', array( 'method' => 'post', @@ -903,7 +933,8 @@ class SpecialUndelete extends SpecialPage { * @return String: HTML */ function showDiff( $previousRev, $currentRev ) { - $diffEngine = new DifferenceEngine( $this->getContext() ); + $contentHandler = ContentHandler::getForTitle( $this->getTitle() ); + $diffEngine = $contentHandler->createDifferenceEngine( $this->getContext() ); $diffEngine->showDiffStyle(); $this->getOutput()->addHTML( "
" . @@ -920,9 +951,9 @@ class SpecialUndelete extends SpecialPage { $this->diffHeader( $currentRev, 'n' ) . "\n" . "" . - $diffEngine->generateDiffBody( - $previousRev->getText( Revision::FOR_THIS_USER, $this->getUser() ), - $currentRev->getText( Revision::FOR_THIS_USER, $this->getUser() ) ) . + $diffEngine->generateContentDiffBody( + $previousRev->getContent( Revision::FOR_THIS_USER, $this->getUser() ), + $currentRev->getContent( Revision::FOR_THIS_USER, $this->getUser() ) ) . "" . "
\n" );