mirror of
https://github.com/ChuckPa/PlexDBRepair.git
synced 2025-11-06 03:08:55 -05:00
Merge pull request #202 from danrahn/master
Add statistics_bandwidth Cleanup to Windows Scripts
This commit is contained in:
commit
8c5f7606a7
@ -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%"
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
# #
|
# #
|
||||||
#########################################################################
|
#########################################################################
|
||||||
|
|
||||||
$DBRepairVersion = 'v1.01.00'
|
$DBRepairVersion = 'v1.01.01'
|
||||||
|
|
||||||
class DBRepair {
|
class DBRepair {
|
||||||
[DBRepairOptions] $Options
|
[DBRepairOptions] $Options
|
||||||
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4,6 +4,9 @@ Release notes for the Windows counterpart to DBRepair.sh (DBRepair-Windows.ps1)
|
|||||||
|
|
||||||
# Release Info
|
# Release Info
|
||||||
|
|
||||||
|
v1.01.01
|
||||||
|
- Add `staticstics_bandwidth` pruning during automatic repair.
|
||||||
|
|
||||||
v1.01.00
|
v1.01.00
|
||||||
- Rename this tool to be compliant with Plex inc. Trademark Policy.
|
- Rename this tool to be compliant with Plex inc. Trademark Policy.
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user