HEX
Server: Apache/2.2.34 (Unix) mod_fastcgi/mod_fastcgi-SNAP-0910052141
System: Linux Kou-Etsu-Dou 4.4.59+ #25556 SMP PREEMPT Thu Mar 4 18:03:46 CST 2021 x86_64
User: hosam (1026)
PHP: 7.2.29
Disabled: NONE
Upload Files
File: /volume1/@appstore/MailClient/scripts/dump_drop_thread_label_table.sh
#!/bin/bash

MAIL_DB=$1
TABLE="many_thread_has_many_label"

DumpAndDropTable() {
	local db_dir=`dirname ${MAIL_DB}`
	local bak_file="${db_dir}/${TABLE}.bak"

	local res=`sqlite3 $MAIL_DB ".dump ${TABLE}" > $bak_file`
	if [ $? -ne 0 ]; then
		exit 1;
	fi

	local size=`stat -c%s ${bak_file}`
	if [ $? -ne 0 ] || [ $size -lt 53 ]; then
		exit 1
	fi

	sqlite3 $MAIL_DB "DROP TABLE IF EXISTS ${TABLE}"
}

if [ ! -f "$MAIL_DB" ];then
	echo "Usage: $0 db_path"
	exit 1
fi

DumpAndDropTable

exit 0