I'm dynamically creating a table with links to other wiki pages using an extension. It would be useful for the links to be kept in pagelinks. So I'm trying to write an extension that adds the dynamic links to the pagelinks table. I have a pretty hard time following how I'm supposed to use database.php so I think I probably screwed it up again.
Does this code look like it should work? Or is there a better way to add extension created links to the pagelinks table?
function newLinks($list1, $list2) { global $wgTitle; $key = $wgTitle->getDBkey(); $allNewLinks = array_merge($list1, $list2); $db=&wfGetDB( DB_MASTER ); foreach ( $allNewLinks as $newLink ) { $db->insert( "pagelinks", array('pl_from'=>'$key', 'pl_namespace'=>'0', 'pl_title'=>'$newLink', ) ); } }
Thanks! -Courtney
mediawiki-l@lists.wikimedia.org