Exemplo n.º 1
0
       <table style="margin-top:0.2em">
        <tr>  <th>Name</th>    <th>Size (total: <?php 
print $this_dir_size_human;
?>
) </th>    </tr>
<?php 
foreach ($subdir_name_to_size_kb as $subdir => $subdir_size_kb) {
    // Note regarding $href: the actual index is located in build_index, the
    // external url just says 'build' and we redirect it in the apache config.
    $subdir_size_human = $subdir == '..' ? '-' : human_readable_size(1024 * $subdir_size_kb);
    $href = "{$build_url}/{$subdir}/";
    print "<tr> <td><a href='{$href}'> {$subdir}/ </td> <td> {$subdir_size_human} </td> </tr>\n";
}
foreach ($file_name_to_size_bytes as $file => $file_size_bytes) {
    $file_size_human = human_readable_size($file_size_bytes);
    $href = "/downloads/build/{$build}{$slash_directory}/{$file}";
    print "<tr> <td><a href='{$href}'> {$file} </td> <td> {$file_size_human} </td> </tr>\n";
}
foreach ($link_name_to_dest as $link_name => $link_dest) {
    if (strlen($link_dest) > $max_link_dest_length) {
        // We can consider using javascript to make the whole thing showable, or
        // maybe putting a href in here, if users ask for this feature.
        $link_dest = substr($link_dest, 0, $max_link_dest_length - 2) . '..';
    }
    print "<tr> <td> {$link_name} &rarr; {$link_dest} </td> <td> - </td> </tr>\n";
}
print "</table>\n";
if ($slash_directory != '') {
    print "           <p/>\n";
    print "           <a href='{$build_url}/../'> [parent directory] </a> <br/>\n";
Exemplo n.º 2
0
$text = "<h2>Recent Items</h2>\n<ul>";
$items = 0;
foreach ($timeline as $timestamp => $link_array) {
    $cnt = count($link_array);
    for ($i = $cnt - 1; $i >= 0; $i--) {
        if ($items++ > 20) {
            break;
        }
        $link_info = $link_array[$i];
        $text .= "<li><span class=\"strong\">" . date_to_string($timestamp) . "</span> - ({$link_info['type']}) <a href=\"{$link_info['url']}\">{$link_info['title']}</a></li>\n";
    }
}
write_timeline();
// copy static in
if ($dh = opendir($static_dir)) {
    while (($file = readdir($dh)) !== false) {
        if (strlen($file) > 2) {
            copy($static_dir . $file, $root_dir . $file);
            chmod($root_dir . $file, 0777);
            // :|
        }
    }
    closedir($dh);
}
include "page_compress.php";
// generate index.html with the size of the zip, then add index.html to the zip
$text .= "</ul>\n";
$text .= "<p><span class=\"italic\">Compiled on {$conf->compiled_on}.</span></p>\n";
write_template("index.html", "", "", array("@extra" => $text, "@johnc_archive_size" => human_readable_size(filesize("../files/johnc_archive.zip"))));
chdir("..");
exec("zip -9 files/johnc_archive.zip index.html");
Exemplo n.º 3
0
										<td><?php 
echo $lang['stix0029'];
?>
</td>
										<td><?php 
echo human_readable_size($sql_res[0]['server_bytes_down']);
?>
</td>
									</tr>
									<tr>
										<td><?php 
echo $lang['stix0030'];
?>
</td>
										<td><?php 
echo human_readable_size($sql_res[0]['server_bytes_up']);
?>
</td>
									</tr>
									<tr>
										<td><?php 
echo $lang['stix0031'];
?>
</td>
										<td><?php 
echo $sql_res[0]['server_status'] == 0 ? '-&nbsp;&nbsp;&nbsp;(<i>' . $lang['stix0032'] . '&nbsp;' . (new DateTime("@0"))->diff(new DateTime("@" . $sql_res[0]['server_uptime']))->format($timeformat) . ')</i>' : $lang['stix0033'];
?>
</td>
									</tr>
									<tr>
										<td><?php 
Exemplo n.º 4
0
 $index_dir = "{$root}/build_index/{$b}/{$branch}{$slash_relative_path}";
 $all_metadata["{$b}.index_dir"] = $index_dir;
 // also work out the URL for each of the versions of this directory.  Note, this
 // is located in /downloads/build, not /downloads/build_index; we map it in the
 // apache config.
 $index_url = "/downloads/build/{$b}/{$branch}{$slash_relative_path}";
 $all_metadata["{$b}.index_url"] = $index_url;
 // Look in the index dir for the file size_kb that tells us the size of
 // this version (inside this directory).
 $file_contents = file("{$index_dir}/size_kb");
 if ($file_contents === false || count($file_contents) != 1 || !preg_match('/^\\d+$/', $file_contents[0])) {
     syslog(LOG_ERR, "make_branch_index.php: error getting size of data from {$index_dir}/size_kb");
     exit(1);
 }
 $all_metadata["{$b}.size_kb"] = $file_contents[0];
 $size_human_readable = human_readable_size(1024 * $file_contents[0]);
 $all_metadata["{$b}.size_human_readable"] = $size_human_readable;
 if ($b == $max_b) {
     // As we process the most recent build number available, we'll put some data about
     // this build in the file <output-dir>/build_metadata
     $destdir = "{$root}/tree.temp/{$branch}{$slash_relative_path}";
     if (($file = fopen("{$destdir}/build_metadata", "w")) === false) {
         syslog(LOG_ERR, "make_branch_index.php: error opening file {$destdir}/build_metadata");
         exit(1);
     }
     $num_builds = count($input_dirs);
     $uploader_name = $all_metadata["{$b}.name"];
     fwrite($file, "num_builds={$num_builds}\n");
     fwrite($file, "most_recent_build={$b}\n");
     fwrite($file, "uploader_name={$uploader_name}\n");
     fwrite($file, "size_human_readable={$size_human_readable}\n");