Ticket #202: ticket-202 v1.diff

File ticket-202 v1.diff, 3.5 KB (added by Christian Beer, 17 years ago)
  • html/ops/index.php

     
    4444    candidates for User of the Day.</span></li>\n";
    4545}
    4646
     47$local_rev_file = '../../local.revision';
     48$remote_rev_file = '../cache/repository.revision';
     49$remote_URL = 'http://boinc.berkeley.edu/svn/trunk';
     50$update_interval = 60*60*24*7; // check $remote_URL every 7 days
     51
     52if (file_exists($local_rev_file)) {
     53    $local_rev = file_get_contents($local_rev_file);
     54    $remote_rev = 0;
     55
     56    if (!file_exists($remote_rev_file) || (filemtime($remote_rev_file)+$update_interval < time())) {
     57        // get the html output of $remote_url
     58        if ($f = fopen($remote_URL, "r")) {
     59            while (!feof($f)) {
     60                $html_buffer = fgets($f, 512);
     61                // Search for the line: Revision 12530 ....
     62                $pos = strpos($html_buffer, "Revision ");
     63                if ($pos != false) {
     64                    $remote_rev = substr($html_buffer, $pos + 9, 5);
     65                    break;
     66                }
     67            }
     68            fclose($f);
     69        }
     70        file_put_contents($remote_rev_file, $remote_rev);
     71    }
     72
     73    $remote_text = '';
     74    if (file_exists($remote_rev_file)) {
     75        $remote_rev = file_get_contents($remote_rev_file);
     76        $remote_text = " Newest repository revision: ".$remote_rev;
     77    }
     78    echo "<li>Currently used svn revison: ".$local_rev.$remote_text."</li>\n";
     79}
     80
    4781echo "</ul>\n";
    4882
    4983echo "
    5084    <p>
    5185    <table border='0'><tr valign='top'>
    5286    <td><b>Browse database:</b>
    53     <ul> 
     87    <ul>
    5488        <li><a href=\"db_action.php?table=platform\">Platforms</a></li>
    5589        <li><a href=\"db_action.php?table=app\">Applications</a></li>
    5690        <li><a href=\"db_form.php?table=app_version\">Application versions</a></li>
     
    6195        <li><a href=\"db_form.php?table=result&detail=low\">Results</a></li>
    6296    </ul>
    6397
    64     </td> 
     98    </td>
    6599    <td><b>Regular Operations:</b>
    66100    <ul>
    67101        <li><a href=\"profile_screen_form.php\">Screen user profiles </a></li>
     
    69103        <li><a href='manage_special_users.php'>Manage special users</a></li>
    70104    </ul>
    71105
    72     </td> 
     106    </td>
    73107    <td><b>Special Operations:</b>
    74108    <ul>
    75109        <li><a href='manage_apps.php'>Manage applications</a></li>
     
    85119    </li>
    86120        <li>
    87121            <form method=\"get\" action=\"clear_host.php\">
    88             Clear Host: 
     122            Clear Host:
    89123            <input type=\"text\" size=\"5\" name=\"hostid\">
    90124            <input type=\"submit\" value=\"Clear RPC\">
    91125            </form>
     
    102136$show_only = array('all'); // Add all appid's you want to display, or 'all'
    103137$result = mysql_query("select id, name, deprecated from app");
    104138while ($app = mysql_fetch_object($result)) {
    105     if ( in_array($app->id, $show_only) 
     139    if ( in_array($app->id, $show_only)
    106140       || ( in_array("all", $show_only)
    107141          && (!$app->deprecated || $show_deprecated)
    108142          )
     
    113147        <ul>
    114148    <li> Past 24 hours:
    115149         <a href='result_summary.php?appid=$app->id&nsecs=86400'>summary</a> |
    116          <a href='pass_percentage_by_platform.php?appid=$app->id&nsecs=86400'>pass percentage by platform</a> | 
     150         <a href='pass_percentage_by_platform.php?appid=$app->id&nsecs=86400'>pass percentage by platform</a> |
    117151         <a href='failure_result_summary_by_host.php?appid=$app->id&nsecs=86400'>failure by host</a> |
    118152         <a href='failure_result_summary_by_platform.php?appid=$app->id&nsecs=86400'> failure by platform</a>
    119153    <li>Past &nbsp;&nbsp;&nbsp;7 days: