- Add videodb PHP/MySQL media collection manager (Blu-ray, DVD, CD) - Dockerfile: PHP 8.1 + Apache with GD/mysqli/exif extensions - docker-compose.yml: app on port 6761 + MySQL 8.0 with health checks - docker-entrypoint.sh: auto-generates config.inc.php from env vars, waits for MySQL, initializes DB schema idempotently - init-db.php: CLI schema installer using app's own prefix_query() logic - Persistent volumes for DB, cache, and cover images Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
48 lines
1.0 KiB
PHP
48 lines
1.0 KiB
PHP
<?php
|
|
/**
|
|
* Database conversion script for DB v26
|
|
*
|
|
* Rating custom field conversion
|
|
*
|
|
* @package Setup
|
|
* @author Andreas Goetz <cpuidle@gmx.net>
|
|
* @version $Id: upgrade_v26.php,v 1.2 2007/12/30 11:09:24 andig2 Exp $
|
|
*/
|
|
|
|
/**
|
|
* Rating data migration
|
|
*/
|
|
function migrate_rating($field)
|
|
{
|
|
global $dbh;
|
|
|
|
$set = runSQL('UPDATE videodata SET rating='.$field.' WHERE '.$field.'>0', $dbh, true);
|
|
return $set;
|
|
}
|
|
|
|
$sql = "SELECT * FROM config WHERE opt LIKE 'custom%type'";
|
|
$set = runSQL($sql, $dbh, true);
|
|
if ($set === false) return(false);
|
|
|
|
foreach ($set as $row)
|
|
{
|
|
if ($row['value'] == 'rating')
|
|
{
|
|
if (preg_match('/(custom\d)/', $row['opt'], $m))
|
|
{
|
|
$field = $m[1];
|
|
$set = migrate_rating($field);
|
|
if ($set === false) return(false);
|
|
|
|
$sql = "UPDATE config SET value='' WHERE opt LIKE '".$field."%'";
|
|
$set = runSQL($sql, $dbh, true);
|
|
if ($set === false) return(false);
|
|
}
|
|
}
|
|
}
|
|
|
|
// signal success
|
|
return true;
|
|
|
|
?>
|