Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php |
— | — | @@ -192,6 +192,9 @@ |
193 | 193 | # Load reviewed pages list |
194 | 194 | $wgSpecialPages['ReviewedPages'] = 'ReviewedPages'; |
195 | 195 | $wgAutoloadClasses['ReviewedPages'] = $dir . 'FlaggedRevsPage.php'; |
| 196 | +# Load stable pages list |
| 197 | +$wgSpecialPages['StablePages'] = 'StablePages'; |
| 198 | +$wgAutoloadClasses['StablePages'] = $dir . 'FlaggedRevsPage.php'; |
196 | 199 | # Stable version config |
197 | 200 | $wgSpecialPages['Stabilization'] = 'Stabilization'; |
198 | 201 | $wgAutoloadClasses['Stabilization'] = $dir . 'FlaggedRevsPage.php'; |
Index: trunk/extensions/FlaggedRevs/FlaggedRevsPage.i18n.php |
— | — | @@ -203,6 +203,11 @@ |
204 | 204 | 'reviewedpages-all' => 'reviewed versions', |
205 | 205 | 'reviewedpages-best' => 'prime revision', |
206 | 206 | |
| 207 | + 'stablepages' => 'Stable pages', |
| 208 | + 'stablepages-text' => 'Below is a list of pages manually configured to show the stable version as the default page content for viewers.', |
| 209 | + 'stablepages-none' => 'There are no pages in this list', |
| 210 | + 'stablepages-config' => 'Configuration', |
| 211 | + |
207 | 212 | 'rights-editor-autosum' => 'autopromoted', |
208 | 213 | 'rights-editor-revoke' => 'removed editor status from [[$1]]', |
209 | 214 | ); |
Index: trunk/extensions/FlaggedRevs/FlaggedRevsPage.php |
— | — | @@ -736,10 +736,9 @@ |
737 | 737 | $conds[] = "fr_user = user_id"; |
738 | 738 | $conds[] = 'rev_deleted & '.Revision::DELETED_TEXT.' = 0'; |
739 | 739 | return array( |
740 | | - 'tables' => array('flaggedrevs','revision','user'), |
741 | | - 'fields' => 'fr_rev_id,fr_timestamp,rev_timestamp,fr_quality, |
742 | | - fr_user,user_name', |
743 | | - 'conds' => $conds, |
| 740 | + 'tables' => array('flaggedrevs','revision','user'), |
| 741 | + 'fields' => 'fr_rev_id,fr_timestamp,rev_timestamp,fr_quality,fr_user,user_name', |
| 742 | + 'conds' => $conds, |
744 | 743 | 'options' => array('USE INDEX' => 'PRIMARY') |
745 | 744 | ); |
746 | 745 | } |
— | — | @@ -973,7 +972,7 @@ |
974 | 973 | /** |
975 | 974 | * Query to list out stable versions for a page |
976 | 975 | */ |
977 | | -class ReviewedPagesPager extends ReverseChronologicalPager { |
| 976 | +class ReviewedPagesPager extends AlphabeticPager { |
978 | 977 | public $mForm, $mConds; |
979 | 978 | |
980 | 979 | function __construct( $form, $conds = array(), $type=0, $namespace=0 ) { |
— | — | @@ -1001,7 +1000,7 @@ |
1002 | 1001 | $conds['page_ext_quality'] = $this->type; |
1003 | 1002 | return array( |
1004 | 1003 | 'tables' => array('page'), |
1005 | | - 'fields' => 'page_namespace,page_title,page_id', |
| 1004 | + 'fields' => 'page_namespace,page_title', |
1006 | 1005 | 'conds' => $conds, |
1007 | 1006 | 'options' => array('USE INDEX' => 'ext_namespace_quality') |
1008 | 1007 | ); |
— | — | @@ -1012,6 +1011,86 @@ |
1013 | 1012 | } |
1014 | 1013 | } |
1015 | 1014 | |
| 1015 | +class StablePages extends SpecialPage |
| 1016 | +{ |
| 1017 | + |
| 1018 | + function __construct() { |
| 1019 | + SpecialPage::SpecialPage( 'StablePages' ); |
| 1020 | + } |
| 1021 | + |
| 1022 | + function execute( $par ) { |
| 1023 | + global $wgRequest, $wgUser, $wgFlaggedRevValues, $wgFlaggedRevPristine; |
| 1024 | + |
| 1025 | + $this->setHeaders(); |
| 1026 | + $this->skin = $wgUser->getSkin(); |
| 1027 | + |
| 1028 | + $this->showPageList(); |
| 1029 | + } |
| 1030 | + |
| 1031 | + function showPageList() { |
| 1032 | + global $wgOut, $wgUser, $wgLang; |
| 1033 | + |
| 1034 | + $wgOut->addHTML( wfMsgExt('stablepages-text', array('parse') ) ); |
| 1035 | + $pager = new StablePagesPager( $this, array() ); |
| 1036 | + if( $pager->getNumRows() ) { |
| 1037 | + $wgOut->addHTML( $pager->getNavigationBar() ); |
| 1038 | + $wgOut->addHTML( "<ul>" . $pager->getBody() . "</ul>" ); |
| 1039 | + $wgOut->addHTML( $pager->getNavigationBar() ); |
| 1040 | + } else { |
| 1041 | + $wgOut->addHTML( wfMsgExt('stablepages-none', array('parse') ) ); |
| 1042 | + } |
| 1043 | + } |
| 1044 | + |
| 1045 | + function formatRow( $row ) { |
| 1046 | + global $wgLang, $wgUser; |
| 1047 | + |
| 1048 | + $title = Title::makeTitle( $row->page_namespace, $row->page_title ); |
| 1049 | + $link = $this->skin->makeKnownLinkObj( $title, $title->getPrefixedText() ); |
| 1050 | + |
| 1051 | + $stitle = SpecialPage::getTitleFor( 'Stabilization' ); |
| 1052 | + $config = $this->skin->makeKnownLinkObj( $stitle, wfMsgHtml('stablepages-config'), |
| 1053 | + 'page=' . $title->getPrefixedUrl() ); |
| 1054 | + $best = $this->skin->makeKnownLinkObj( $title, wfMsgHtml('reviewedpages-best'), |
| 1055 | + 'stableid=best' ); |
| 1056 | + |
| 1057 | + return '<li>'.$link.' ('.$config.') ['.$best.'] </li>'; |
| 1058 | + } |
| 1059 | +} |
| 1060 | + |
| 1061 | +/** |
| 1062 | + * Query to list out stable versions for a page |
| 1063 | + */ |
| 1064 | +class StablePagesPager extends AlphabeticPager { |
| 1065 | + public $mForm, $mConds; |
| 1066 | + |
| 1067 | + function __construct( $form, $conds = array() ) { |
| 1068 | + $this->mForm = $form; |
| 1069 | + $this->mConds = $conds; |
| 1070 | + |
| 1071 | + parent::__construct(); |
| 1072 | + } |
| 1073 | + |
| 1074 | + function formatRow( $row ) { |
| 1075 | + return $this->mForm->formatRow( $row ); |
| 1076 | + } |
| 1077 | + |
| 1078 | + function getQueryInfo() { |
| 1079 | + $conds = $this->mConds; |
| 1080 | + $conds[] = 'page_id = fpc_page_id'; |
| 1081 | + $conds['fpc_override'] = 1; |
| 1082 | + return array( |
| 1083 | + 'tables' => array('flaggedpage_config','page'), |
| 1084 | + 'fields' => 'page_namespace,page_title,fpc_page_id', |
| 1085 | + 'conds' => $conds, |
| 1086 | + 'options' => array() |
| 1087 | + ); |
| 1088 | + } |
| 1089 | + |
| 1090 | + function getIndexField() { |
| 1091 | + return 'fpc_page_id'; |
| 1092 | + } |
| 1093 | +} |
| 1094 | + |
1016 | 1095 | class Stabilization extends UnlistedSpecialPage |
1017 | 1096 | { |
1018 | 1097 | |