Re: script for regenerate and activate all filters

Jan Schneider <[email protected]>
Newsgroups gmane.comp.horde.devel
Message-ID <[email protected]>
Zitat von Jason Keltz <[email protected]>:

> Hi.
>
> I hope I'm writing to the right list.    I'm switching our mail  
> format from mbox to maildir, and I need to regenerate the Ingo  
> procmail filters on my system.  I'm close coming up with a basic  
> script to do this, but having some trouble, and hoping for some  
> advice..
>
> This part is fine..
>
> #!/usr/bin/php
> <?php
>
> @define('HORDE_BASE', '/local/horde');
>
> set_include_path(get_include_path() . PATH_SEPARATOR . HORDE_BASE .  
> "/pear/php");
>
> require_once HORDE_BASE . '/lib/Application.php';
>
> Horde_Registry::appInit('ingo', array('cli' => true));
>
> $user="jas";
>
>   echo "$user";
>   $registry->setAuth($user, array());
>   $session->set('ingo', 'current_share', ':' . $user);
>   $ingo_storage = $injector->getInstance('Ingo_Factory_Storage')->create();
> print_r($ingo_storage->retrieve(Ingo_Storage::ACTION_WHITELIST)->getWhitelist());
>
>   ^--- since this prints my whitelist, I know I'm close...
>
>  I expected I'd be able to generate the script something like this:
>
>   $ingo_script = $injector->getInstance('Ingo_Factory_Script')->createAll();

createAll() would return an array, so the line below should fatal out.

>   $script = $ingo_script->generate();
>
>  print_r($script);  <---- but this doesn't look like the procmail script...

If $ingo_script is an element of the array returned from createAll()  
above, that should return a hash, not a script.

> And I know there's a command to activate the script afterwards..  
> what would that be?
>
>   Ingo_Script_Util::activate($ingo_script->generate()); <---  
> something like that?

Yes. See ingo/lib/Basic/Script.php to see how scripts are activated.

-- 
Jan Schneider
The Horde Project
http://www.horde.org/
https://www.facebook.com/hordeproject

-- 
dev mailing list
Frequently Asked Questions: http://wiki.horde.org/FAQ
To unsubscribe, mail: [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.