Skip to content

Instantly share code, notes, and snippets.

@ahmadalli
Last active January 28, 2017 11:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahmadalli/b7cd109541d481b5a149788a3d592941 to your computer and use it in GitHub Desktop.
Save ahmadalli/b7cd109541d481b5a149788a3d592941 to your computer and use it in GitHub Desktop.
Installs latest version of Persian Translation of WordPress
$locations = @(
"location1",
"location2",
"location3")
#download
$salt = Get-Date
$salt = [math]::abs($salt.GetHashCode())
$url = "https://downloads.wordpress.org/release/fa_IR/latest.zip"
$zipFilePath = "$PSScriptRoot\wordpress-$salt.zip"
Import-Module BitsTransfer
Start-BitsTransfer -Source $url -Destination $zipFilePath
#extract
Add-Type -assembly "system.io.compression.filesystem"
[io.compression.zipfile]::ExtractToDirectory($zipFilePath, "$PSScriptRoot\$salt")
#remove wordpress.zip
Remove-Item $zipFilePath -Force -Recurse -ErrorAction Ignore
$wordpressDirectory = "$PSScriptRoot\$salt\wordpress"
foreach($location in $locations) {
robocopy $wordpressDirectory $location /is /e /NFL /NDL /NJH /NJS /nc /ns /np
}
#remove wordpress directory
Remove-Item "$salt" -Force -Recurse -ErrorAction Ignore
param (
[string]$url = "https://downloads.wordpress.org/release/fa_IR/latest.zip",
[string]$location="."
)
#download
$zipFilePath = "$location\wordpress.zip"
Import-Module BitsTransfer
Start-BitsTransfer -Source $url -Destination $zipFilePath
#extract
Add-Type -assembly "system.io.compression.filesystem"
[io.compression.zipfile]::ExtractToDirectory($zipFilePath, $location)
#remove wordpress.zip
Remove-Item $zipFilePath -Force -Recurse -ErrorAction Ignore
#copy
$wordpressDirectory = "$location\wordpress"
robocopy $wordpressDirectory $location /is /e /NFL /NDL /NJH /NJS /nc /ns /np
#remove wordpress directory
Remove-Item "$wordpressDirectory" -Force -Recurse -ErrorAction Ignore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment