<?php
#
# autoupdate/release{} partial insertion stripped out a lot of user images recently
# → this db traversion reinserts the latest known image url/hash, if user name matches
#

include("config.php");

$proj = db("
SELECT
  name, max(t_changed) AS t_changed, submitter, submitter_image
FROM
  release
WHERE
  submitter_image != ?
GROUP BY
  name
", '');

foreach ($proj as $e) {
print_r($e);
    db("UPDATE release
           SET submitter_image = ?
         WHERE name = ?
           AND submitter = ?
           AND t_changed > ?",
        $e["submitter_image"], $e["name"], $e["submitter"], $e["t_changed"]
    );
}
