Author: coar
Date: Tue Mar 9 15:57:21 2010
New Revision: 920944
URL: http://svn.apache.org/viewvc?rev=920944&view=rev
Log:
Whoops, distinguish between the image name and the place it goes
Modified:
labs/pulse/web-reports/mlists.php
Modified: labs/pulse/web-reports/mlists.php
URL:
http://svn.apache.org/viewvc/labs/pulse/web-reports/mlists.php?rev=920944&r1=920943&r2=920944&view=diff
==============================================================================
--- labs/pulse/web-reports/mlists.php (original)
+++ labs/pulse/web-reports/mlists.php Tue Mar 9 15:57:21 2010
@@ -2,7 +2,7 @@
Header('text/html; charset=UTF-8');
-Include_Once('Console/Getopt.php')
+Include_Once('Console/Getopt.php');
Include_Once('liststats-classes.php');
$stderr = fopen('php://stderr', 'a');
@@ -173,6 +173,7 @@ function chartit($o_db, $list, $width, $
* Default is all (-1).
* -D yy-mm As-of date. Default is most recent in database.
* -g do graphs (default).
+ * -h Display octothorpes for lists processed.
* -G *don't* do graphs
* -n do-nothing
* -o directory Output directory for files. Default is '.'.
@@ -185,10 +186,11 @@ $dryRun = false;
$graphs = true;
$nDays = -1;
$asof = null;
+$hash = false;
$cg = new Console_Getopt();
$a_argv = $cg->readPHPArgv();
-$cgstat = $cg->getopt($a_argv, '1D:d:gGO:o:');
+$cgstat = $cg->getopt($a_argv, '1D:d:gGhHO:no:');
if (PEAR::isError($cgstat)) {
die('Error in command line: ' . $cgstat->getMessage() . "\n");
}
@@ -217,6 +219,18 @@ foreach ($cgstat[0] as $a_opt) {
*/
$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.
@@ -316,7 +330,7 @@ $a_subs = array();
foreach ($a_mlists as $o_mlist) {
$cdomain = $o_mlist->get('domain');
if ($cdomain != $domain) {
- if ($domain) {
+ if ($domain & $hash) {
fputs($stderr, "\n");
}
$domain = $cdomain;
@@ -335,10 +349,17 @@ foreach ($a_mlists as $o_mlist) {
. " </p>\n";
}
$mlist = $o_mlist->get('list');
- fputs($stderr, '#');
+ if ($hash) {
+ fputs($stderr, '#');
+ }
$image = chartit($o_db, $mlist, 468, 200);
- $fname = preg_replace('/[...@]/', '_', $mlist) . '.png';
- ImagePNG($image, $fname);
+ $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();
@@ -370,7 +391,7 @@ foreach ($a_mlists as $o_mlist) {
print " <hr class=\"list\"/>\n"
. ' <h3 id="' . fragmentalise($mlist) . '">Mailing list '
. '<tt>' . safelise($mlist) . "</tt></h3>\n";
- print " <img src=\"$fname\"\n"
+ print " <img src=\"$iname\"\n"
. " width=\"468\" height=\"200\" style=\"float: right;\"\n"
. " alt=\"[Activity graph]\" />\n"
. " <p>\n"
@@ -412,7 +433,10 @@ foreach ($a_mlists as $o_mlist) {
}
print " <br clear=\"all\"/>\n";
}
-fputs($stderr, "\n");
+if ($hash) {
+ fputs($stderr, "\n");
+}
+
?>
<hr class="list"/>
<h2 id="statistics">Statistical Summaries</h2>
@@ -493,11 +517,14 @@ foreach ($a_subs as $mlist => $subs) {
</body>
</html>
<?php
-$oFilename = realpath($tDirectory . DIRECTORY_SEPARATOR . $tDoc);
-$oFile = fopen($oFilename, 'w');
$output = ob_get_contents();
-fputs($oFile, $output);
-fclose($oFile);
+ob_end_clean();
+if (! $dryRun) {
+ $oFilename = $tDirectory . DIRECTORY_SEPARATOR . $tDoc;
+ $oFile = fopen($oFilename, 'w');
+ fputs($oFile, $output);
+ fclose($oFile);
+}
/*
* Local Variables:
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]