Advertisement
Guest User

Untitled

a guest
Jun 8th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement