#! /bin/bash # Schema that contains all wikitables # # wikischema=de wikischema=$1 shift # Commonly used schema for mwuser table and tables of the ExternalAttribution extension # # commonschema=zsamm commonschema=$1 shift # Name and password of the wikiuser # #wikiuser=de #wupassword=secret wikiuser=$1 shift wupassword=$1 echo " -- -- Create the new wikiuser and set his search path -- CREATE ROLE $wikiuser LOGIN PASSWORD '$wupassword' IN ROLE wikigroup; ALTER ROLE $wikiuser SET search_path TO $commonschema,$wikischema,public; ALTER ROLE $wikiuser SET timezone TO 'GMT'; -- -- Set own search path temporarily -- SET search_path TO $commonschema, $wikischema, public; -- -- Grant privileges on tables on the wikischema to wikiuser. -- Add new tables if needed for future MW versions. -- GRANT SELECT, UPDATE, INSERT, DELETE ON archive, categorylinks, externallinks, filearchive, hitcounter, image, imagelinks, interwiki, ipblocks, job, langlinks, logging, math, mediawiki_version, objectcache, oldimage, page, page_restrictions, pagecontent, pagelinks, profiling, querycache, querycache_info, querycachetwo, recentchanges, redirect, revision, site_stats, templatelinks, trackbacks, transcache, user_groups, user_newtalk, watchlist TO $wikiuser; -- -- Grant privileges on sequences on the wikischema to wikiuser. -- Add new sequences if needed for future MW versions. -- GRANT SELECT, UPDATE ON filearchive_fa_id_seq, ipblocks_ipb_id_val, job_job_id_seq, log_log_id_seq, page_page_id_seq, pr_id_val, rc_rc_id_seq, rev_rev_id_val, text_old_id_val, trackbacks_tb_id_seq TO $wikiuser; -- -- Grant usage of the wiki schema to wikiuser. -- GRANT USAGE ON SCHEMA $wikischema TO $wikiuser; -- -- -- The below commands actualy needed not to be invoked for each new DB users, -- but only once at initial setup. -- -- -- -- Grant privileges on tables in the common schema to wikigroup. -- Add new tables if needed for future MW versions. -- GRANT SELECT, UPDATE, INSERT, DELETE ON mwuser TO wikigroup; -- -- Grant privileges on sequences in the common schema to wikigroup. -- Add new sequences if needed for future MW versions. -- GRANT SELECT, UPDATE ON user_user_id_seq TO wikigroup; -- -- Grant usage of the common schema to wikigroup. -- GRANT USAGE ON SCHEMA $commonschema TO wikigroup; "