I’m working with the mediawiki API ( e.g. http://en.wikipedia.org/w/api.php) and I would like to be able to ‘truncate’ the mysql tables in order to reset the local installation while keeping some tables (users, ?…).
What would be the SQL queries ?
I would say: tuncate all the tables but ${PREFIX}_user and update ${PREFIX}_user set user_editcount=0 ?
Any other(safer) suggestion ?
The correct answer was posted on the MediaWiki mailing list: see http://lists.wikimedia.org/pipermail/mediawiki-l/2009-October/032322.html
According to that post, it is probably ok to truncate
user_newtalk,page,revision,text,archive,pagelinks,templatelinks,imagelinks,categorylinks,category,externallinks,langlinks,hitcounter,watchlist,image,oldimage,filearchive,recentchanges,searchindex,interwiki,querycache,objectcache,log_search,trackbacks,job,querycache_info,redirect,querycachetwo,page_restrictions,protected_titles,page_props,change_tags,tag_summary,valid_tag,l10n_cache.On more recent versions, add
msg_resourceandmsg_resource_listto that list, to truncate message related caches.Also: Remember to delete the files at the image folder, if truncating the
image table. Otherwise they will be out of sync, and you might have trouble uploading some images.