select(array('list' => $list, 'posts' => array(0, '>=')), 'asof ASC'); $a_points = $o_points->mlists(); if (! $a_points) { $a_points = array(); } $points = count($a_points); if ($points) { $x_int = ($width - $margin) / $points; } else { $x_int = 0; } $highest = 0; foreach ($a_points as $o_point) { $highest = max($highest, $o_point->get('posts')); } if ($highest) { $y_int = ($height * 0.90) / $highest; } else { $y_int = 0; } $height_posts = $height - ($highest * $y_int); $max_posts = $highest; $last_x = $left; if ($points) { $last_y = $height - ($a_points[0]->get('posts') * $y_int); } else { $last_y = 0; } for ($i = 0; $i < $points; $i++) { $o_point = $a_points[$i]; $this_y = $o_point->get('posts') * $y_int; $this_y = $height - $this_y; ImageLine($image, $last_x, $last_y, min($last_x + $x_int, $right - 1), $this_y, $colour_posts); $last_x += $x_int; $last_y = $this_y; } /* * Now do the subscribers */ $highest = 0; foreach ($a_points as $o_point) { $highest = max($highest, $o_point->get('count')); } if ($highest) { $y_int = ($height * 0.90) / $highest; } else { $y_int = 0; } $height_subscribers = $height - ($highest * $y_int); $max_subscribers = $highest; $last_x = $left; if ($points) { $last_y = $height - ($a_points[0]->get('count') * $y_int); } else { $last_y = 0; } for ($i = 0; $i < $points; $i++) { $o_point = $a_points[$i]; $this_y = $height - ($o_point->get('count') * $y_int); ImageLine($image, $last_x, $last_y, min($last_x + $x_int, $right - 1), $this_y, $colour_subscribers); $last_x += $x_int; $last_y = $this_y; } $height_subscribers = $height - ($highest * $y_int); /* * Draw the max-subscriber line across the graph */ ImageLine($image, $left, $height_subscribers, $right - 1, $height_subscribers, $grey); ImageLine($image, 0, $height_subscribers, $left, $height_subscribers, $colour_subscribers); $string = (string)$max_subscribers; $px = $left - 2 - (strlen($string) * ImageFontWidth(0)); ImageString($image, 0, $px, $height_subscribers + 3, $string, $colour_subscribers); ImageLine($image, $left, $height_posts, $right - 1, $height_posts, $grey); ImageLine($image, $right, $height_posts, $right + $margin, $height_posts, $colour_posts); $string = (string)$max_posts; ImageString($image, 0, $right + 2, $height_posts + 3, $string, $colour_posts); return $image; } ?> The Apache Software Foundation Mailing Lists

The Apache Software Foundation Mailing Lists

readPHPArgv(); $cgstat = $cg->getopt($a_argv, '1D:d:gGhHO:no:sS'); if (PEAR::isError($cgstat)) { die('Error in command line: ' . $cgstat->getMessage() . "\n"); } foreach ($cgstat[0] as $a_opt) { if ($a_opt[0] == '1') { /* * How many days to inclue in the report. */ $nDays = 1; } else if (($a_opt[0] == 'd') && ($nDays != 1)) { $nDays = $a_opt[1]; } else if ($a_opt[0] == 'D') { $asof = $a_opt[1]; } else if ($a_opt[0] == 'g') { /* * Produce and include the graphs. */ $graphs = true; } else if ($a_opt[0] == 'G') { /* * Omit the charts. */ $graphs = false; } else if ($a_opt[0] == 'h') { /* * Include an octothorpe on stderr for each list processed. */ $hash = true; } else if ($a_opt[0] == 'H') { /* * Omit the octothorpes. */ $hash = false; } else if ($a_opt[0] == 'n') { /* * Don't actually produce any output. */ $dryRun = true; } else if ($a_opt[0] == 'o') { /* * Where to put the files? */ $tDirectory = $a_opt[1]; } else if ($a_opt[0] == 's') { /* * Separate the information into different pages by domain. */ $onepage = false; } else if ($a_opt[0] == 'S') { /* * Put everything on a single Web page. */ $onepage = true; } else { /* * Beats me; what option *is* this? */ die('Unrecognised option: ' . array_shift($a_opt) . "\n" . print_r($a_opt, true)); } } if ($nDays == 1) { $graphs = false; } $o_db = new lsDB($_SERVER['PULSE_DB_HOST'], $_SERVER['PULSE_DB_USER'], $_SERVER['PULSE_DB_PASSWORD']); if (! isset($asof)) { $asof = $o_db->latest(); } $o_smt = new Smarty(); $o_smt->template_dir = '/usr/local/labs/pulse/smarty/templates'; $o_smt->compile_dir = '/usr/local/labs/pulse/smarty/templates_c'; $o_smt->config_dir = '/usr/local/labs/pulse/smarty/configs'; $o_sel_current = $o_db->select(array('asof' => $asof, 'status' => 'public')); $a_mlists = $o_sel_current->mlists(); $a_domains = $o_sel_current->domains(); $total_domains = count($a_domains); $total_lists = count($a_mlists); print "

\n" . " This information is collected and analysed on a daily basis.\n" . ' This report was generated at ' . strftime('%c', time()) . " and\n" . " covers a total of $total_lists mailing list" . ($total_lists == 1 ? ' ' : 's ') . "across $total_domains domain" . ($total_domains == 1 ? '' : 's') . ".\n" . "

\n" . "

\n" . " The graph alongside each list shows the gross activity over the\n" . " last 90 days. The blue line\n" . " represents the number of subscribers to the list, and the red\n" . " line charts the number of posts per day. They are not\n" . " to the same scale. This graph is indicative only, showing\n" . " trends, not exact counts.\n" . "

\n" . " \n" . "
  • Statistical summaries
  • \n" . "
    \n"; if ($total_domains != 0) { $per_cell = ceil($total_domains / 3); print "

    \n" . " Jump to the lists for a domain:\n" . "

    \n" . " \n" . " \n"; for ($i = 1; $i <= $total_domains; $i++) { if ((($i - 1) % $per_cell) == 0) { if ($i > 1) { print " \n" . " \n"; } print " \n" . " \n" . "
    \n"; } print '
  • ' . $a_domains[$i - 1] . "
  • \n"; } print "
    \n" . "
    \n"; } $domain = null; $a_posts = array(); $a_meanposts = array(); $a_subs = array(); foreach ($a_mlists as $o_mlist) { $cdomain = $o_mlist->get('domain'); if ($cdomain != $domain) { if ($domain & $hash) { fputs($stderr, "\n"); } $domain = $cdomain; print "
    \n" . '

    Domain ' . "$domain

    \n"; $o_sel_indomain = $o_db->select(array('asof' => $asof, 'status' => 'public', 'domain' => $domain)); $a_scratch = $o_sel_indomain->xids(); $n = count($a_scratch); print "

    \n" . " A total of $n list" . ($n == 1 ? '' : 's') . ".\n" . "

    \n"; } $mlist = $o_mlist->get('list'); if ($hash) { fputs($stderr, '#'); } $image = chartit($o_db, $mlist, 468, 200); $iname = preg_replace('/[.@]/', '_', $mlist) . '.png'; $fname = $tDirectory . DIRECTORY_SEPARATOR . $iname; if (! $dryRun) { ImagePNG($image, $fname); } $o_sel_mlist = $o_db->select(array('list' => $o_mlist->get('list'))); $subs = $o_mlist->subscriber_count(); $digesters = $o_mlist->digester_count(); $a_subs[$mlist] = $subs + (isset($digesters) ? $digesters : 0); $posts = $o_sel_mlist->total_posts(); $meanposts = sprintf('%.2f', $o_sel_mlist->mean_posts()); $a_meanposts[$mlist] = $meanposts; $days = $o_sel_mlist->post_days(); $days .= ' day' . ($days == 1 ? '' : 's'); $info = $o_mlist->info(true); if ($info) { $list = $o_mlist->get('list'); $domani = $o_mlist->get('domain'); $list = str_replace("@$domain", '', $list); $info = str_replace('<#l#>', $list, $info); $info = str_replace('<#l#>', $list, $info); $info = str_replace('<#h#>', $domain, $info); $info = str_replace('<#h#>', $domain, $info); /* * Try to turn all URLs into links. */ $re_uri = ('\b[-_A-Za-z0-9]+://[-.A-Za-z0-9]+(?::[0-9]+)?' . '(?:/[^\s()^]*)?'); $info = preg_replace('§' . "($re_uri)" . '§', '$1', $info); } $a_posts[$mlist] = $o_mlist->get('posts'); print "
    \n" . '

    Mailing list ' . '' . safelise($mlist) . "

    \n"; print " \"[Activity\n" . "

    \n" . " Traffic statistics cover a total of $days.\n" . "

    \n" . " \n" . " \n" . " \n" . ' \n" . " \n" . " \n" . " \n" . ' \n" . " \n" . " \n" . " \n" . " \n" . " \n" . " \n" . " \n" . " \n" . " \n" . "
    Current subscribers:' . $o_mlist->subscriber_count() . "
    Current digest subscribers:' . (isset($digesters) ? $o_mlist->digester_count() : 'No digest available') . "
    Total posts ($days):$posts
    Mean posts per day:$meanposts
    \n"; if (isset($info)) { print "
    \n" . '
    Description provided by the list ' . "moderators:
    \n" . "
    \n" . " \n" . " \n" . " \n" . " \n" . "
    $info
    \n" . "
    \n"; } print "
    \n"; } if ($hash) { fputs($stderr, "\n"); } ?>

    Statistical Summaries

    1. Top-10 busiest lists in the last collection period: $posts) { $mlist = '' . safelise($mlist) . "\n" . " \n" . " \n" . " \n"; if ($n++ > 10) { break; } } ?>
      List Total posts
      $mlist$posts
    2. Top-10 historically busiest lists: $posts) { $mlist = '' . safelise($mlist) . "\n" . " \n" . " \n" . " \n"; if ($n++ > 10) { break; } } ?>
      List Posts/day
      $mlist$posts
    3. Top-10 most popular lists (most subscribers) as of the last collection period: $subs) { $mlist = '' . safelise($mlist) . "\n" . " \n" . " \n" . " \n"; if ($n++ > 10) { break; } } ?>
      List Subscribers
      $mlist$subs

    Data collected, analysed, and presented using Perl, MySQL, PHP, and XML.