[imp] Re: Using hook to copy Squirrelmail to Turba on first login?
Josh Trutwin
josh at trutwins.homeip.net
Tue Apr 19 12:00:57 PDT 2005
On Tue, 19 Apr 2005 14:46:33 +0200
Jan Schneider <jan at horde.org> wrote:
> Zitat von Josh Trutwin <josh at trutwins.homeip.net>:
>
> > I have some MySQL code that copies a user's SquirrelMail
> > addressbook into the Turba tables (both are using a MySQL
> > backend). I'm working on a migration plan from SquirrelMail to
> > Horde3/Imp4 and what I'd like to do is use the
> > _horde_hook_postauthenticate hook to run this code on the user's
> > first login to Imp. The only thing I'm not sure of is how to tell
> > whether or not it's the user's first login. It must be possible
> > since it shows the Last Login each time anyone logs in. Any
> > thoughts? Here's what I'm attempting to do with the hook:
>
> Use a custom TOS maintenance task instead, these are automatically
> run on first login only.
Having a little trouble getting started here, I followed the
directions in horde/lib/Horde/Maintenance.php but my task is never
showing up after wiping out the last_login preference.
Here's what I did:
Added prefs in Imp:
$conf['sm_import']['import_addressbook'] = true;
$conf['sm_import']['import_prefs'] = true;
$conf['sm_import']['sm_host'] = 'localhost';
$conf['sm_import']['sm_username'] = 'squirreluser';
$conf['sm_import']['sm_password'] = 's2q0u0i3rrel';
$conf['sm_import']['sm_database'] = 'squirrelmail';
$conf['sm_import']['sm_address_table'] = 'address';
$conf['sm_import']['sm_prefs_table'] = 'userpref';
$conf['sm_import'] = true;
That last one should be the trigger to call the Maintenance task
right?
in imp/lib/Maintenance/imp.php:
var $maint_tasks = array(
'tos_agreement' => MAINTENANCE_FIRST_LOGIN,
'sm_import' => MAINTENANCE_FIRST_LOGIN,
'fetchmail_login' => MAINTENANCE_EVERY,
'rename_sentmail_monthly' => MAINTENANCE_MONTHLY,
'delete_sentmail_monthly' => MAINTENANCE_MONTHLY,
'delete_attachments_monthly' => MAINTENANCE_MONTHLY,
'purge_trash' => MAINTENANCE_MONTHLY
);
created: imp/lib/Maintenance/Task/sm_import.php:
http://www.netbits.us/sm_import.phps
The task never gets called on login - in fact the tos_agreement task
doesn't either. I did not disable Maintenance tasks globally.
Anything else I can check?
Thanks,
Josh
More information about the imp
mailing list