⌈⌋ ⎇ branch:  freshcode


Check-in [aaf424b6b3]

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

Overview
Comment:One-time SQL fixing scripts for submitter_image.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: aaf424b6b3113ebe0136538312b4c379a2d5a108
User & Date: mario 2014-12-23 05:10:25
Context
2014-12-23
05:11
Make actual timeout for session also 7 days. check-in: 4ee9fb60b6 user: mario tags: trunk
05:10
One-time SQL fixing scripts for submitter_image. check-in: aaf424b6b3 user: mario tags: trunk
05:07
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. check-in: 8f9b3a45b1 user: mario tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

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