r94037 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94036‎ | r94037 | r94038 >
Date:04:15, 7 August 2011
Author:ankitgarg833
Status:deferred
Tags:
Comment:
getCategoriesWithPSDefined func.
Modified paths:
  • /trunk/extensions/PageSchemas/PageSchemas.classes.php (modified) (history)

Diff [purge]

Index: trunk/extensions/PageSchemas/PageSchemas.classes.php
@@ -21,7 +21,32 @@
2222 }
2323 $output->addModules( 'jquery' );
2424 }
25 -
 25+ public static function getCategoriesWithPSDefined(){
 26+ $cat_titles = array();
 27+ $dbr = wfGetDB( DB_SLAVE );
 28+ //get the result set, query : slect page_props
 29+ $res = $dbr->select( 'page_props',
 30+ array(
 31+ 'pp_page',
 32+ 'pp_propname',
 33+ 'pp_value'
 34+ ),
 35+ array(
 36+ 'pp_propname' => 'PageSchema'
 37+ )
 38+ );
 39+ while ( $row = $dbr->fetchRow( $res ) ) {
 40+ if( $row[2] != null ){
 41+ $page_id_cat = $row[0];
 42+ if( Title::newFromId($page_id_cat)->getNamespace() == NS_CATEGORY){
 43+ $cat_text = Title::newFromId($page_id_cat)->getText();
 44+ $cat_titles[] = $cat_text;
 45+ }
 46+ }
 47+ }
 48+ $dbr->freeResult( $res );
 49+ return $cat_titles;
 50+ }
2651
2752 /**
2853 * Includes the necessary Javascript and CSS files for the form

Status & tagging log