Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F120824680
DeleteCommand.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
DeleteCommand.php
View Options
<?php
namespace
App\Console\Commands\Imap
;
use
App\Console\Command
;
use
App\Support\Facades\IMAP
;
class
DeleteCommand
extends
Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected
$signature
=
'imap:delete {user} {mailbox} {--clear : Clear mailbox instead}'
;
/**
* The console command description.
*
* @var string
*/
protected
$description
=
"Delete IMAP Folders"
;
/**
* Execute the console command.
*
* @return mixed
*/
public
function
handle
()
{
$user
=
$this
->
argument
(
'user'
);
$mailbox
=
$this
->
argument
(
'mailbox'
);
if
(
$mailbox
==
"*"
)
{
// Reverse so subfolders are deleted before parent folders
foreach
(
array_reverse
(
IMAP
::
listMailboxes
(
$user
))
as
$mailbox
)
{
if
(
$this
->
option
(
'clear'
))
{
IMAP
::
clearMailbox
(
$mailbox
);
}
else
{
IMAP
::
deleteMailbox
(
$mailbox
);
}
}
// Can't delete INBOX
IMAP
::
clearMailbox
(
IMAP
::
userMailbox
(
$user
,
"INBOX"
));
}
else
{
if
(
$this
->
option
(
'clear'
))
{
IMAP
::
clearMailbox
(
IMAP
::
userMailbox
(
$user
,
$mailbox
));
}
else
{
IMAP
::
deleteMailbox
(
IMAP
::
userMailbox
(
$user
,
$mailbox
));
}
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Apr 24, 10:25 AM (1 d, 8 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18863028
Default Alt Text
DeleteCommand.php (1 KB)
Attached To
Mode
rK kolab
Attached
Detach File
Event Timeline