Page MenuHomePhabricator
Paste P7968

(An Untitled Masterwork)
ActivePublic

Authored by Banyek on Jan 9 2019, 3:26 PM.
banyek@cumin2001:~ $ cat T85757/fix_triggers.sh
#!/bin/bash
#
#
# eg. usage:
# ./fix_triggers.sh db1125:3317 s7
#
HOST=$1
SECTION=$2
for db in $(cat mediawiki-config/dblists/${SECTION}.dblist); do
echo "fixing triggers on ${db}"
/home/banyek/wmfmariadbpy/wmfmariadbpy/mysql.py -h ${HOST} ${db} -e "SET SESSION sql_log_bin=0; DROP TRIGGER IF EXISTS ${db}.user_insert; CREATE DEFINER='root'@'localhost' TRIGGER ${db}.user_insert BEFORE INSERT ON ${db}.user FOR EACH ROW SET NEW.user_password = '', NEW.user_newpassword = '', NEW.user_email = '', NEW.user_token = '', NEW.user_email_authenticated = '', NEW.user_email_token = '', NEW.user_email_token_expires = '', NEW.user_newpass_time = '';DROP TRIGGER IF EXISTS ${db}.user_update; CREATE DEFINER='root'@'localhost' TRIGGER ${db}.user_update BEFORE UPDATE ON ${db}.user FOR EACH ROW SET NEW.user_password = '', NEW.user_newpassword = '', NEW.user_email = '', NEW.user_token = '', NEW.user_email_authenticated = '', NEW.user_email_token = '', NEW.user_email_token_expires = '', NEW.user_newpass_time = '';"
done

Event Timeline

Banyek created this paste.Jan 9 2019, 3:26 PM