Index: branches/SHOW_VERIFIED/phase3/maintenance/archives/patch-page_verified_rev.sql |
— | — | @@ -0,0 +1,6 @@ |
| 2 | +-- rev_id of the verified revision. This is needed |
| 3 | +-- for the 'verify' feature. |
| 4 | +-- Added 2005-07-23 |
| 5 | + |
| 6 | +ALTER TABLE /*$wgDBprefix*/page |
| 7 | + ADD page_verified_rev int(8) unsigned NOT NULL |
Property changes on: branches/SHOW_VERIFIED/phase3/maintenance/archives/patch-page_verified_rev.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 8 | + native |
Added: svn:keywords |
2 | 9 | + Author Date Id Revision |
Index: branches/SHOW_VERIFIED/phase3/maintenance/updaters.inc |
— | — | @@ -30,27 +30,27 @@ |
31 | 31 | |
32 | 32 | $wgNewFields = array( |
33 | 33 | # table field patch file (in maintenance/archives) |
34 | | - array( 'ipblocks', 'ipb_id', 'patch-ipblocks.sql' ), |
35 | | - array( 'ipblocks', 'ipb_expiry', 'patch-ipb_expiry.sql' ), |
36 | | - array( 'recentchanges', 'rc_type', 'patch-rc_type.sql' ), |
37 | | - array( 'recentchanges', 'rc_ip', 'patch-rc_ip.sql' ), |
38 | | - array( 'recentchanges', 'rc_id', 'patch-rc_id.sql' ), |
39 | | - array( 'recentchanges', 'rc_patrolled', 'patch-rc-patrol.sql' ), |
40 | | - array( 'user', 'user_real_name', 'patch-user-realname.sql' ), |
41 | | - array( 'user', 'user_token', 'patch-user_token.sql' ), |
42 | | - array( 'user', 'user_email_token', 'patch-user_email_token.sql' ), |
43 | | - array( 'logging', 'log_params', 'patch-log_params.sql' ), |
44 | | - array( 'archive', 'ar_rev_id', 'patch-archive-rev_id.sql' ), |
45 | | - array( 'archive', 'ar_text_id', 'patch-archive-text_id.sql' ), |
46 | | - array( 'page', 'page_len', 'patch-page_len.sql' ), |
47 | | - array( 'page', 'page_idverified', 'patch-page_idverified.sql' ), |
48 | | - array( 'revision', 'rev_deleted', 'patch-rev_deleted.sql' ), |
49 | | - array( 'image', 'img_width', 'patch-img_width.sql' ), |
50 | | - array( 'image', 'img_metadata', 'patch-img_metadata.sql' ), |
51 | | - array( 'image', 'img_media_type', 'patch-img_media_type.sql' ), |
52 | | - array( 'validate', 'val_ip', 'patch-val_ip.sql' ), |
53 | | - array( 'site_stats', 'ss_total_pages', 'patch-ss_total_articles.sql' ), |
54 | | - array( 'interwiki', 'iw_trans', 'patch-interwiki-trans.sql' ), |
| 34 | + array( 'ipblocks', 'ipb_id', 'patch-ipblocks.sql' ), |
| 35 | + array( 'ipblocks', 'ipb_expiry', 'patch-ipb_expiry.sql' ), |
| 36 | + array( 'recentchanges', 'rc_type', 'patch-rc_type.sql' ), |
| 37 | + array( 'recentchanges', 'rc_ip', 'patch-rc_ip.sql' ), |
| 38 | + array( 'recentchanges', 'rc_id', 'patch-rc_id.sql' ), |
| 39 | + array( 'recentchanges', 'rc_patrolled', 'patch-rc-patrol.sql' ), |
| 40 | + array( 'user', 'user_real_name', 'patch-user-realname.sql' ), |
| 41 | + array( 'user', 'user_token', 'patch-user_token.sql' ), |
| 42 | + array( 'user', 'user_email_token', 'patch-user_email_token.sql' ), |
| 43 | + array( 'logging', 'log_params', 'patch-log_params.sql' ), |
| 44 | + array( 'archive', 'ar_rev_id', 'patch-archive-rev_id.sql' ), |
| 45 | + array( 'archive', 'ar_text_id', 'patch-archive-text_id.sql' ), |
| 46 | + array( 'page', 'page_len', 'patch-page_len.sql' ), |
| 47 | + array( 'page', 'page_verified_rev', 'patch-page_verified_rev.sql' ), |
| 48 | + array( 'revision', 'rev_deleted', 'patch-rev_deleted.sql' ), |
| 49 | + array( 'image', 'img_width', 'patch-img_width.sql' ), |
| 50 | + array( 'image', 'img_metadata', 'patch-img_metadata.sql' ), |
| 51 | + array( 'image', 'img_media_type', 'patch-img_media_type.sql' ), |
| 52 | + array( 'validate', 'val_ip', 'patch-val_ip.sql' ), |
| 53 | + array( 'site_stats', 'ss_total_pages', 'patch-ss_total_articles.sql' ), |
| 54 | + array( 'interwiki', 'iw_trans', 'patch-interwiki-trans.sql' ), |
55 | 55 | ); |
56 | 56 | |
57 | 57 | function rename_table( $from, $to, $patch ) { |
Index: branches/SHOW_VERIFIED/phase3/maintenance/tables.sql |
— | — | @@ -194,7 +194,7 @@ |
195 | 195 | |
196 | 196 | -- Key to revision.rev_id of the revision marked as "verified" |
197 | 197 | -- This is 0 if verify protection is not enabled |
198 | | - page_idverified int(8) unsigned NOT NULL, |
| 198 | + page_verifed_rev int(8) unsigned NOT NULL, |
199 | 199 | |
200 | 200 | -- Uncompressed length in bytes of the page's current source text. |
201 | 201 | page_len int(8) unsigned NOT NULL, |
Index: branches/SHOW_VERIFIED/phase3/includes/Article.php |
— | — | @@ -36,7 +36,7 @@ |
37 | 37 | var $mOldId; |
38 | 38 | var $mRevIdFetched; |
39 | 39 | var $mRevision; |
40 | | - var $mIdVerified; |
| 40 | + var $mVerifiedRev; |
41 | 41 | /**#@-*/ |
42 | 42 | |
43 | 43 | /** |
— | — | @@ -79,9 +79,10 @@ |
80 | 80 | * not told otherwise, and so may cause a change to mTitle. |
81 | 81 | * |
82 | 82 | * @param $noredir |
| 83 | + * @param $use_verified_rev |
83 | 84 | * @return Return the text of this revision |
84 | 85 | */ |
85 | | - function getContent( $noredir, $use_idverified = false ) { |
| 86 | + function getContent( $noredir, $use_verified_rev = false ) { |
86 | 87 | global $wgRequest, $wgUser, $wgOut; |
87 | 88 | |
88 | 89 | # Get variables from query string :P |
— | — | @@ -108,7 +109,7 @@ |
109 | 110 | $wgOut->setRobotpolicy( 'noindex,nofollow' ); |
110 | 111 | return wfMsg( 'noarticletext' ); |
111 | 112 | } else { |
112 | | - $this->loadContent( $noredir, $use_idverified ); |
| 113 | + $this->loadContent( $noredir, $use_verified_rev ); |
113 | 114 | # check if we're displaying a [[User talk:x.x.x.x]] anonymous talk page |
114 | 115 | if ( $this->mTitle->getNamespace() == NS_USER_TALK && |
115 | 116 | $wgUser->isIP($this->mTitle->getText()) && |
— | — | @@ -151,6 +152,7 @@ |
152 | 153 | if($rev) { |
153 | 154 | return $rev->getText(); |
154 | 155 | } |
| 156 | + |
155 | 157 | } |
156 | 158 | } |
157 | 159 | return ''; |
— | — | @@ -275,7 +277,7 @@ |
276 | 278 | /** |
277 | 279 | * Load the revision (including cur_text) into this object |
278 | 280 | */ |
279 | | - function loadContent( $noredir = false, $use_idverified = false ) { |
| 281 | + function loadContent( $noredir = false, $use_verified_rev = false ) { |
280 | 282 | global $wgOut, $wgRequest; |
281 | 283 | |
282 | 284 | if ( $this->mContentLoaded ) return; |
— | — | @@ -294,7 +296,7 @@ |
295 | 297 | $noredir = $noredir || ($wgRequest->getVal( 'redirect' ) == 'no') |
296 | 298 | || $wgRequest->getCheck( 'rdfrom' ); |
297 | 299 | $this->mOldId = $oldid; |
298 | | - $this->fetchContent( $oldid, $noredir, true, $use_idverified ); |
| 300 | + $this->fetchContent( $oldid, $noredir, true, $use_verified_rev ); |
299 | 301 | |
300 | 302 | } |
301 | 303 | |
— | — | @@ -318,7 +320,7 @@ |
319 | 321 | 'page_random', |
320 | 322 | 'page_touched', |
321 | 323 | 'page_latest', |
322 | | - 'page_idverified', |
| 324 | + 'page_verified_rev', |
323 | 325 | 'page_len' ), |
324 | 326 | $conditions, |
325 | 327 | 'Article::pageData' ); |
— | — | @@ -346,13 +348,13 @@ |
347 | 349 | $this->mTitle->loadRestrictions( $data->page_restrictions ); |
348 | 350 | $this->mTitle->mRestrictionsLoaded = true; |
349 | 351 | |
350 | | - $this->mCounter = $data->page_counter; |
351 | | - $this->mTouched = wfTimestamp( TS_MW, $data->page_touched ); |
352 | | - $this->mIsRedirect = $data->page_is_redirect; |
353 | | - $this->mLatest = $data->page_latest; |
354 | | - $this->mIdVerified = $data->page_idverified; |
| 352 | + $this->mCounter = $data->page_counter; |
| 353 | + $this->mTouched = wfTimestamp( TS_MW, $data->page_touched ); |
| 354 | + $this->mIsRedirect = $data->page_is_redirect; |
| 355 | + $this->mLatest = $data->page_latest; |
| 356 | + $this->mVerifiedRev = $data->page_verified_rev; |
355 | 357 | |
356 | | - $this->mDataLoaded = true; |
| 358 | + $this->mDataLoaded = true; |
357 | 359 | } |
358 | 360 | |
359 | 361 | /** |
— | — | @@ -362,7 +364,7 @@ |
363 | 365 | * @param bool $globalTitle Set to true to change the global $wgTitle object when following redirects or other unexpected title changes |
364 | 366 | * @return string |
365 | 367 | */ |
366 | | - function fetchContent( $oldid = 0, $noredir = true, $globalTitle = false, $use_idverified = false ) { |
| 368 | + function fetchContent( $oldid = 0, $noredir = true, $globalTitle = false, $use_verified_rev = false ) { |
367 | 369 | if ( $this->mContentLoaded ) { |
368 | 370 | return $this->mContent; |
369 | 371 | } |
— | — | @@ -403,7 +405,7 @@ |
404 | 406 | } |
405 | 407 | $this->loadPageData( $data ); |
406 | 408 | } |
407 | | - $revision = Revision::newFromId( ( $use_idverified && ($this->mIdVerified != 0 ) ) ? $this->mIdVerified : $this->mLatest ); |
| 409 | + $revision = Revision::newFromId( ( $use_verified_rev && ($this->mVerifiedRev != 0 ) ) ? $this->mVerifiedRev : $this->mLatest ); |
408 | 410 | if( is_null( $revision ) ) { |
409 | 411 | wfDebug( "$fname failed to retrieve current page, rev_id $data->page_latest\n" ); |
410 | 412 | return false; |
— | — | @@ -434,7 +436,7 @@ |
435 | 437 | } |
436 | 438 | $redirData = $this->pageDataFromTitle( $dbr, $rt ); |
437 | 439 | if( $redirData ) { |
438 | | - $redirRev = Revision::newFromId( ( $use_idverified && ($redirData->page_idverified != 0) ) ? $redirData->page_idverified : $redirData->page_latest ); |
| 440 | + $redirRev = Revision::newFromId( ( $use_verified_rev && ($redirData->page_verified_rev != 0) ) ? $redirData->page_verified_rev : $redirData->page_latest ); |
439 | 441 | if( !is_null( $redirRev ) ) { |
440 | 442 | $this->mRedirectedFrom = $this->mTitle->getPrefixedText(); |
441 | 443 | $this->mTitle = $rt; |
— | — | @@ -756,9 +758,9 @@ |
757 | 759 | } |
758 | 760 | if ( !$outputDone ) { |
759 | 761 | # Check if we must use verify protection |
760 | | - $use_idverified = $wgEnableVerify; |
| 762 | + $use_verified_rev = $wgEnableVerify; |
761 | 763 | |
762 | | - $text = $this->getContent( false, $use_idverified ); # May change mTitle by following a redirect |
| 764 | + $text = $this->getContent( false, $use_verified_rev ); # May change mTitle by following a redirect |
763 | 765 | |
764 | 766 | # Another whitelist check in case oldid or redirects are altering the title |
765 | 767 | if ( !$this->mTitle->userCanRead() ) { |
— | — | @@ -776,7 +778,7 @@ |
777 | 779 | |
778 | 780 | # We are looking at the latest verified revision but there have been some other edits |
779 | 781 | $s = ''; |
780 | | - if ( $wgEnableVerify && empty( $oldid ) && !empty( $this->mIdVerified ) && ($this->mLatest != $this->mIdVerified) ) { |
| 782 | + if ( $wgEnableVerify && empty( $oldid ) && !empty( $this->mVerifiedRev ) && ($this->mLatest != $this->mVerifiedRev) ) { |
781 | 783 | $sk = $wgUser->getSkin(); |
782 | 784 | $current = $sk->makeKnownLink( $this->mTitle->GetPartialURL(), '', |
783 | 785 | "oldid={$this->mLatest}" ); |
— | — | @@ -969,7 +971,7 @@ |
970 | 972 | 'page_random' => wfRandom(), |
971 | 973 | 'page_touched' => $dbw->timestamp(), |
972 | 974 | 'page_latest' => 0, # Fill this in shortly... |
973 | | - 'page_idverified' => 0 |
| 975 | + 'page_verified_rev' => 0 |
974 | 976 | ), $fname ); |
975 | 977 | $newid = $dbw->insertId(); |
976 | 978 | |
— | — | @@ -1698,25 +1700,27 @@ |
1699 | 1701 | |
1700 | 1702 | $lastRevision = $dbw->selectField( |
1701 | 1703 | 'page', 'page_latest', array( 'page_id' => $id ) ); |
1702 | | - $page_idverified = $dbw->selectField( |
1703 | | - 'page', 'page_idverified', array( 'page_id' => $id ) ); |
| 1704 | + $page_verified_rev = $dbw->selectField( |
| 1705 | + 'page', 'page_verified_rev', array( 'page_id' => $id ) ); |
1704 | 1706 | |
1705 | | - if ( !isset($oldid) && !$page_idverified ){ |
| 1707 | + if ( !isset($oldid) && !$page_verified_rev ){ |
1706 | 1708 | # Set verify protection |
1707 | | - $new_idverified = $lastRevision; |
1708 | | - } else if ( !isset($oldid) && $page_idverified ) { |
| 1709 | + $new_verified_rev = $lastRevision; |
| 1710 | + } else if ( !isset($oldid) && $page_verified_rev ) { |
1709 | 1711 | # Don't do nothing |
1710 | 1712 | $wgOut->redirect( $this->mTitle->getFullURL() ); |
1711 | 1713 | return; |
1712 | 1714 | } else /* if isset($oldid) */ { |
1713 | | - # Update page_idverified to the wanted revision |
1714 | | - $new_idverified = $oldid; |
| 1715 | + # Update page_verified_rev to the wanted revision |
| 1716 | + $new_verified_rev = $oldid; |
1715 | 1717 | } |
1716 | 1718 | |
| 1719 | + $addEntryToLog = ( $page_verified_rev == 0 ); |
| 1720 | + |
1717 | 1721 | $dbw->update( 'page', |
1718 | 1722 | array( /* SET */ |
1719 | 1723 | 'page_touched' => $dbw->timestamp(), |
1720 | | - 'page_idverified' => $new_idverified |
| 1724 | + 'page_verified_rev' => $new_verified_rev |
1721 | 1725 | ), array( /* WHERE */ |
1722 | 1726 | 'page_id' => $id |
1723 | 1727 | ), 'Article::verify' |
— | — | @@ -1735,7 +1739,11 @@ |
1736 | 1740 | array_push( $wgPostCommitUpdateList, $u ); |
1737 | 1741 | } |
1738 | 1742 | |
1739 | | - # TODO: Add an entry to some log page |
| 1743 | + if ( $addEntryToLog ) { |
| 1744 | + # Add an entry to the log if the article was not verified yet |
| 1745 | + $log = new LogPage( 'protect' ); |
| 1746 | + $log->addEntry( 'verify', $this->mTitle, "" ); |
| 1747 | + } |
1740 | 1748 | |
1741 | 1749 | $wgOut->redirect( $this->mTitle->getFullURL() ); |
1742 | 1750 | |
— | — | @@ -1766,7 +1774,7 @@ |
1767 | 1775 | $dbw->update( 'page', |
1768 | 1776 | array( /* SET */ |
1769 | 1777 | 'page_touched' => $dbw->timestamp(), |
1770 | | - 'page_idverified' => 0 |
| 1778 | + 'page_verified_rev' => 0 |
1771 | 1779 | ), array( /* WHERE */ |
1772 | 1780 | 'page_id' => $id |
1773 | 1781 | ), 'Article::unverify' |
— | — | @@ -1783,7 +1791,9 @@ |
1784 | 1792 | array_push( $wgPostCommitUpdateList, $u ); |
1785 | 1793 | } |
1786 | 1794 | |
1787 | | - # TODO: Add an entry to some log page |
| 1795 | + # Add an entry to the log |
| 1796 | + $log = new LogPage( 'protect' ); |
| 1797 | + $log->addEntry( 'unverify', $this->mTitle, "" ); |
1788 | 1798 | |
1789 | 1799 | $wgOut->redirect( $this->mTitle->getFullURL() ); |
1790 | 1800 | |
Index: branches/SHOW_VERIFIED/phase3/includes/Title.php |
— | — | @@ -45,7 +45,7 @@ |
46 | 46 | var $mLatestID; # ID of most recent revision |
47 | 47 | var $mRestrictions; # Array of groups allowed to edit this article |
48 | 48 | # Only null or "sysop" are supported |
49 | | - var $mIdVerified; # page_idverified |
| 49 | + var $mVerifiedRev; # page_verified_rev |
50 | 50 | var $mRestrictionsLoaded; # Boolean for initialisation on demand |
51 | 51 | var $mPrefixedText; # Text form including namespace/interwiki, initialised on demand |
52 | 52 | var $mDefaultNamespace; # Namespace index when there is no namespace |
— | — | @@ -865,18 +865,18 @@ |
866 | 866 | } |
867 | 867 | |
868 | 868 | /** |
869 | | - * Gets page_idverified |
| 869 | + * Gets page_verified_rev |
870 | 870 | * @return int |
871 | 871 | * @access public |
872 | 872 | */ |
873 | | - function getIdVerified() { |
| 873 | + function getVerifiedRev() { |
874 | 874 | $id = $this->getArticleID(); |
875 | 875 | if ($id == 0) return 0; |
876 | | - if ( empty( $this->mIdVerified ) ) { |
| 876 | + if ( empty( $this->mVerifiedRev ) ) { |
877 | 877 | $dbr =& wfGetDB( DB_SLAVE ); |
878 | | - $this->mIdVerified = $dbr->selectField( 'page', 'page_idverified', array( 'page_id' => $id ) ); |
| 878 | + $this->mVerifiedRev = $dbr->selectField( 'page', 'page_verified_rev', array( 'page_id' => $id ) ); |
879 | 879 | } |
880 | | - return $this->mIdVerified; |
| 880 | + return $this->mVerifiedRev; |
881 | 881 | } |
882 | 882 | |
883 | 883 | /** |
— | — | @@ -885,7 +885,7 @@ |
886 | 886 | * @access public |
887 | 887 | */ |
888 | 888 | function isVerified() { |
889 | | - return ($this->getIdVerified() != 0); |
| 889 | + return ($this->getVerifiedRev() != 0); |
890 | 890 | } |
891 | 891 | |
892 | 892 | /** |
Index: branches/SHOW_VERIFIED/phase3/includes/SkinTemplate.php |
— | — | @@ -612,7 +612,7 @@ |
613 | 613 | } |
614 | 614 | |
615 | 615 | if($wgEnableVerify && $wgUser->isAllowed('verify')) { |
616 | | - if(!$this->mTitle->isVerified() || (isset($oldid) && ($oldid != $this->mTitle->getIdVerified()))) { |
| 616 | + if(!$this->mTitle->isVerified() || (isset($oldid) && ($oldid != $this->mTitle->getVerifiedRev()))) { |
617 | 617 | $oid = !isset( $oldid ) ? "" : '&oldid='.$oldid; |
618 | 618 | $content_actions['verify'] = array( |
619 | 619 | 'class' => ($action == 'verify') ? 'selected' : false, |
Index: branches/SHOW_VERIFIED/phase3/includes/PageHistory.php |
— | — | @@ -251,7 +251,7 @@ |
252 | 252 | $s = '<li>'; |
253 | 253 | |
254 | 254 | # Print the row bold if it's the verified revision |
255 | | - if ($wgEnableVerify && $this->mArticle->mIdVerified == $row->rev_id) $s .= '<b>'; |
| 255 | + if ($wgEnableVerify && $this->mArticle->mVerifiedRev == $row->rev_id) $s .= '<b>'; |
256 | 256 | |
257 | 257 | |
258 | 258 | if( $row->rev_deleted ) { |
— | — | @@ -275,7 +275,7 @@ |
276 | 276 | } |
277 | 277 | $s .= '</li>'; |
278 | 278 | |
279 | | - if ($wgEnableVerify && $this->mArticle->mIdVerified == $row->rev_id) $s .= '</b>'; |
| 279 | + if ($wgEnableVerify && $this->mArticle->mVerifiedRev == $row->rev_id) $s .= '</b>'; |
280 | 280 | |
281 | 281 | return $s; |
282 | 282 | } |
Index: branches/SHOW_VERIFIED/phase3/includes/LogPage.php |
— | — | @@ -161,6 +161,8 @@ |
162 | 162 | 'block/unblock' => 'unblocklogentry', |
163 | 163 | 'protect/protect' => 'protectedarticle', |
164 | 164 | 'protect/unprotect' => 'unprotectedarticle', |
| 165 | + 'protect/verify' => 'verifiedarticle', |
| 166 | + 'protect/unverify' => 'unverifiedarticle', |
165 | 167 | 'rights/rights' => 'bureaucratlogentry', |
166 | 168 | 'rights/addgroup' => 'addgrouplogentry', |
167 | 169 | 'rights/rngroup' => 'renamegrouplogentry', |
Index: branches/SHOW_VERIFIED/phase3/languages/Language.php |
— | — | @@ -1346,6 +1346,11 @@ |
1347 | 1347 | 'unprotectcomment' => 'Reason for unprotecting', |
1348 | 1348 | 'protectreason' => '(give a reason)', |
1349 | 1349 | |
| 1350 | +# Verify |
| 1351 | +'verifiedarticle' => 'set "[[$1]]" as verified', |
| 1352 | +'unverifiedarticle' => 'set "[[$1]]" as not verified', |
| 1353 | + |
| 1354 | + |
1350 | 1355 | # Undelete |
1351 | 1356 | 'undelete' => 'Restore deleted page', |
1352 | 1357 | 'undeletepage' => 'View and restore deleted pages', |