Index: trunk/extensions/PageSchemas/specials/GeneratePages.php |
— | — | @@ -24,15 +24,37 @@ |
25 | 25 | $wgOut->addHTML($text_1); |
26 | 26 | }else { |
27 | 27 | 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 ); |
29 | 54 | }else { |
30 | 55 | //this is when Special:GeneratePages/Category is accessed first time |
31 | 56 | //Here check for the valid Category name and allow for generating pages |
32 | 57 | $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(); |
37 | 59 | $dbr = wfGetDB( DB_SLAVE ); |
38 | 60 | //get the result set, query : slect page_props |
39 | 61 | $res = $dbr->select( 'page_props', |