@ -24,6 +24,7 @@ import org.thoughtcrime.securesms.database.AttachmentDatabase;
import org.thoughtcrime.securesms.database.MmsDatabase ;
import org.thoughtcrime.securesms.database.MmsDatabase ;
import org.thoughtcrime.securesms.database.MmsSmsColumns ;
import org.thoughtcrime.securesms.database.MmsSmsColumns ;
import org.thoughtcrime.securesms.database.OneTimePreKeyDatabase ;
import org.thoughtcrime.securesms.database.OneTimePreKeyDatabase ;
import org.thoughtcrime.securesms.database.SearchDatabase ;
import org.thoughtcrime.securesms.database.SessionDatabase ;
import org.thoughtcrime.securesms.database.SessionDatabase ;
import org.thoughtcrime.securesms.database.SignedPreKeyDatabase ;
import org.thoughtcrime.securesms.database.SignedPreKeyDatabase ;
import org.thoughtcrime.securesms.database.SmsDatabase ;
import org.thoughtcrime.securesms.database.SmsDatabase ;
@ -78,7 +79,9 @@ public class FullBackupExporter extends FullBackupBase {
count = exportTable ( table , input , outputStream , null , cursor - > exportAttachment ( attachmentSecret , cursor , outputStream ) , count ) ;
count = exportTable ( table , input , outputStream , null , cursor - > exportAttachment ( attachmentSecret , cursor , outputStream ) , count ) ;
} else if ( ! table . equals ( SignedPreKeyDatabase . TABLE_NAME ) & &
} else if ( ! table . equals ( SignedPreKeyDatabase . TABLE_NAME ) & &
! table . equals ( OneTimePreKeyDatabase . TABLE_NAME ) & &
! table . equals ( OneTimePreKeyDatabase . TABLE_NAME ) & &
! table . equals ( SessionDatabase . TABLE_NAME ) )
! table . equals ( SessionDatabase . TABLE_NAME ) & &
! table . startsWith ( SearchDatabase . SMS_FTS_TABLE_NAME ) & &
! table . startsWith ( SearchDatabase . MMS_FTS_TABLE_NAME ) )
{
{
count = exportTable ( table , input , outputStream , null , null , count ) ;
count = exportTable ( table , input , outputStream , null , null , count ) ;
}
}
@ -111,17 +114,20 @@ public class FullBackupExporter extends FullBackupBase {
String type = cursor . getString ( 2 ) ;
String type = cursor . getString ( 2 ) ;
if ( sql ! = null ) {
if ( sql ! = null ) {
boolean isSmsFtsSecretTable = name ! = null & & ! name . equals ( SearchDatabase . SMS_FTS_TABLE_NAME ) & & name . startsWith ( SearchDatabase . SMS_FTS_TABLE_NAME ) ;
boolean isMmsFtsSecretTable = name ! = null & & ! name . equals ( SearchDatabase . MMS_FTS_TABLE_NAME ) & & name . startsWith ( SearchDatabase . MMS_FTS_TABLE_NAME ) ;
if ( ! isSmsFtsSecretTable & & ! isMmsFtsSecretTable ) {
if ( "table" . equals ( type ) ) {
if ( "table" . equals ( type ) ) {
outputStream . write ( BackupProtos . SqlStatement . newBuilder ( ) . setStatement ( "DROP TABLE IF EXISTS " + name ) . build ( ) ) ;
tables . add ( name ) ;
tables . add ( name ) ;
} else if ( "index" . equals ( type ) ) {
outputStream . write ( BackupProtos . SqlStatement . newBuilder ( ) . setStatement ( "DROP INDEX IF EXISTS " + name ) . build ( ) ) ;
}
}
outputStream . write ( BackupProtos . SqlStatement . newBuilder ( ) . setStatement ( cursor . getString ( 0 ) ) . build ( ) ) ;
outputStream . write ( BackupProtos . SqlStatement . newBuilder ( ) . setStatement ( cursor . getString ( 0 ) ) . build ( ) ) ;
}
}
}
}
}
}
}
return tables ;
return tables ;
}
}