1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-04 17:24:45 +00:00

chore: auto format code

This commit is contained in:
Tw93
2025-12-28 11:39:34 +00:00
parent da1b5cb8d4
commit 66ad3b34ee
4 changed files with 14 additions and 14 deletions

View File

@@ -137,7 +137,7 @@ clean_deep_system() {
debug_log "Symbolication cache directory found, checking size..."
# Quick size check with timeout (max 5 seconds)
local symbolication_size_mb=""
symbolication_size_mb=$(run_with_timeout 5 du -sm "/System/Library/Caches/com.apple.coresymbolicationd/data" 2>/dev/null | awk '{print $1}')
symbolication_size_mb=$(run_with_timeout 5 du -sm "/System/Library/Caches/com.apple.coresymbolicationd/data" 2> /dev/null | awk '{print $1}')
# Validate that we got a valid size (non-empty and numeric)
if [[ -n "$symbolication_size_mb" && "$symbolication_size_mb" =~ ^[0-9]+$ ]]; then
@@ -170,7 +170,7 @@ clean_deep_system() {
# Clean each path if exists
for ali_path in "${ali_paths[@]}"; do
if sudo test -e "$ali_path" 2>/dev/null; then
if sudo test -e "$ali_path" 2> /dev/null; then
debug_log "Found Aliyun component: $ali_path, removing..."
safe_sudo_remove "$ali_path" && ((ali_cleaned++)) || true
fi

View File

@@ -186,12 +186,12 @@ safe_sudo_find_delete() {
local type_filter="${4:-f}"
# Validate base directory (use sudo for permission-restricted dirs)
if ! sudo test -d "$base_dir" 2>/dev/null; then
if ! sudo test -d "$base_dir" 2> /dev/null; then
debug_log "Directory does not exist (skipping): $base_dir"
return 0
fi
if sudo test -L "$base_dir" 2>/dev/null; then
if sudo test -L "$base_dir" 2> /dev/null; then
log_error "Refusing to search symlinked directory: $base_dir"
return 1
fi

View File

@@ -210,7 +210,7 @@ opt_network_optimization() {
opt_sqlite_vacuum() {
local optimized_count=0
local total_saved_kb=0
local min_size_kb=1024 # Only optimize databases larger than 1MB
local min_size_kb=1024 # Only optimize databases larger than 1MB
# List of safe databases to optimize
# Exclude critical system databases like Mail, Messages, Photos
@@ -228,7 +228,7 @@ opt_sqlite_vacuum() {
[[ ! -f "$db_path" ]] && continue
# Check if it's a SQLite database
if ! file "$db_path" 2>/dev/null | grep -q "SQLite"; then
if ! file "$db_path" 2> /dev/null | grep -q "SQLite"; then
continue
fi
@@ -252,7 +252,7 @@ opt_sqlite_vacuum() {
fi
# Verify database integrity before VACUUM
if ! sqlite3 "$db_path" "PRAGMA integrity_check;" 2>/dev/null | grep -q "ok"; then
if ! sqlite3 "$db_path" "PRAGMA integrity_check;" 2> /dev/null | grep -q "ok"; then
debug_log "Skipping $db_path - integrity check failed"
continue
fi
@@ -261,9 +261,9 @@ opt_sqlite_vacuum() {
local size_before=$db_size_kb
# Perform VACUUM with error handling
if sqlite3 "$db_path" "VACUUM;" 2>/dev/null; then
if sqlite3 "$db_path" "VACUUM;" 2> /dev/null; then
# Verify database integrity after VACUUM
if ! sqlite3 "$db_path" "PRAGMA integrity_check;" 2>/dev/null | grep -q "ok"; then
if ! sqlite3 "$db_path" "PRAGMA integrity_check;" 2> /dev/null | grep -q "ok"; then
debug_log "Warning: $db_path integrity check failed after VACUUM"
continue
fi