Last active
January 28, 2017 11:14
-
-
Save ahmadalli/b7cd109541d481b5a149788a3d592941 to your computer and use it in GitHub Desktop.
Installs latest version of Persian Translation of WordPress
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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