a guest Jun 8th, 2017 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. for file in $(find /var/www/ -name LocalSettings.php)
  2. do
  3. user=$(echo $file |awk -F "/" '{print $4}' |tr "[:upper:]" "[:lower:]" |sed "s/-/_/g")
  4. password=$(grep $user /root/list_a_sites |awk -F "," '{print $2}' )
  5. sed -i '/wgDBuser /c\$wgDBadminuser = "'"${user}"'";' $file
  6. sed -i '/wgDBuser /c\$wgDBuser = "'"${user}"'";' $file
  7. sed -i '/wgDBpassword /c\$wgDBpassword = "'"${password}"'";' $file
  8. sed -i '/wgDBadminpassword /c\$wgDBadminpassword = "'"${password}"'";' $file
  9. current=$(grep  "\$wgDBname" $file |grep -oP "(?<=\").*?(?=[\"])")
  10. new=$(echo $current |tr "[:upper:]" "[:lower:]" |sed "s/-/_/g")
  11. sed -i '/wgDBname /c\$wgDBname = "'"${new}"'";' $file
  12. done
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand