Zend Framework  1.12
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Zend_Mail_Storage_Writable_Maildir Class Reference

Public Member Functions

 __construct ($params)
 Create instance with parameters Additional parameters are (see parent for more):
 
 createFolder ($name, $parentFolder=null)
 create a new folder
 
 removeFolder ($name)
 remove a folder
 
 renameFolder ($oldName, $newName)
 rename and/or move folder
 
 appendMessage ($message, $folder=null, $flags=null, $recent=false)
 append a new message to mail storage
 
 copyMessage ($id, $folder)
 copy an existing message
 
 moveMessage ($id, $folder)
 move an existing message
 
 setFlags ($id, $flags)
 set flags for message
 
 removeMessage ($id)
 stub for not supported message deletion
 
 setQuota ($value)
 enable/disable quota and set a quota value if wanted or needed
 
 getQuota ($fromStorage=false)
 get currently set quota
 
 checkQuota ($detailedResponse=false, $forceRecalc=false)
 check if storage is currently over quota
 
- Public Member Functions inherited from Zend_Mail_Storage_Folder_Maildir
 __construct ($params)
 Create instance with parameters Supported parameters are:
 
 getFolders ($rootFolder=null)
 get root folder or given folder
 
 selectFolder ($globalName)
 select given folder
 
 getCurrentFolder ()
 get Zend_Mail_Storage_Folder instance for current folder
 
- Public Member Functions inherited from Zend_Mail_Storage_Maildir
 countMessages ($flags=null)
 Count messages all messages in current box.
 
 getSize ($id=null)
 Get a list of messages with number and size.
 
 getMessage ($id)
 Fetch a message.
 
 getRawHeader ($id, $part=null, $topLines=0)
 
 getRawContent ($id, $part=null)
 
 __construct ($params)
 Create instance with parameters Supported parameters are:
 
 close ()
 Close resource for mail lib.
 
 noop ()
 Waste some CPU cycles doing nothing.
 
 removeMessage ($id)
 stub for not supported message deletion
 
 getUniqueId ($id=null)
 get unique id for one or all messages
 
 getNumberByUniqueId ($id)
 get a message number from a unique id
 
- Public Member Functions inherited from Zend_Mail_Storage_Abstract
 __get ($var)
 Getter for has-properties.
 
 getCapabilities ()
 Get a full list of features supported by the specific mail lib and the server.
 
 countMessages ()
 Count messages messages in current box/folder.
 
 getSize ($id=0)
 Get a list of messages with number and size.
 
 getMessage ($id)
 Get a message with headers and body.
 
 getRawHeader ($id, $part=null, $topLines=0)
 Get raw header of message or part.
 
 getRawContent ($id, $part=null)
 Get raw content of message or part.
 
 __construct ($params)
 Create instance with parameters.
 
 __destruct ()
 Destructor calls close() and therefore closes the resource.
 
 close ()
 Close resource for mail lib.
 
 noop ()
 Keep the resource alive.
 
 removeMessage ($id)
 delete a message from current box/folder
 
 getUniqueId ($id=null)
 get unique id for one or all messages
 
 getNumberByUniqueId ($id)
 get a message number from a unique id
 
 count ()
 Countable::count()
 
 offsetExists ($id)
 ArrayAccess::offsetExists()
 
 offsetGet ($id)
 ArrayAccess::offsetGet()
 
 offsetSet ($id, $value)
 ArrayAccess::offsetSet()
 
 offsetUnset ($id)
 ArrayAccess::offsetUnset()
 
 rewind ()
 Iterator::rewind()
 
 current ()
 Iterator::current()
 
 key ()
 Iterator::key()
 
 next ()
 Iterator::next()
 
 valid ()
 Iterator::valid()
 
 seek ($pos)
 SeekableIterator::seek()
 
- Public Member Functions inherited from Zend_Mail_Storage_Writable_Interface
 appendMessage ($message, $folder=null, $flags=null)
 append a new message to mail storage
 

Static Public Member Functions

static initMaildir ($dir)
 create a new maildir
 

Protected Member Functions

 _createUniqueId ()
 create a uniqueid for maildir filename
 
 _createTmpFile ($folder= 'INBOX')
 open a temporary maildir file
 
 _getInfoString (&$flags)
 create an info string for filenames with given flags
 
 _calculateMaildirsize ()
 
 _calculateQuota ($forceRecalc=false)
 
 _addQuotaEntry ($size, $count=1)
 
- Protected Member Functions inherited from Zend_Mail_Storage_Folder_Maildir
 _buildFolderTree ()
 find all subfolders and mbox files for folder structure
 
- Protected Member Functions inherited from Zend_Mail_Storage_Maildir
 _getFileData ($id, $field=null)
 Get one or all fields from file structure.
 
 _isMaildir ($dirname)
 check if a given dir is a valid maildir
 
 _openMaildir ($dirname)
 open given dir as current maildir
 
 _getMaildirFiles ($dh, $dirname, $default_flags=array())
 find all files in opened dir handle and add to maildir files
 

Protected Attributes

 $_quota
 
- Protected Attributes inherited from Zend_Mail_Storage_Folder_Maildir
 $_rootFolder
 
 $_rootdir
 
 $_currentFolder
 
 $_delim
 
- Protected Attributes inherited from Zend_Mail_Storage_Maildir
 $_messageClass = 'Zend_Mail_Message_File'
 
 $_files = array()
 
- Protected Attributes inherited from Zend_Mail_Storage_Abstract
 $_has
 
 $_iterationPos = 0
 
 $_iterationMax = null
 
 $_messageClass = 'Zend_Mail_Message'
 

Additional Inherited Members

- Static Protected Attributes inherited from Zend_Mail_Storage_Maildir
static $_knownFlags
 

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
array$paramsmail reader specific parameters
Exceptions
Zend_Mail_Storage_Exception

Member Function Documentation

_addQuotaEntry (   $size,
  $count = 1 
)
protected
_calculateMaildirsize ( )
protected
_calculateQuota (   $forceRecalc = false)
protected
See Also
http://www.inter7.com/courierimap/README.maildirquota.html "Calculating the quota for a Maildir++"
_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
_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
_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
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
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
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.

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.

getQuota (   $fromStorage = false)

get currently set quota

See Also
Zend_Mail_Storage_Writable_Maildir::setQuota()
Returns
bool|array
See Also
Zend_Mail_Storage_Exception
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
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.

removeFolder (   $name)
removeMessage (   $id)

stub for not supported message deletion

Returns
null
Exceptions
Zend_Mail_Storage_Exception
See Also
Zend_Mail_Storage_Exception
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.

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.

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

Member Data Documentation

$_quota
protected