Beispiel #1
0
 /**
  * Get wikia-properties requested by its ID
  *
  * @param $propertyIds One or many property IDs to fetch
  * @param $dbType int Database connection type
  * @return array 1-D or 2-D array representing fetched properties (2-D if more than one property ID was provided)
  */
 public function getWikiaProperties($propertyIds, $dbType = DB_SLAVE)
 {
     $articleIds = $this->getArticleIds();
     $res = wfGetDB($dbType)->select(array('p' => 'page', 'pp' => 'page_wikia_props'), array('p.page_id, pp.propname, pp.props'), array('p.page_id = pp.page_id', 'pp.propname' => $propertyIds), __METHOD__);
     $props = array();
     foreach ($res as $row) {
         if (is_array($propertyIds)) {
             $props[$row->page_id][$row->propname] = wfUnserializeProp($row->propname, $row->props);
         } else {
             $props[$row->page_id] = wfUnserializeProp($row->propname, $row->props);
         }
     }
     return $props;
 }
Beispiel #2
0
/**
 * Get value of wikia article prop list of type is define in
 */
function wfGetWikiaPageProp($type, $pageID, $db = DB_SLAVE, $dbname = '')
{
    if (empty($dbname)) {
        $db = wfGetDB($db, array());
    } else {
        $db = wfGetDB($db, array(), $dbname);
    }
    $res = $db->select('page_wikia_props', array('props'), array('page_id' => $pageID, 'propname' => $type), __METHOD__);
    if ($out = $db->fetchRow($res)) {
        return wfUnserializeProp($type, $out['props']);
    }
    return null;
}