cvs: pear /Net_Cyrus Cyrus.php test_cyrus.php

From: Date: Sun, 26 Mar 2006 22:09:22 +0000
Subject: cvs: pear /Net_Cyrus Cyrus.php test_cyrus.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-39339@lists.php.net to get a copy of this message
amistry Sun Mar 26 22:09:22 2006 UTC Modified files: /pear/Net_Cyrus Cyrus.php test_cyrus.php Log: Add the ability to create and rename users in partitions. eg. $options = array("PARTITION" => "Server1:Partition1", "TYPE" => "Calendar"); createMailbox("newuser", $options); Currently only the PARTITION argument is used, but if the createparams working draft is approved an implemented then adding more options will be trivial. http://cvs.php.net/viewcvs.cgi/pear/Net_Cyrus/Cyrus.php?r1=1.3&r2=1.4&diff_format=u Index: pear/Net_Cyrus/Cyrus.php diff -u pear/Net_Cyrus/Cyrus.php:1.3 pear/Net_Cyrus/Cyrus.php:1.4 --- pear/Net_Cyrus/Cyrus.php:1.3 Wed Mar 22 04:02:54 2006 +++ pear/Net_Cyrus/Cyrus.php Sun Mar 26 22:09:21 2006 @@ -302,14 +302,15 @@ * Creates a mailbox. * * @param string $mailbox Name of mailbox to create + * @param array $options options to pass to create * * * @return mixed True on success, PEAR error otherwise * @access public */ - function createMailbox($mailbox) + function createMailbox($mailbox, $options = null) { - $res= parent::createMailbox($mailbox); + $res = parent::createMailbox($mailbox, $options); return $res; } @@ -318,14 +319,15 @@ * * @param string $mailbox Name of mailbox to rename * @param string $newname New name of mailbox + * @param array $options options to pass to rename * * @return mixed True on success, PEAR error otherwise * @access public */ - function renameMailbox($mailbox, $newname) + function renameMailbox($mailbox, $newname, $options = null) { $oldPrivs = $this->_setAdminPriv($mailbox); - if( PEAR::isError( $response = parent::renameMailbox($mailbox, $newname) )){ + if( PEAR::isError( $response = parent::renameMailbox($mailbox, $newname, $options) )){ return $response; } $this->_resetAdminPriv($mailbox, $oldPrivs); @@ -441,17 +443,18 @@ * creates a user. Use this instead of createMailbox * * @param string $user_name the user to create + * @param array $options options to pass to createMailbox * * @return mixed true on Success/PearError on Failure * @access public */ - function createUser($user_name) + function createUser($user_name, $options = null) { if( $this->userExists($user_name) ){ return $this->_raiseError("The user $user_name already exists" , 503); } $user_name=$this->getUserName($user_name); - return $this->createMailbox($user_name); + return $this->createMailbox($user_name, $options); } @@ -479,11 +482,12 @@ * * @param string $oldUser Name of user to rename * @param string $newUser New name of user + * @param array $options options to pass to createMailbox and renameMailbox * * @return mixed true on Success/PearError on Failure * @access public */ - function renameUser($oldUser, $newUser) + function renameUser($oldUser, $newUser, $options = null) { $oldUsername = $this->getUserName($oldUser,false); @@ -506,7 +510,7 @@ } // Create the new mailbox - $this->createMailbox($newUser); + $this->createMailbox($newUser, $options); $oldAdminPrivs = $this->_setAdminPriv($newUser); // Copy Mail and quotas @@ -519,7 +523,7 @@ if (!empty($folderList)) { foreach ($folderList as $folder) { $newFolderName = str_replace($oldUser, $newUser, $folder); - $this->renameMailbox($folder, $newFolderName); + $this->renameMailbox($folder, $newFolderName, $options); $this->setACL($newFolderName, $newUsername, 'lrswipcd'); $this->deleteACL($newFolderName, $oldUsername); } http://cvs.php.net/viewcvs.cgi/pear/Net_Cyrus/test_cyrus.php?r1=1.2&r2=1.3&diff_format=u Index: pear/Net_Cyrus/test_cyrus.php diff -u pear/Net_Cyrus/test_cyrus.php:1.2 pear/Net_Cyrus/test_cyrus.php:1.3 --- pear/Net_Cyrus/test_cyrus.php:1.2 Wed Mar 22 04:02:54 2006 +++ pear/Net_Cyrus/test_cyrus.php Sun Mar 26 22:09:21 2006 @@ -48,9 +48,6 @@ $cyrus= new Net_Cyrus(); //$cyrus->setDebug(true); - - - if(PEAR::isError($ret= $cyrus->connect($user,$passwd,$host, $port) ) ){ echo "Error. " . $ret->getMessage() . "\n" ; exit();

« previous php.pear.cvs (#39339) next »