Merge pull request #178 from tterranigma/wordpress_ip

Better heuristic for finding ip addr
This commit is contained in:
Chandrapal 2017-12-12 23:44:15 +05:30 committed by GitHub
commit 8d6fbd49cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 2 deletions

View File

@ -1,5 +1,15 @@
$ip=get-WmiObject Win32_NetworkAdapterConfiguration|Where {$_.Ipaddress.length -gt 1}
$ipaddr = $ip.ipaddress[0]
$ip=get-WmiObject Win32_NetworkAdapterConfiguration|Where {$_.IPAddress -gt 1}
if ($ip.count -gt 0) {
$ip = $ip[0]
}
if ($ip.IPAddress.count -gt 0) {
$ipaddr = $ip.IPAddress[0]
} else {
$ipaddr = $ip[0].ipaddress[0]
}
Write-Host "Updating Wordpress IP to $ipaddr"
$cmd = 'C:\wamp\bin\mysql\mysql5.5.20\bin\mysql.exe -u root --password="" -e "use wordpress; update wp_options set option_value=''http://'+$ipaddr+':8585/wordpress'' where option_name=''siteurl'';"'