[dev] script for regenerate and activate all filters

Jan Schneider jan at horde.org
Wed Apr 22 07:19:39 UTC 2015


Zitat von Jason Keltz <jas at cse.yorku.ca>:

> 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



More information about the dev mailing list