[horde] PHP ERRORs when using removeUserData()

Michael M Slusarz slusarz at horde.org
Fri Oct 18 18:12:23 UTC 2013


Quoting Steffen <skhorde at smail.inf.fh-bonn-rhein-sieg.de>:

> Hi,
>
> because I didn't found a ready-to-use script to remove user data for  
> Horde5, e.g. in /usr/bin, I assembled:
>
> <?PHP
> ///// top of script from /usr/bin/webmail-install script

This is not from any recent webmail-install script I am aware of.

> require_once HORDE_BASE . '/lib/core.php';
>
> // Load the CLI environment.
> $cli = Horde_Core_Cli::init();
> if (!$cli->runningFromCLI()) {
>     $cli->fatal('This script must be run from the command line.');
> }

Don't do this.  CLI will be automatically initialized for you via  
Horde_Registry::appInit() (see below).

> // Start.
> $cli->writeln();
> $cli->writeln($cli->bold('Remove user data'));
>
> Horde_Registry::appInit('horde', array('cli' => true, 'user_admin' => true));
>
> $value = '<user>';
> $cli->writeln('Remove user data of ' . $value);
> $registry->removeUserData($value);

 From horde/bin, this script would be much better:

<?php
require_once __DIR__ . '/../lib/Application.php';
Horde_Registry::appInit('horde', array('cli' => true, 'user_admin' => true));
$value = '<user>';
$cli->writeln('Remove user data of ' . $value);
$registry->removeUserData($value);


michael

___________________________________
Michael Slusarz [slusarz at horde.org]



More information about the horde mailing list