⌈⌋ branch:  freshcode


Check-in [aaf424b6b3]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
SHA1:aaf424b6b3113ebe0136538312b4c379a2d5a108
Date: 2014-12-23 05:10:25
User: mario
Comment:One-time SQL fixing scripts for submitter_image.
Tags And Properties
  • branch=trunk inherited from [82405bb421]
  • sym-trunk inherited from [82405bb421]
Context
2014-12-23
05:11
[4ee9fb60b6] Make actual timeout for session also 7 days. (user: mario, tags: trunk)
05:10
[aaf424b6b3] One-time SQL fixing scripts for submitter_image. (user: mario, tags: trunk)
05:07
[8f9b3a45b1] Fix again (like the fifth time) the user image updating logic. Partial $newdata submissions had $this[submitter] still empty, therefore stripped previous user icon url/hash. (user: mario, tags: trunk)
Changes

Added doc/fix_submitter.php.













































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?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,
    ]);
}

Added doc/fix_submitterimage.php.



























































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?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"]
    );
}