Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes

Zend_Mail_Storage_Writable_Maildir Class Reference

Inheritance diagram for Zend_Mail_Storage_Writable_Maildir:
Zend_Mail_Storage_Folder_Maildir Zend_Mail_Storage_Writable_Interface Zend_Mail_Storage_Maildir Zend_Mail_Storage_Folder_Interface Zend_Mail_Storage_Abstract

Public Member Functions

 __construct ($params)
 createFolder ($name, $parentFolder=null)
 removeFolder ($name)
 renameFolder ($oldName, $newName)
 appendMessage ($message, $folder=null, $flags=null, $recent=false)
 copyMessage ($id, $folder)
 moveMessage ($id, $folder)
 setFlags ($id, $flags)
 removeMessage ($id)
 setQuota ($value)
 getQuota ($fromStorage=false)
 checkQuota ($detailedResponse=false, $forceRecalc=false)

Static Public Member Functions

static initMaildir ($dir)

Protected Member Functions

 _createUniqueId ()
 _createTmpFile ($folder= 'INBOX')
 _getInfoString (&$flags)
 _calculateMaildirsize ()
 _calculateQuota ($forceRecalc=false)
 _addQuotaEntry ($size, $count=1)

Protected Attributes

 $_quota

Detailed Description

Definition at line 42 of file Maildir.php.


Constructor & Destructor Documentation

__construct ( params )

Create instance with parameters Additional parameters are (see parent for more):

  • create if true a new maildir is create if none exists
Parameters:
$paramsarray mail reader specific parameters
Exceptions:
Zend_Mail_Storage_Exception

Reimplemented from Zend_Mail_Storage_Folder_Maildir.

Definition at line 111 of file Maildir.php.


Member Function Documentation

_calculateMaildirsize (  ) [protected]
See also:
http://www.inter7.com/courierimap/README.maildirquota.html "Calculating maildirsize"

Definition at line 865 of file Maildir.php.

_calculateQuota ( forceRecalc = false ) [protected]
See also:
http://www.inter7.com/courierimap/README.maildirquota.html "Calculating the quota for a Maildir++"

Definition at line 961 of file Maildir.php.

_createTmpFile ( folder = 'INBOX' ) [protected]

open a temporary maildir file

makes sure tmp/ exists and create a file with a unique name you should close the returned filehandle!

Parameters:
string$foldername of current folder without leading .
Returns:
array array('dirname' => dir of maildir folder, 'uniq' => unique id, 'filename' => name of create file 'handle' => file opened for writing)
Exceptions:
Zend_Mail_Storage_Exception

See also:
Zend_Mail_Storage_Exception
Zend_Mail_Storage_Exception
Zend_Mail_Storage_Exception

Definition at line 433 of file Maildir.php.

_createUniqueId (  ) [protected]

create a uniqueid for maildir filename

This is nearly the format defined in the maildir standard. The microtime() call should already create a uniqueid, the pid is for multicore/-cpu machine that manage to call this function at the exact same time, and uname() gives us the hostname for multiple machines accessing the same storage.

If someone disables posix we create a random number of the same size, so this method should also work on Windows - if you manage to get maildir working on Windows. Microtime could also be disabled, altough I've never seen it.

Returns:
string new uniqueid

Definition at line 412 of file Maildir.php.

_getInfoString ( &$  flags ) [protected]

create an info string for filenames with given flags

Parameters:
array$flagswanted flags, with the reference you'll get the set flags with correct key (= char for flag)
Returns:
string info string for version 2 filenames including the leading colon
Exceptions:
Zend_Mail_Storage_Exception

See also:
Zend_Mail_Storage_Exception
Zend_Mail_Storage_Exception

Definition at line 495 of file Maildir.php.

appendMessage ( message,
folder = null,
flags = null,
recent = false 
)

append a new message to mail storage

Parameters:
string | stream$messagemessage as string or stream resource
null | string | Zend_Mail_Storage_Folder$folderfolder for new message, else current folder is taken
null | array$flagsset flags for new message, else a default set is used
bool$recenthandle this mail as if recent flag has been set, should only be used in delivery
Exceptions:
Zend_Mail_Storage_Exception

See also:
Zend_Mail_Storage_Exception
Zend_Mail_Storage_Exception

Definition at line 542 of file Maildir.php.

checkQuota ( detailedResponse = false,
forceRecalc = false 
)

check if storage is currently over quota

Parameters:
bool$detailedResponsereturn known data of quota and current size and message count
See also:
_calculateQuota()
Returns:
bool|array over quota state or detailed response

Definition at line 1045 of file Maildir.php.

copyMessage ( id,
folder 
)

copy an existing message

Parameters:
int$idnumber of message
string | Zend_Mail_Storage_Folder$foldername or instance of targer folder
Returns:
null
Exceptions:
Zend_Mail_Storage_Exception

See also:
Zend_Mail_Storage_Exception
Zend_Mail_Storage_Exception
Zend_Mail_Storage_Exception

Implements Zend_Mail_Storage_Writable_Interface.

Definition at line 615 of file Maildir.php.

createFolder ( name,
parentFolder = null 
)

create a new folder

This method also creates parent folders if necessary. Some mail storages may restrict, which folder may be used as parent or which chars may be used in the folder name

Parameters:
string$nameglobal name of folder, local name if $parentFolder is set
string | Zend_Mail_Storage_Folder$parentFolderparent folder for new folder, else root folder is parent
Returns:
string only used internally (new created maildir)
Exceptions:
Zend_Mail_Storage_Exception

See also:
Zend_Mail_Storage_Exception
Zend_Mail_Storage_Exception
Zend_Mail_Storage_Exception
Zend_Mail_Storage_Exception

Implements Zend_Mail_Storage_Writable_Interface.

Definition at line 134 of file Maildir.php.

getQuota ( fromStorage = false )

get currently set quota

See also:
Zend_Mail_Storage_Writable_Maildir::setQuota()
Returns:
bool|array

See also:
Zend_Mail_Storage_Exception

Definition at line 835 of file Maildir.php.

static initMaildir ( dir ) [static]

create a new maildir

If the given dir is already a valid maildir this will not fail.

Parameters:
string$dirdirectory for the new maildir (may already exist)
Returns:
null
Exceptions:
Zend_Mail_Storage_Exception

See also:
Zend_Mail_Storage_Exception
Zend_Mail_Storage_Exception
Zend_Mail_Storage_Exception

Definition at line 62 of file Maildir.php.

moveMessage ( id,
folder 
)

move an existing message

Parameters:
int$idnumber of message
string | Zend_Mail_Storage_Folder$foldername or instance of targer folder
Returns:
null
Exceptions:
Zend_Mail_Storage_Exception

See also:
Zend_Mail_Storage_Exception
Zend_Mail_Storage_Exception

Implements Zend_Mail_Storage_Writable_Interface.

Definition at line 694 of file Maildir.php.

removeFolder ( name )
removeMessage ( id )

stub for not supported message deletion

Returns:
null
Exceptions:
Zend_Mail_Storage_Exception

See also:
Zend_Mail_Storage_Exception

Reimplemented from Zend_Mail_Storage_Maildir.

Definition at line 790 of file Maildir.php.

renameFolder ( oldName,
newName 
)

rename and/or move folder

The new name has the same restrictions as in createFolder()

Parameters:
string | Zend_Mail_Storage_Folder$oldNamename or instance of folder
string$newNamenew global name of folder
Returns:
null
Exceptions:
Zend_Mail_Storage_Exception

See also:
Zend_Mail_Storage_Exception
Zend_Mail_Storage_Exception
Zend_Mail_Storage_Exception
Zend_Mail_Storage_Exception

Implements Zend_Mail_Storage_Writable_Interface.

Definition at line 326 of file Maildir.php.

setFlags ( id,
flags 
)

set flags for message

NOTE: this method can't set the recent flag.

Parameters:
int$idnumber of message
array$flagsnew flags for message
Exceptions:
Zend_Mail_Storage_Exception

See also:
Zend_Mail_Storage_Exception

Implements Zend_Mail_Storage_Writable_Interface.

Definition at line 761 of file Maildir.php.

setQuota ( value )

enable/disable quota and set a quota value if wanted or needed

You can enable/disable quota with true/false. If you don't have a MDA or want to enforce a quota value you can also set this value here. Use array('size' => SIZE_QUOTA, 'count' => MAX_MESSAGE) do define your quota. Order of these fields does matter!

Parameters:
bool | array$valuenew quota value
Returns:
null

Definition at line 824 of file Maildir.php.


The documentation for this class was generated from the following file: