Hiho!
Ich habe mir jetzt erstmal mit einem kleinen Script beholfen. Nicht elegant, fast keine Validierung oder Sicherheit, aber es hilft erstmal.
PHP-Code:
<?php
// select original_filename, title, description from tx_yag_domain_model_item where album=122;
$user = 'sqluser';
$password = 'password';
$dbname = 'database';
$host = 'localhost';
$db = new PDO("mysql:host=$host;dbname=$dbname", $user, $password);
$template = "update tl_files set meta='%s' where name='%s';";
$lines = file('meta.txt');
array_shift($lines); // first line contains the column titles
foreach ($lines as $line) {
$fields = preg_split('/\t+/', $line);
for ($i=0; $i < 3; $i++) {
$fields[$i] = trim($fields[$i]);
$fields[$i] = preg_replace("/\'/", "", $fields[$i]);
if ($fields[$i] == '""') { $fields[$i] = ''; }
}
$meta = array();
$meta['de'] = array();
$meta['de']['title'] = $meta['de']['alt'] = $fields[1];
$meta['de']['caption'] = $fields[2];
$meta['de']['link'] = '';
// print_r($meta);
$sql = sprintf($template, serialize($meta), $fields[0]);
$db ->exec($sql);
echo $sql."\n";
}
Tschüss
Marcus (aka Tiggr)
Lesezeichen