<html>
<head>
<title>Trim Supported Types</title>
</head>
<body>
<a href="list_pods.php">Zur Liste</a>
<?php
require_once("../config.php");
require_once("lib/db_utils.php");
if (!empty($argv[1])) {
$_REQUEST["really"] = $argv[1];
}
$sql = "select * from item where ingested = 1 and supported_types like concat(item_type, '%')";
$rs = db_query($sql);
$rows = array();
while ($row = db_next_row($rs)) {
$rows[] = $row;
}
echo "found ".count($rows)." items to trim ...<br/>\n";
foreach ($rows as $row) {
echo "trim ".$row["title"]." - ".$row["pubdate"]."<br/>\n";
$st = split(",", $row["supported_types"]);
unset($st[0]);
$sl = split(",", $row["supported_lengths"]);
unset($sl[0]);
$sql = "update item set supported_types = '".join(",", $st)."', supported_lengths = '".join(",", $sl)."' where id = '".$row["id"]."'";
echo $sql."<br/>\n";
if (!empty($_REQUEST["really"])) {
db_query($sql);
}
}
echo "trimmed ".count($rows)." items <br/>\n";
?>
<a href="cleanup.php?really=true">Wirklich trimmen ?</a>
</body>
</html>