diff options
author | Eric Wong <e@80x24.org> | 2021-05-25 11:01:36 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-05-25 18:42:09 +0000 |
commit | bfe6a3e13c286d60a5bfa46cef7625f83ae0ca18 (patch) | |
tree | a600016bf97e6364e1cb4990f11700d74a84c133 /lib/PublicInbox/LeiMailSync.pm | |
parent | 172d2d126cb9c0fa78b41a01f285f9294cc78f15 (diff) | |
download | public-inbox-bfe6a3e13c286d60a5bfa46cef7625f83ae0ca18.tar.gz |
Sometimes a user stops caring to sync an IMAP or Maildir folder, or wants to force a resync. Let them run this command to have lei forget all the sync information about the mail folder. This won't delete any stored messages in git, but will leave "lei index" users with dangling references.
Diffstat (limited to 'lib/PublicInbox/LeiMailSync.pm')
-rw-r--r-- | lib/PublicInbox/LeiMailSync.pm | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/PublicInbox/LeiMailSync.pm b/lib/PublicInbox/LeiMailSync.pm index 094cf1fd..d9c30580 100644 --- a/lib/PublicInbox/LeiMailSync.pm +++ b/lib/PublicInbox/LeiMailSync.pm @@ -345,4 +345,15 @@ EOF $err; } +sub forget_folder { + my ($self, $folder) = @_; + my ($fid, $sth); + $fid = delete($self->{fmap}->{$folder}) // + _fid_for($self, $folder) // return; + my $dbh = $self->{dbh}; + $dbh->do('DELETE FROM blob2name WHERE fid = ?', undef, $fid); + $dbh->do('DELETE FROM blob2num WHERE fid = ?', undef, $fid); + $dbh->do('DELETE FROM folders WHERE fid = ?', undef, $fid); +} + 1; |