\documentclass{article}
\usepackage{ulem}
\usepackage{graphicx}
\usepackage{hyperref}
\pagestyle{headings}
\begin{document}
Sometimes there is a requirement to rename users in the Horde DB. eg: you move from a system with 'standard' users to one where virtual hosting is used. In such a situation the old user may be 'fred' and the new user may be '<a href="https://wiki.horde.org/mailto:fred@hisdomain.com">fred@hisdomain.com</a>'

The script below seems to work for the following apps:

\begin{itemize}
\item Address Book (turba)


\item Calendar (kronolith)


\item File Manager (gollem)


\item Filters (ingo)


\item Horde (horde)


\item Mail (imp)


\item News (jonah)


\item Notes (mnemo)


\item Password (passwd)


\item Tasks (nag)


\item Tickets (whups)


\item Time Tracking (hermes)


\end{itemize}
YMMV and more apps will need more changes of course.

\textbf{BACKUP YOUR DB BEFORE RUNNING ANYTHING LIKE THIS!}

<pre><code>
\#!/bin/sh

function horde\_rename() \{
  new=\$2; old=\$1
  echo "Rename \$old -> \$new"

  mysql -u horde -ppassword horde << EOF
update hermes\_timeslices set employee\_id = '\$new' where employee\_id = '\$old';
update horde\_datatree set user\_uid = '\$new' where user\_uid = '\$old';
update horde\_datatree set datatree\_name = '\$new' where datatree\_name = '\$old' and user\_uid = '\$new';
update horde\_datatree\_attributes set attribute\_value = '\$new' where attribute\_value = '\$old' and attribute\_key = 'who';
update horde\_datatree\_attributes set attribute\_key= '\$new' where attribute\_key = '\$old' and attribute\_name = 'perm\_users';
update horde\_datatree\_attributes set attribute\_value = '\$new' where attribute\_value = '\$old' and attribute\_name = 'uid';
update horde\_datatree\_attributes set attribute\_value = '\$new' where attribute\_value = '\$old' and attribute\_name = 'owner';
update horde\_histories set history\_who = '\$new' where history\_who = '\$old';
update horde\_prefs set pref\_uid = '\$new' where pref\_uid = '\$old';
update kronolith\_events set event\_creator\_id = '\$new' where event\_creator\_id = '\$old';
update kronolith\_events set calendar\_id = '\$new' where calendar\_id = '\$old';
update mnemo\_memos set memo\_owner = '\$new' where memo\_owner = '\$old';
update nag\_tasks set task\_owner = '\$new' where task\_owner = '\$old';
update turba\_objects set owner\_id = '\$new' where owner\_id = '\$old';
update whups\_tickets set user\_id\_requester = '\$new' where user\_id\_requester = '\$old';
update whups\_queues\_users set user\_uid = '\$new' where user\_uid = '\$old';
update whups\_users\_searches set user\_uid = '\$new' where user\_uid = '\$old';
EOF
  echo "Done with \$new"
\}

horde\_rename 'fred' 'fred@hisdomain.com'
</code></pre>
I did notice that notepads, tasks lists, calendars, etc. become 'hidden' after doing this. No data appears to be lost and users simply have to re-select the ones they want to see though.

\end{document}
