mirror of
https://github.com/ChuckPa/PlexDBRepair.git
synced 2025-11-06 03:08:55 -05:00
Add statistics_bandwidth cleanup to Windows scripts
This commit is contained in:
parent
d6f4dbf263
commit
481814ed2c
@ -94,6 +94,10 @@ cd "%PlexData%"
|
|||||||
md "%PlexData%\dbtmp" 2>NUL
|
md "%PlexData%\dbtmp" 2>NUL
|
||||||
del "%TmpFile%" 2>NUL
|
del "%TmpFile%" 2>NUL
|
||||||
|
|
||||||
|
echo %time% -- Performing DB cleanup tasks
|
||||||
|
echo %time% -- Performing DB cleanup tasks >> "%PlexData%\DBRepair.log"
|
||||||
|
"%PlexSQL%" "%PlexData%\com.plexapp.plugins.library.db" "DELETE FROM statistics_bandwidth WHERE account_id IS NULL;"
|
||||||
|
|
||||||
echo %time% -- Exporting Main DB
|
echo %time% -- Exporting Main DB
|
||||||
echo %time% -- Exporting Main DB >> "%PlexData%\DBRepair.log"
|
echo %time% -- Exporting Main DB >> "%PlexData%\DBRepair.log"
|
||||||
echo .dump | "%PlexSQL%" "%PlexData%\com.plexapp.plugins.library.db" > "%DBtmp%\library.sql_%TimeStamp%"
|
echo .dump | "%PlexSQL%" "%PlexData%\com.plexapp.plugins.library.db" > "%DBtmp%\library.sql_%TimeStamp%"
|
||||||
|
|||||||
@ -326,9 +326,17 @@ class DBRepair {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this.Output("Exporting Main DB")
|
|
||||||
$MainDBName = "com.plexapp.plugins.library.db"
|
$MainDBName = "com.plexapp.plugins.library.db"
|
||||||
$MainDB = Join-Path $this.PlexDBDir -ChildPath $MainDBName
|
$MainDB = Join-Path $this.PlexDBDir -ChildPath $MainDBName
|
||||||
|
|
||||||
|
# Temporary DB actions
|
||||||
|
$this.WriteOutputLog("Performing DB cleanup tasks.")
|
||||||
|
$ignoreErrorsSaved = $this.Options.IgnoreErrors # This isn't a critical task, allow it to fail without stopping the script
|
||||||
|
$this.Options.IgnoreErrors = $true
|
||||||
|
$this.RunSqlCommand("""$MainDB"" ""DELETE from statistics_bandwidth WHERE account_id IS NULL;""", "Failed to clean up statistics_bandwidth table.")
|
||||||
|
$this.Options.IgnoreErrors = $ignoreErrorsSaved
|
||||||
|
|
||||||
|
$this.Output("Exporting Main DB")
|
||||||
$MainDBSQL = Join-Path $DBTemp -ChildPath "library.sql_$($this.TimeStamp)"
|
$MainDBSQL = Join-Path $DBTemp -ChildPath "library.sql_$($this.TimeStamp)"
|
||||||
if (!$this.FileExists($MainDB)) {
|
if (!$this.FileExists($MainDB)) {
|
||||||
$this.ExitDBMaintenance("Could not find $MainDBName in database directory", $false)
|
$this.ExitDBMaintenance("Could not find $MainDBName in database directory", $false)
|
||||||
@ -786,7 +794,7 @@ class DBRepair {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this.Options.CanIgnore = $false
|
$this.Options.CanIgnore = $true
|
||||||
return $result
|
return $result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user