Anlage des Repos
This commit is contained in:
36
test/Backup-XWiki.ps1
Normal file
36
test/Backup-XWiki.ps1
Normal file
@@ -0,0 +1,36 @@
|
||||
# https://www.xwiki.org/xwiki/bin/view/Documentation/AdminGuide/Authentication/
|
||||
# Authenticate like: username:password@url and add &basicauth=1 at the end
|
||||
|
||||
# Setup Credentials and Encode them
|
||||
$Username = "DigitalData"
|
||||
$Password = "35452dd!"
|
||||
$CredentialsPair = "$($Username):$($Password)"
|
||||
$EncodedCredentials = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($CredentialsPair))
|
||||
|
||||
# Create Request Header for Basic Authenticastion
|
||||
$Headers = @{ Authorization = "Basic $EncodedCredentials" }
|
||||
|
||||
# Set the url
|
||||
$Url = "http://wiki.dd/xwiki11/bin/export/XWiki/XWikiPreferences?editor=globaladmin§ion=Export"
|
||||
$Path = "E:\backup.xar"
|
||||
|
||||
Write-Host "Downloading Backup from [$($url)].."
|
||||
|
||||
# Make the request
|
||||
$Response = Invoke-WebRequest -Method Get -Uri $Url -Headers $Headers
|
||||
|
||||
Write-Host "Download finished!"
|
||||
|
||||
# Write the reponse to disk
|
||||
Write-Host "Streaming file to [$($Path)].."
|
||||
|
||||
try {
|
||||
[System.IO.File]::WriteAllBytes($Path, $Response.Content)
|
||||
} catch {
|
||||
Write-Host "An error occurred:"
|
||||
Write-Host $_
|
||||
} finally {
|
||||
$Stream.Dispose()
|
||||
}
|
||||
|
||||
Write-Host "Done!"
|
||||
Reference in New Issue
Block a user