/usr/bin/mnemo-convert-to-utf8 is in php-horde-mnemo 4.2.12-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | #!/usr/bin/php
<?php
/**
* This script converts the data in an SQL backend from any supported charset
* to UTF-8.
*
* Copyright 2008-2016 Horde LLC (http://www.horde.org/)
*
* See the enclosed file LICENSE for license information (ASL). If you
* did not receive this file, see http://www.horde.org/licenses/apache.
*
* @author Jan Schneider <jan@horde.org>
*/
if (file_exists(__DIR__ . '/../../mnemo/lib/Application.php')) {
$baseDir = __DIR__ . '/../';
} else {
require_once 'PEAR/Config.php';
$baseDir = PEAR_Config::singleton()
->get('horde_dir', null, 'pear.horde.org') . '/mnemo/';
}
require_once $baseDir . 'lib/Application.php';
Horde_Registry::appInit('mnemo', array('cli' => true));
if ($conf['storage']['driver'] != 'sql') {
exit("You must have an SQL backend configured.\n");
}
$table = 'mnemo_memos';
$db = $injector->getInstance('Horde_Db_Adapter');
// Get current charset.
$charset = $cli->prompt('Please specify the current charset of the data',
null, 'ISO-8859-1');
// Read existing notes.
try {
$results = $db->selectAll('SELECT memo_owner, memo_id, memo_desc, memo_body FROM mnemo_memos');
} catch (Horde_Db_Exception $e) {
$cli->fatal($e->getMessage());
}
$sth = 'UPDATE mnemo_memos SET memo_desc = ?, memo_body = ?'
. ' WHERE memo_owner = ? AND memo_id = ?';
echo 'Converting notes';
foreach ($results as $row) {
$values = Horde_String::convertCharset(
array($row['memo_desc'], $row['memo_body']),
$charset, 'UTF-8');
$values[] = $row['memo_owner'];
$values[] = $row['memo_id'];
try {
$executed = $db->update($sth, $values);
} catch (Horde_Db_Exception $e) {
$cli->fatal($e->getMessage());
}
echo '.';
}
$cli->writeln($cli->green('Done'));
|