Files
oc-server3/htdocs/util2/cache_repairnames/repairnames.php
T
following 22e98f5e00 docs and utils cleanup / update / lib2-ports
and added cache name trimming, see util2/cache_repairnames/repairnames.cpp
2013-07-17 17:21:10 +02:00

29 lines
970 B
PHP

#!/usr/local/bin/php -q
<?php
/***************************************************************************
* For license information see doc/license.txt
*
* Unicode Reminder メモ
*
* OC versions < 3.0.9 allowed entering spaces befor and after cache names.
* This tool reparis these names. It should no longer be neeeded from
* version 9 on, as newcache.php and editcache.php now trim the names.
***************************************************************************/
$opt['rootpath'] = '../../';
require($opt['rootpath'] . 'lib2/cli.inc.php');
$rs = sql("SELECT `cache_id`, `name` FROM `caches` WHERE `name`<'\"' ORDER BY `name` ASC");
while ($r = sql_fetch_array($rs))
{
$name = trim($r['name']);
if ($name != $r['name'] && $name != "")
{
echo "ID " . $r['cache_id'] . ": trimmed cache name to '" . $name . "'\n";
sql("UPDATE `caches` SET `name`='&1' WHERE `cache_id`=&2", $name, $r['cache_id']);
}
}
sql_free_result($rs);
?>