/** * Sets a script running on the backend. * * @param array $script The filter script information. Passed elements: * - 'name': (string) the script name. * - 'recipes': (array) the filter recipe objects. * - 'script': (string) the filter script. * * @throws Ingo_Exception */ public function setScriptActive($script) { $this->_connect(); if (!strlen($script['script'])) { Ingo_Exception_Pear::catchError($this->_sieve->setActive('')); Ingo_Exception_Pear::catchError($this->_sieve->removeScript($script['name'])); return; } Ingo_Exception_Pear::catchError($this->_sieve->haveSpace($script['name'], strlen($script['script']))); Ingo_Exception_Pear::catchError($this->_sieve->installScript($script['name'], $script['script'], true)); }
$sieve->setDebug(true); if (PEAR::isError($error = $sieve->connect($host, $port))) { echo " there was an error trying to connect to the server. The error is: " . $error->getMessage() . "\n"; exit; } //if(PEAR::isError($error = $sieve->login($user, $passwd , 'PLAIN' , '', false ) ) ){ if (PEAR::isError($error = $sieve->login($user, $passwd, null, '', false))) { echo " there was an error trying to connect to the server. The error is: " . $error->getMessage() . "\n"; exit; } // I list the scripts that I Have installed echo "These are the scripts that I have in the server:\n"; print_r($sieve->listScripts()); echo "\n"; echo "I remove script 1 ({$sieve_script_name1})......\n"; if (!PEAR::isError($error = $sieve->removeScript($sieve_script_name1))) { echo " script '{$sieve_script_name1}' removed ok!\n"; } else { echo " there was an error trying to remove the script '{$sieve_script_name1}'. The error is: " . $error->getMessage() . "\n"; } echo "\n"; // I try to delete again de same script, the method must fail echo "I remove script 1 ({$sieve_script_name1})......\n"; if (!PEAR::isError($error = $sieve->removeScript($sieve_script_name1))) { echo " script '{$sieve_script_name1}' removed ok!\n"; } else { echo " there was an error trying to remove the script '{$sieve_script_name1}'. The error is: " . $error->getMessage() . "\n"; } echo "\n"; /* echo "I'll check if the server has space to store '$sieve_script_name1' script .....";