blob: a63e3127f4112724c0fc448970b5e8f038454cad (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#!/usr/bin/env python
# Dependencies:
# dev-lang/python[sqlite]
# sys-apps/file[python]
import os.path
import magic
import sqlite3
home = os.path.expanduser('~')
try:
m = magic.open(magic.MAGIC_NONE)
m.load()
for root, dirs, files in os.walk(os.path.join(home, '.config', 'chromium')):
for f in files:
path = os.path.join(root, f)
magic_type = m.file(path)
if magic_type and 'SQLite' in magic_type:
try:
c = sqlite3.connect(path)
c.execute('VACUUM')
c.execute('REINDEX')
finally:
c.close()
finally:
m.close()
|