/** * 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)); }
echo "\n"; echo "This is the script I just installed.....\n"; if (!PEAR::isError($error = $sieve->getScript($sieve_script_name1))) { echo " script '{$sieve_script_name1}':\n{$error}\n"; } else { echo " there was an error trying to install the script '{$sieve_script_name1}'. The error is: " . $error->getMessage() . "\n"; } echo "I install the script '{$sieve_script_name2}' but it is not marked as active.....\n"; if (!PEAR::isError($error = $sieve->installScript($sieve_script_name2, $sieve_script2))) { echo " script '{$sieve_script_name2}' installed ok!\n"; } else { echo " there was an error trying to install the script '{$sieve_script_name2}'. The error is: " . $error->getMessage() . "\n"; } echo "\n"; echo "Now set script 2 as active...\n"; if (!PEAR::isError($error = $sieve->setActive($sieve_script_name2))) { echo " script '{$sieve_script_name2}' marked as active ok!\n"; } else { echo " there was an error trying to mark as active the script '{$sieve_script_name2}'. The error is: " . $error->getMessage() . "\n"; } echo "\n"; echo "Now get the active script....\n"; if (!PEAR::isError($error = $script = $sieve->getActive())) { echo "the script marked as active is: {$script}\n"; } else { echo " there was an error trying to get the activescript, the error is:" . $script->getMessage(); } echo "\n"; echo "The server has the following extensions:\n"; $exts = $sieve->getExtensions(); for ($i = 0; $i < count($exts); $i++) {