anubhav94 / team-piazza

Automatically exported from code.google.com/p/team-piazza
GNU General Public License v3.0
0 stars 0 forks source link

Happy and sad portraits #7

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Different portraits when the build is clean (happy) and broken (sad).

Original issue reported on code.google.com by nat.pr...@gmail.com on 9 Jul 2007 at 4:14

GoogleCodeExporter commented 9 years ago

Original comment by nat.pr...@gmail.com on 9 Jul 2007 at 4:14

GoogleCodeExporter commented 9 years ago
This is already quite easily possible if the picture links point to a small 
script
that parses TC's externalStatus. Here's a snippet from the php code we use:

if (!isset($_COOKIE["avatar-build-success"]) || isset($_GET["force"])) {
        $fh = fopen("http://teamcity:8111/externalStatus.html?buildTypeId=bt72", 'r');
        $contents = stream_get_contents($fh);
        $success = preg_match("/success.gif/", $contents);
        setcookie("avatar-build-success", $success, time() + 30);
} else {
        $success=$_COOKIE["avatar-build-success"];
}

Depending on success the server returns a different image. 

Original comment by andreas.kohn@gmail.com on 27 Sep 2008 at 9:14