⌈⌋ branch:  freshcode


Artifact Content

Artifact 544610e4d2d542f6827a9303140043c6830b0793:

  • File doc/fix_submitter.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: 618)

<?php
#
# apply new ->unpack() normalization to submitter/_image from existing project entries
#

include "config.php";

$r = db("SELECT * FROM release");

foreach ($r->into("release") as $project) {

    $project->unpack($project);
    $project = $project->getArrayCopy();
    $newdata = array_intersect_key($project, array_flip(str_getcsv("submitter,submitter_image")));
    $curkeys = array_intersect_key($project, array_flip(str_getcsv("name,version,t_published,t_changed")));
    
    print_r($project);
    db([
       "UPDATE release SET :, " => $newdata,
                    "WHERE :& " => $curkeys,
    ]);
}