[imp] Problem with maintenance tasks / renaming sent-mail folder

Tero Matinlassi tero.matinlassi@edu.vantaa.fi
Thu, 23 May 2002 17:02:58 +0300


Lainaus Jan Schneider <jan@horde.org>:

> Looks like broken locales on your system.

Definetly. Now that I think this, I've seen this extra empty character  
as long as I've been using Finnish locale in Linux systems.. don't know 
if other systems have this thing also.
 
> Anyway, you can use something like:
> 'sent-mail-' . strtolower(trim(strftime('%b', $last_login)) . '-' .  
>   strftime('%Y', $last_login))

This won't help, because the empty character in this case is ASCII 160 
(meta space) and trim won't recognise it as a whitespace character.

I'll think I try something different, like substr($foo, 0, -1) with 
this.. let's see. Here's the patch I use:

--- lib/Maintenance/Task/rename_sentmail_monthly.php.orig       Thu May 
23 16:26:34 2002
+++ lib/Maintenance/Task/rename_sentmail_monthly.php    Thu May 23 
16:57:02 2002
@@ -112,7 +112,11 @@
         if (!isset($last_login) || $last_login == 0) {
             $last_login = mktime(0, 0, 0, date('m') - 1, date('d'));
         }
-        return $folder . strtolower(strftime("-%b-%Y", $last_login));
+        $month = strftime("-%b", $last_login);
+        if (strcmp(substr($month, -1, 1), chr(160)) == 0) {
+            $month = substr($month, 0, -1);
+        }
+        return $folder . strtolower($month . strftime("-%Y", 
$last_login));
     }

 }


I guess this won't break anything?


-Tero

-- 
Tero Matinlassi
Postipalvelimen ylläpito
Mail server administration