r90888 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r90887‎ | r90888 | r90889 >
Date:17:21, 27 June 2011
Author:ankitgarg833
Status:deferred
Tags:
Comment:
adding code to automatically generate list of categories.
Modified paths:
  • /trunk/extensions/PageSchemas/specials/GeneratePages.php (modified) (history)

Diff [purge]

Index: trunk/extensions/PageSchemas/specials/GeneratePages.php
@@ -24,15 +24,37 @@
2525 $wgOut->addHTML($text_1);
2626 }else {
2727 if( $category == ""){
28 - ## Code to Display the list of categories
 28+ $cat_titles = array();
 29+ $count_title = 0;
 30+ $text = "";
 31+ $dbr = wfGetDB( DB_SLAVE );
 32+ //get the result set, query : slect page_props
 33+ $res = $dbr->select( 'page_props',
 34+ array(
 35+ 'pp_page',
 36+ 'pp_propname',
 37+ 'pp_value'
 38+ ),
 39+ array(
 40+ 'pp_propname' => 'PageSchema'
 41+ )
 42+ );
 43+ while ( $row = $dbr->fetchRow( $res ) ) {
 44+ if( $row[2] != null ){
 45+ $page_id_cat = $row[0];
 46+ if( Title::newFromId($page_id_cat)->getNamespace() == NS_CATEGORY){
 47+ $cat_text = Title::newFromId($page_id_cat)->getText();
 48+ $text .= '<a href="https://www.mediawiki.org/index.php/Special:GeneratePages/'.$cat_text.'">'.$cat_text.'</a> <br />';
 49+ }
 50+ }
 51+ }
 52+ $dbr->freeResult( $res );
 53+ $wgOut->addHTML( $text );
2954 }else {
3055 //this is when Special:GeneratePages/Category is accessed first time
3156 //Here check for the valid Category name and allow for generating pages
3257 $title = Title::newFromText( $category, NS_CATEGORY );
33 - $pageId = $title->getArticleID();
34 - $test_text = Title::newFromId($pageId)->getText();
35 - wfDebugLog( 'myextension', 'newFromId: ' .$test_text );
36 - wfDebugLog( 'myextension', 'newFromId->getNamespace(): ' .Title::newFromId($pageId)->getNamespace() );
 58+ $pageId = $title->getArticleID();
3759 $dbr = wfGetDB( DB_SLAVE );
3860 //get the result set, query : slect page_props
3961 $res = $dbr->select( 'page_props',

Status & tagging log