⌈⌋ branch:  freshcode


Artifact Content

Artifact 52b0b8197095611902a0794f8f4876bf398e527b:

  • File doc/fix_submitterimage.php — part of check-in [aaf424b6b3] at 2014-12-23 05:10:25 on branch trunk — One-time SQL fixing scripts for submitter_image. (user: mario size: 625)

<?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"]
    );
}