Roxen.git / server / config_interface / actions / fsgarb.pike

version» Context lines:

Roxen.git/server/config_interface/actions/fsgarb.pike:184:    return sprintf("<svg width='%d' height='%d'"    " viewPort='0 0 %d %d' version='1.1'"    " xmlns='http://www.w3.org/2000/svg'>",    max_width, max_height,    max_width, max_height) + res + "</svg>";   }      string parse(RequestID id)   {   #if constant(roxen.register_fsgarb) +  // Sort according to config, module and path +  array(string) garb_sort_keys = ({ });    array(object/*(roxen.FSGarb)*/) garbs = values(roxen->fsgarbs); -  +  foreach (garbs, object/*(roxen.FSGarb)*/ g) { +  RoxenModule mod = Roxen.get_module(g->modid); +  Configuration conf = mod && mod->my_configuration(); +  garb_sort_keys += ({ (conf ? conf->name : "") + "|" + +  (mod ? Roxen.get_modfullname(mod) : g->modid) + "|" + +  g->root }); +  } +  sort(garb_sort_keys, garbs);       int size_unit = 1024;    string res = ""; -  sort(garbs->root, garbs); -  sort(garbs->modid, garbs); +  + #ifdef DISABLE_FSGARB +  res = "<p><font color='&usr.warncolor;'><img src='&usr.err-2;' />&nbsp;<b>" + +  LOCALE(0, "The filesystem garbage collector is disabled.") + +  "</b></font></p>\n\n"; + #endif +     string modid;    foreach(garbs, object/*(roxen.FSGarb)*/ g) {       // werror("FSGARG DEBUG object g: %O\n", g);    -  if (sizeof(res)) res += "<tr><td>&nbsp;</td></tr>"; -  +     if (g->modid != modid) {    if (modid) {    res +=    " </table>\n"    " </td>\n"    "</tr>\n";    }    modid = g->modid;    RoxenModule mod = Roxen.get_module(modid);    string name = Roxen.html_encode_string(modid);
Roxen.git/server/config_interface/actions/fsgarb.pike:236: Inside #if constant(roxen.register_fsgarb)
   Roxen.html_encode_string(murl),    replace(Roxen.get_modfullname(mod),    " ", "&nbsp;"));    }    res +=    "<tr><td><h3>" +    sprintf(LOCALE(1105, "Registered by %s"), name) +    "</h3></td></tr>\n"    "<tr>\n"    " <td>\n" -  " <table width='100&#37;'>\n"; +  " <table class='entry'>\n";    }       array(Stdio.Stat) stats = g->get_stats();    int local_max_size = 0;    int local_min_mtime = 0x7fffffff;    string age = format_time(g->max_age);       foreach(stats, Stdio.Stat st) {    if (st->size > local_max_size) local_max_size = st->size;    if (st->mtime < local_min_mtime) local_min_mtime = st->mtime;    }    string sizes = exp_histogram(LOCALE(377, "Size"),    20, stats->size, local_max_size);    // divide time in minutes.    string ages = lin_histogram(LOCALE(1070, "Age"),    20, map(stats->mtime, `-, local_min_mtime),    g->max_age || time(1) - local_min_mtime);       res += -  sprintf(" <tr><th align='left' valign='top' colspan='4'>%s</th></tr>\n" +  sprintf(" <tr>" +  " <th>&nbsp;</th>\n" +  " <th class='path' colspan='3'><tt>%s</tt></th>" +  " </tr>\n"    " <tr>\n" -  " <td>&nbsp;</td>\n" -  " <th align='left' valign='top'>%s</th>\n" -  " <th align='left' valign='top'>%s</th>\n" -  " <th align='left' valign='top'>%s</th>\n" +  " <th style='width: 0%%'>&nbsp;</th>\n" +  " <th>%s</th>\n" +  " <th>%s</th>\n" +  " <th>%s</th>\n"    " </tr>\n" -  " <tr id='tbl'>\n" +  " <tr class='sub-table'>\n"    " <td>&nbsp;</td>\n" -  " <td valign='top'>\n" +  " <td class='status'>\n"    " " + -  LOCALE(1071, "%d files (max: %d)") + "<br/>\n" +  LOCALE(1071, "%d files <span class='dim'>(max: %d)</span>") + +  "<br/>\n"    " " + -  LOCALE(1106, "%d KiB (max: %d)") + "<br/>\n" +  LOCALE(1106, "%d KiB <span class='dim'>(max: %d)</span>") + +  "<br/>\n"    " Age limit: %s\n"    " </td>\n" -  " <td valign='top'>\n%s</td>\n" -  " <td valign='top'>\n%s</td>\n" +  " <td>\n%s</td>\n" +  " <td>\n%s</td>\n"    " </tr>\n",    Roxen.html_encode_string(g->root), // Mount point    LOCALE(228, "Status"),    LOCALE(1107, "File age distribution"),    LOCALE(1108, "File size distribution"),    g->num_files, g->max_files, // files    (g->total_size/size_unit), (g->max_size/size_unit), // size (KiB)    age, // age (seconds or minutes)    ages, // age distribution histogram    sizes); // size distribution histogram
Roxen.git/server/config_interface/actions/fsgarb.pike:299: Inside #if constant(roxen.register_fsgarb)
   "</tr>\n";    }       if (!sizeof(res)) {    res = "<tr><th>" +    LOCALE(1069, "No filesystem garbage collectors active.") +    "</th></tr>\n";    }       return -  "<table width='100%'>\n" + res + "</table>\n" +  "<style type='text/css'>\n" +  "#fsgc-table h3 { font-size: 14px; margin: 0; }\n" +  "#fsgc-table .entry { font-size: 12px; margin-bottom: 12px; }\n" +  "#fsgc-table .entry tt { font-size: 14px; }\n" +  "#fsgc-table .entry .dim { color: #888; }\n" +  "#fsgc-table th { text-align: left; vertical-align: top; }\n" +  "#fsgc-table th.path { color: #68a; padding: 8px 0; }\n" +  "#fsgc-table .sub-table td { vertical-align: top; padding-right: 20px; }\n" +  "#fsgc-table .sub-table td.status { width: 250px; }\n" +  "</style>\n" +  "<table id='fsgc-table' width='100%'>\n" + res + "</table>\n"    "<input type='hidden' name='action' value='fsgarb.pike' />"    "<br />\n"    "<cf-ok-button href='./'/> <cf-refresh/>\n";      #else    return LOCALE(1072, "Not available in this installation of Roxen.");   #endif   }