function update_index_page(&$article, &$text) { global $mvgIP, $mvIndexTableName; //check static or $this usage context //use mv title to split up the values: $mvTitle = new MV_Title($article->mTitle->getDBkey()); //print "Wiki title: " . $mvTitle->getWikiTitle(); //fist check if an mvd entry for this stream already exists: $mvd_row = MV_Index::getMVDbyTitle($mvTitle->getWikiTitle()); //set up the insert values: $insAry = array('mv_page_id' => $article->mTitle->getArticleID(), 'wiki_title' => $mvTitle->getWikiTitle(), 'mvd_type' => $mvTitle->getTypeMarker(), 'stream_id' => $mvTitle->getStreamId(), 'start_time' => $mvTitle->getStartTimeSeconds(), 'end_time' => $mvTitle->getEndTimeSeconds()); $dbw =& wfGetDB(DB_WRITE); if (count($mvd_row) == 0) { return $dbw->insert($mvIndexTableName, $insAry); } else { $dbw->update($mvIndexTableName, $insAry, array('mv_page_id' => $mvd_row->mv_page_id)); } }