cvs: docweb /scripts gen_picture_info.php gen_picture_info_all_lang.php generation.sh rev.php

From: Date: Mon, 01 Nov 2004 01:20:28 +0000
Subject: cvs: docweb /scripts gen_picture_info.php gen_picture_info_all_lang.php generation.sh rev.php
Groups: php.doc.web 
Request: Send a blank email to doc-web+get-408@lists.php.net to get a copy of this message
didou Sun Oct 31 20:20:28 2004 EDT Modified files: /docweb/scripts gen_picture_info.php gen_picture_info_all_lang.php generation.sh rev.php Log: enable revcheck for smarty and peardoc, clean the image generators and the .sh script

http://cvs.php.net/diff.php/docweb/scripts/gen_picture_info.php?r1=1.6&r2=1.7&ty=u Index: docweb/scripts/gen_picture_info.php diff -u docweb/scripts/gen_picture_info.php:1.6 docweb/scripts/gen_picture_info.php:1.7 --- docweb/scripts/gen_picture_info.php:1.6 Sat Oct 30 07:00:03 2004 +++ docweb/scripts/gen_picture_info.php Sun Oct 31 20:20:25 2004 @@ -1,5 +1,5 @@ <?php -/* $Id: gen_picture_info.php,v 1.6 2004/10/30 11:00:03 vincent Exp $ */ +/* $Id: gen_picture_info.php,v 1.7 2004/11/01 01:20:25 didou Exp $ */ include '../include/jpgraph/jpgraph.php'; include '../include/jpgraph/jpgraph_pie.php'; @@ -9,109 +9,84 @@ include '../include/init.inc.php'; include '../include/lib_revcheck.inc.php'; -$plop = array_shift($argv); +$self = array_shift($argv); $TYPE = array_shift($argv); // Type of documentation -/** make this work for now -// documentation exist ? -if (!documentation_exists($TYPE)) { - - echo "The $TYPE documentation don't exist.\n"; - exit(0); - +foreach( $argv as $lang ) { + if (!generation_image($TYPE, $lang) ) { + echo "The $TYPE documentation for $lang language don't exist.\n"; + } else { + echo " Generated images/revcheck/info_revcheck_" . $TYPE . "_" . $lang . ".png\n"; + } } -*/ -foreach( $argv as $lang ) { +function generation_image($TYPE, $lang) { + global $LANGUAGES; + $idx = sqlite_open(SQLITE_DIR . 'rev.' . $TYPE . '.sqlite'); + $Total_files = @get_nb_LANG_files($idx); + if (!isset($Total_files[$lang]) ) { + return FALSE; + } - if( !generation_image($TYPE, $lang) ) { - - echo "The $TYPE documentation for $lang language don't exist.\n"; - - } else { - - echo " Generated images/revcheck/info_revcheck_" . $TYPE . "_" . $lang . ".png\n"; - - } -} + $Total_files_lang = $Total_files[$lang]; + // + $up_to_date = @get_nb_LANG_files_Translated($idx, $lang); + $up_to_date = ( $up_to_date['total'] == '') ? 0 : $up_to_date['total']; + // + $critical = @get_stats_critical($idx, $lang); + $critical = $critical[0]; + // + $old = @get_stats_old($idx, $lang); + $old = $old[0]; + // + $missing = sizeof(@get_missfiles($idx, $lang)); + // + $no_tag = @get_stats_notag($idx, $lang); + $no_tag = $no_tag[0]; + // -function generation_image($TYPE, $lang) { - global $LANGUAGES; - - -$idx = sqlite_open(SQLITE_DIR . 'rev.' . $TYPE . '.sqlite'); - -// -$Total_files = @get_nb_LANG_files($idx); - - if( !isset($Total_files[$lang]) ) { - - return FALSE; - - } - - -$Total_files_lang = $Total_files[$lang]; -// -$up_to_date = @get_nb_LANG_files_Translated($idx, $lang); -$up_to_date = ( $up_to_date['total'] == '') ? 0 : $up_to_date['total']; -// -$critical = @get_stats_critical($idx, $lang); -$critical = $critical[0]; -// -$old = @get_stats_old($idx, $lang); -$old = $old[0]; -// -$missing = sizeof(@get_missfiles($idx, $lang)); -// -$no_tag = @get_stats_notag($idx, $lang); -$no_tag = $no_tag[0]; -// - -$data = array($up_to_date,$critical,$old,$missing,$no_tag); -$pourcent = array(); -$total = 0; -$total = array_sum($data); - -foreach ( $data as $valeur ) { - -$pourcent[] = round($valeur * 100 / $total); - -} + $data = array($up_to_date,$critical,$old,$missing,$no_tag); + $pourcent = array(); + $total = 0; + $total = array_sum($data); + + foreach ( $data as $valeur ) { -$legend = array($pourcent[0] . '%% up to date ('.$up_to_date.')', $pourcent[1] . '%% critical ('.$critical.')', $pourcent[2] . '%% old ('.$old.')', $pourcent[3] . '%% missing ('.$missing.')', $pourcent[4] . '%% without revtag ('.$no_tag.')'); -$title = ucfirst($TYPE). ' : Details for '.$LANGUAGES[$lang].' Doc'; + $pourcent[] = round($valeur * 100 / $total); -$graph = new PieGraph(530,300); -$graph->SetShadow(); + } -$graph->title->Set($title); -$graph->title->Align('left'); -$graph->title->SetFont(FF_FONT1,FS_BOLD); + $legend = array($pourcent[0] . '%% up to date ('.$up_to_date.')', $pourcent[1] . '%% critical ('.$critical.')', $pourcent[2] . '%% old ('.$old.')', $pourcent[3] . '%% missing ('.$missing.')', $pourcent[4] . '%% without revtag ('.$no_tag.')'); + $title = ucfirst($TYPE). ' : Details for '.$LANGUAGES[$lang].' Doc'; -$graph->legend->Pos(0.02,0.18,"right","center"); + $graph = new PieGraph(530,300); + $graph->SetShadow(); -$graph->subtitle->Set('( Info : '.$Total_files_lang.' files )'); -$graph->subtitle->Align('left'); -$graph->subtitle->SetColor('darkred'); + $graph->title->Set($title); + $graph->title->Align('left'); + $graph->title->SetFont(FF_FONT1,FS_BOLD); -$p1 = new PiePlot3D($data); -$p1->SetSliceColors(array("#68d888", "#ff6347", "#eee8aa", "#dcdcdc", "#f4a460")); -$p1->ExplodeAll(); -$p1->SetCenter(0.35,0.55); -$p1->value->Show(false); + $graph->legend->Pos(0.02,0.18,"right","center"); -$p1->SetLegends($legend); + $graph->subtitle->Set('(Total: '.$Total_files_lang.' files)'); + $graph->subtitle->Align('left'); + $graph->subtitle->SetColor('darkred'); -$graph->Add($p1); -$graph->Stroke('../www/images/revcheck/info_revcheck_' . $TYPE . '_' . $lang . '.png'); + $p1 = new PiePlot3D($data); + $p1->SetSliceColors(array("#68d888", "#ff6347", "#eee8aa", "#dcdcdc", "#f4a460")); + $p1->ExplodeAll(); + $p1->SetCenter(0.35,0.55); + $p1->value->Show(false); + $p1->SetLegends($legend); -return TRUE; -} + $graph->Add($p1); + $graph->Stroke('../www/images/revcheck/info_revcheck_' . $TYPE . '_' . $lang . '.png'); -?> + + return TRUE; +} http://cvs.php.net/diff.php/docweb/scripts/gen_picture_info_all_lang.php?r1=1.6&r2=1.7&ty=u Index: docweb/scripts/gen_picture_info_all_lang.php diff -u docweb/scripts/gen_picture_info_all_lang.php:1.6 docweb/scripts/gen_picture_info_all_lang.php:1.7 --- docweb/scripts/gen_picture_info_all_lang.php:1.6 Sat Oct 30 10:18:06 2004 +++ docweb/scripts/gen_picture_info_all_lang.php Sun Oct 31 20:20:25 2004 @@ -1,4 +1,5 @@ <?php + include '../include/jpgraph/jpgraph.php'; include '../include/jpgraph/jpgraph_bar.php'; @@ -18,44 +19,41 @@ ); +foreach($type_col_bar as $type => $pos) { + if (is_file(SQLITE_DIR . 'rev.' . $type . '.sqlite') && filesize(SQLITE_DIR . 'rev.' . $type . '.sqlite') != 0 ) { -foreach($type_col_bar as $type => $pos) { + $idx = sqlite_open(SQLITE_DIR . 'rev.' . $type . '.sqlite'); + + $language = revcheck_available_languages($idx, $type); + $files_EN = get_nb_EN_files($idx); + + + $tmp = Array(); + $datay_tmp = Array(); + $legendy_tmp = Array(); + $datay = Array(); + $legendy = Array(); - if( is_file(SQLITE_DIR . 'rev.' . $type . '.sqlite') && filesize(SQLITE_DIR . 'rev.' . $type . '.sqlite') != 0 ) { + foreach( $language as $lang ) { - $idx = sqlite_open(SQLITE_DIR . 'rev.' . $type . '.sqlite'); + $tmp = get_nb_LANG_files_Translated($idx, $lang); - $language = revcheck_available_languages($idx, $type); - $files_EN = get_nb_EN_files($idx); + $datay_tmp[] = round($tmp['total'] * 100 / $files_EN); + $legendy_tmp[] = $lang; - - $tmp = Array(); - $datay_tmp = Array(); - $legendy_tmp = Array(); - $datay = Array(); - $legendy = Array(); - - - foreach( $language as $lang ) { - - $tmp = get_nb_LANG_files_Translated($idx, $lang); - - $datay_tmp[] = round($tmp['total'] * 100 / $files_EN); - $legendy_tmp[] = $lang; - - } - $datay = array_values($datay_tmp); - $legendy = array_values($legendy_tmp); - - echo "Generating $type graphic for all languages..."; - - generation_image($type); - - echo " Done.\n"; - - } // end if + } + $datay = array_values($datay_tmp); + $legendy = array_values($legendy_tmp); + + echo "Generating $type graphic for all languages..."; + + generation_image($type); + + echo " Done.\n"; + + } // end if } // end foreach @@ -63,56 +61,54 @@ function generation_image($TYPE) { - global $datay; - global $legendy; - global $type_col_bar; - -// Create the graph. These two calls are always required -$graph = new Graph(550,250,"auto"); -$graph->SetScale("textlin"); -$graph->yaxis->scale->SetGrace(20); + global $datay; + global $legendy; + global $type_col_bar; -$graph->xaxis->SetLabelmargin(5); -$graph->xaxis->SetTickLabels($legendy); + // Create the graph. These two calls are always required + $graph = new Graph(550,250,"auto"); + $graph->SetScale("textlin"); + $graph->yaxis->scale->SetGrace(20); + $graph->xaxis->SetLabelmargin(5); + $graph->xaxis->SetTickLabels($legendy); -$graph->ygrid->SetFill(true,'#EFEFEF@0.5','#BBCCFF@0.5'); -// Add a drop shadow -$graph->SetShadow(); + $graph->ygrid->SetFill(true,'#EFEFEF@0.5','#BBCCFF@0.5'); -// Adjust the margin a bit to make more room for titles -$graph->img->SetMargin(50,30,20,40); + // Add a drop shadow + $graph->SetShadow(); -// Create a bar pot -$bplot = new BarPlot($datay); + // Adjust the margin a bit to make more room for titles + $graph->img->SetMargin(50,30,20,40); -// Adjust fill color -$bplot->SetFillColor('#'.$type_col_bar[$TYPE]); + // Create a bar pot + $bplot = new BarPlot($datay); -$bplot->SetShadow(); -$bplot->value->Show(); -$bplot->value->SetFont(FF_ARIAL,FS_BOLD,10); -$bplot->value->SetAngle(45); -$bplot->value->SetFormat('%0.0f'); + // Adjust fill color + $bplot->SetFillColor('#'.$type_col_bar[$TYPE]); -// Width -$bplot->SetWidth(0.6); + $bplot->SetShadow(); + $bplot->value->Show(); + $bplot->value->SetFont(FF_ARIAL,FS_BOLD,10); + $bplot->value->SetAngle(45); + $bplot->value->SetFormat('%0.0f'); -$graph->Add($bplot); + // Width + $bplot->SetWidth(0.6); -// Setup the titles -$graph->title->Set(strtoupper($TYPE)." documentation"); -$graph->xaxis->title->Set("Language"); -$graph->yaxis->title->Set("Files up to date (%)"); + $graph->Add($bplot); -$graph->title->SetFont(FF_FONT1,FS_BOLD); -$graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD); -$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD); + // Setup the titles + $graph->title->Set(strtoupper($TYPE)." documentation"); + $graph->xaxis->title->Set("Language"); + $graph->yaxis->title->Set("Files up to date (%)"); -// Display the graph -$graph->Stroke('../www/images/revcheck/info_revcheck_' . $TYPE . '_all_lang.png'); + $graph->title->SetFont(FF_FONT1,FS_BOLD); + $graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD); + $graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD); -} + // Display the graph + $graph->Stroke('../www/images/revcheck/info_revcheck_' . $TYPE . '_all_lang.png'); -?> +} \ No newline at end of file http://cvs.php.net/diff.php/docweb/scripts/generation.sh?r1=1.2&r2=1.3&ty=u Index: docweb/scripts/generation.sh diff -u docweb/scripts/generation.sh:1.2 docweb/scripts/generation.sh:1.3 --- docweb/scripts/generation.sh:1.2 Thu Aug 5 10:30:56 2004 +++ docweb/scripts/generation.sh Sun Oct 31 20:20:25 2004 @@ -1,56 +1,38 @@ #!/bin/sh -#cvs up -Pd de phpdoc-all -cd ../cvs/phpdoc-all -echo "Update cvs..." -cvs up -Pd -echo "...terminé." -echo "Génération des bases Sql" +echo "Generating revcheck databases" # cd back again cd ../scripts -# On commence par Php -echo "Génération du revcheck PHP" +# PHP +echo "Generating PHP database" /usr/bin/php4 -q ./rev.php php pt_BR zh hk tw cs nl fi fr de el he hu it kr pl ro ru sk sl es sv tr ja -echo "...terminé." - -# Puis Pear -echo "Génération du revcheck Pear" -/usr/bin/php4 -q ./rev.php pear nl fr hu ru ja -echo "...terminé." - -# Puis smarty -echo "Génération du revcheck smarty" -/usr/bin/php4 -q ./rev.php smarty pt_BR fr de ru -echo "...terminé." - -# Puis Gtk -echo "Génération du revcheck gtk" -/usr/bin/php4 -q ./rev.php gtk pt_BR cs fr de it es ja -echo "...terminé." - -############ -# Génération des images info_revcheck -############ -echo "Génération des images info_revcheck Php" +echo "... done." +echo "Generating PHP pictures" /usr/bin/php4 -q ./gen_picture_info.php php pt_BR zh hk tw cs nl fi fr de el he hu it kr pl ro ru sk sl es sv tr ja -echo "... terminé" +echo "... done" -echo "Génération des images info_revcheck Smarty" -/usr/bin/php4 -q ./gen_picture_info.php smarty pt_BR zh hk tw cs nl fi fr de el he hu it kr pl ro ru sk sl es sv tr ja -echo "... terminé" -echo "Génération des images info_revcheck Pear" +# PEAR +echo "Generating PEAR database" +/usr/bin/php4 -q ./rev.php pear nl fr hu ru ja +echo "... done." +echo "Generating PEAR pictures" /usr/bin/php4 -q ./gen_picture_info.php pear pt_BR zh hk tw cs nl fi fr de el he hu it kr pl ro ru sk sl es sv tr ja -echo "... terminé" +echo "... done" + +# SMARTY +echo "Generating SMARTY database" +/usr/bin/php4 -q ./rev.php smarty pt_BR fr de ru +echo "... done." +echo "Generating SMARTY pictures" +/usr/bin/php4 -q ./gen_picture_info.php smarty pt_BR zh hk tw cs nl fi fr de el he hu it kr pl ro ru sk sl es sv tr ja +echo "... done" -echo "Génération des images info_revcheck Gtk" -/usr/bin/php4 -q ./gen_picture_info.php gtk pt_BR zh hk tw cs nl fi fr de el he hu it kr pl ro ru sk sl es sv tr ja -echo "... terminé" -echo "Génération des images info_revcheckDOC_all_lang.png pour chaqu'une des documentations" +echo "Generating global graphs" /usr/bin/php4 -q ./gen_picture_info_all_lang.php -echo "... terminé" +echo "... done" http://cvs.php.net/diff.php/docweb/scripts/rev.php?r1=1.7&r2=1.8&ty=u Index: docweb/scripts/rev.php diff -u docweb/scripts/rev.php:1.7 docweb/scripts/rev.php:1.8 --- docweb/scripts/rev.php:1.7 Sun Oct 31 19:20:14 2004 +++ docweb/scripts/rev.php Sun Oct 31 20:20:26 2004 @@ -65,7 +65,7 @@ // grab the documentation type $TYPE = array_shift($argv); -if (!in_array($TYPE, array('php'))) { +if (!in_array($TYPE, array('php', 'smarty', 'peardoc'))) { echo "Error: The revcheck script is not available yet for $TYPE\n"; exit(0); } @@ -434,4 +434,4 @@ echo "Time of generation : " . $time . " s\n"; echo "End\n"; -exit(1); \ No newline at end of file +exit(1);
« previous php.doc.web (#408) next »