hi bepe,
Regarding setting up a starting value for edits (for existing users):
Quote:
Originally Posted by bepe
hm... not that easy for me... might take some time
|
add the following to the install code section. this will create a column (and index) to get the initial values for wikiedits, and then drop that column. so you start with initial values, and your database looks as it does right now.
Code:
$vbulletin->db->query_write("ALTER TABLE mw_user ADD vbusername varchar(255) collate latin1_swedish_ci default NULL");
$vbulletin->db->query_write("ALTER TABLE mw_user ADD INDEX vbusername_idx (vbusername)");
$vbulletin->db->query_write("UPDATE mw_user SET vbusername = user_name WHERE vbusername is null");
$vbulletin->db->query_write("
UPDATE " . TABLE_PREFIX . "user AS user
SET user.wikiedits =
( SELECT sum(user_editcount)
FROM mw_user
WHERE user.username = vbusername );
");
$vbulletin->db->query_write("ALTER TABLE mw_user DROP vbusername");
have to do a roundabout way to get a case insensitive username to compare to the vbulletin username, hence the latin1_swedish_ci for the column...
also, we need to change mw_user to wiki-database-name.mw_user (and mw_ to whatever prefix we are using), in case the wiki database is different. what this will still not populate is pages created (not sure if mediawiki can track that directly?)
a cleaner option might be to provide a link on the config page to update the data (after installing the app). that way no edits required to the xml file. but do not know how to set that up.
thanks.
ndahiya