Setting up CS100 Mediawiki
Steps:
1) Point current wiki to a template: a,b or c and then add new staff to it and then request staff to setup the template as they would like students to see it.
[CLI] vim ~cs100/public_html/w/LocalSettings.php [change '$wgDBmwschema' to
'mediawiki_[abc]']
(Note: odyssey is on
postgres@postgres165.cs and cs100 is on
postgres@postgres.student.cs.uwaterloo.ca)
[ WARNING: userids should be 8-char in SQL queries !! ]
[DB] odyssey=# \copy (select pdbid, userid, nicknames, givennames, surname, null as uw_id from odyssey._watiam.watiam_entry where userid in ('s9farooq','hcelling','agarciar', 'dtompkin' )) to cs100-staff-s2015.txt
[CLI] ... then scp this file over somehow to
postgres@postgres.student.cs
[DB] cs100=# set search_path to mediawiki_b,public;
cs100=# delete from watiam_user where userid not in ('bmzister', 'ijmorlan', 'omnafees');
cs100=# \copy watiam_user (pdbid, userid, nicknames, givennames, surname, uw_id) from ./cs100-staff-s2015.txt
cs100=# update watiam_user set mw_realname = compute_mw_realname (null, givennames, surname) where mw_realname is null;
cs100=# update watiam_user set mw_username = replace (mw_realname, ' ', '') where mw_username is null;
2) Once staff are happy with it, duplicate it as mediawiki_1155 on postgres.student.cs: (too bad there is no clone or duplicate command in postgres)
[DB] cs100=# alter schema mediawiki_b rename to mediawiki_1155;
[CLI]
root@ubuntu1204-002:/u2/cs100/Wiki Dumps# su -c"/usr/bin/pg_dump -h postgres.student.cs --file=cs100_wiki_1155.dmp --format=c --schema=mediawiki_1155" cs100
[DB] cs100=# alter schema mediawiki_1155 rename to mediawiki_b;
[CLI]
root@ubuntu1204-002:/u2/cs100/Wiki Dumps# su -c"/usr/bin/pg_restore -h postgres.student.cs --dbname=cs100 --single-transaction cs100_wiki_1155.dmp" cs100
[CLI] vim ~cs100/public_html/w/LocalSettings.php [change 'mediawiki_b' to
'mediawiki_1155']
3) Once staff testing is complete, add students as follows :
(Note: odyssey is on
postgres@postgres165.cs and cs100 is on
postgres@postgres.student.cs)
odyssey=> set search_path to _identity,_instruct,_watiam,_quest,public;
odyssey=# \copy (select pdbid, userid, nicknames, givennames, surname, uw_id from teaching_admin_registration left join (select person_id, external_id::integer as pdbid from person_identity where external_id_type = 'PDBID' and is_primary) AS pi using (person_id) left join watiam_entry using (pdbid) where (term_id, admin_id) = (1155, 20100) and dropped is null) to cs100-students-s2015.txt
... then scp this file over somehow to
postgres@postgres.student.cs
cs100=# set search_path to mediawiki_1155,public;
cs100=# \copy watiam_user (pdbid, userid, nicknames, givennames, surname, uw_id) from cs100-students-s2015.txt
cs100=# update watiam_user set mw_realname = compute_mw_realname (null, givennames, surname) where mw_realname is null;
cs100=# update watiam_user set mw_username = replace (mw_realname, ' ', '') where mw_username is null;
... and you're DONE!
--
OmNafees - 2015-10-26