com web/doc: Cron scripts updated: cron/daily/populatedocs scripts/gen_picture_info.php scripts/gen_picture_in fo_all_lang.php scripts/generation.sh
scripts/popul atedocs.sh scripts/rev.php
| From: | sobak@php.net | Date: | Sat, 22 Mar 2014 13:29:43 +0000 |
| Subject: | com web/doc: Cron scripts updated: cron/daily/populatedocs scripts/gen_picture_info.php scripts/gen_picture_in fo_all_lang.php scripts/generation.sh scripts/popul atedocs.sh scripts/rev.php |
||
| Groups: | php.doc.web | ||
| Request: | Send a blank email to doc-web+get-2328@lists.php.net to get a copy of this message | ||
Commit: 64aa57f6c30027fc3883475b94177bb894d6db99
Author: Sobak <msobaczewski@gmail.com> Sat, 22 Mar 2014 14:29:43 +0100
Parents: 27cfbcbc6984301595a5eff12e305b110d0d6059
Branches: master
Link: http://git.php.net/?p=web/doc.git;a=commitdiff;h=64aa57f6c30027fc3883475b94177bb894d6db99
Log:
Cron scripts updated
Changed paths:
M cron/daily/populatedocs
M scripts/gen_picture_info.php
M scripts/gen_picture_info_all_lang.php
M scripts/generation.sh
M scripts/populatedocs.sh
M scripts/rev.php
diff --git a/cron/daily/populatedocs b/cron/daily/populatedocs index 7de32e2..b840631 100755 --- a/cron/daily/populatedocs +++ b/cron/daily/populatedocs @@ -1,5 +1,9 @@ #!/bin/sh +# This task run two shell scripts responsible for revision check +# - populatedocs.sh - checking out SVN docs repository into local filesystem +# - generation.sh - generating revision check database and charts + . `dirname $0`/../../build-ops cd ${SCRIPTSDIR} diff --git a/scripts/gen_picture_info.php b/scripts/gen_picture_info.php index c8c9a33..9afded2 100644 --- a/scripts/gen_picture_info.php +++ b/scripts/gen_picture_info.php @@ -1,6 +1,4 @@ <?php -/* $Id$ */ - include '../include/jpgraph/src/jpgraph.php'; include '../include/jpgraph/src/jpgraph_pie.php'; include '../include/jpgraph/src/jpgraph_pie3d.php'; @@ -8,45 +6,33 @@ include '../include/jpgraph/src/jpgraph_pie3d.php'; $inCli = true; include '../include/init.inc.php'; include '../include/lib_revcheck.inc.php'; +include '../include/lib_proj_lang.inc.php'; -$self = array_shift($argv); - -$TYPE = array_shift($argv); // Type of documentation -$LANGS = $argv; - -// generate all languages -if (count($LANGS) == 0) { - include "../include/lib_proj_lang.inc.php"; - $LANGS = array_keys($LANGUAGES); -} - - -foreach ($LANGS as $lang) { - if ($lang === 'en' || $lang === 'all') { +$langs = array_key($LANGUAGES); +foreach ($langs as $lang) { + if ($lang === 'en') { continue; } - if (!generation_image($TYPE, $lang) ) { - echo "The $TYPE documentation for $lang language does not exist.\n"; + if (!generate_image($lang)) { + echo "Documentation for $lang language does not exist.\n"; } else { - echo " Generated images/revcheck/info_revcheck_" . $TYPE . "_" . $lang . ".png\n"; + echo "Generated images/revcheck/info_revcheck_php_" . $lang . ".png\n"; } } - -function generation_image($TYPE, $lang) { +function generate_image($lang) { global $LANGUAGES; - $idx = sqlite_open(SQLITE_DIR . 'rev.' . $TYPE . '.sqlite'); + $idx = sqlite_open(SQLITE_DIR . 'rev.php.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']; + $up_to_date = ($up_to_date['total'] == '') ? 0 : $up_to_date['total']; // $critical = @get_stats_critical($idx, $lang); $critical = $critical[0]; @@ -61,20 +47,18 @@ function generation_image($TYPE, $lang) { // $data = array($up_to_date,$critical,$old,$missing,$no_tag); - $pourcent = array(); + $percent = array(); $total = 0; $total = array_sum($data); - foreach ( $data as $valeur ) { - - $pourcent[] = round($valeur * 100 / $total); - + foreach ($data as $value) { + $percent[] = round($value * 100 / $total); } $noExplode = ($Total_files_lang == $up_to_date) ? 1 : 0; - $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'; + $legend = array($percent[0] . '%% up to date ('.$up_to_date.')', $percent[1] . '%% critical ('.$critical.')', $percent[2] . '%% old ('.$old.')', $percent[3] . '%% missing ('.$missing.')', $percent[4] . '%% without revtag ('.$no_tag.')'); + $title = 'Details for '.$LANGUAGES[$lang].' PHP Manual'; $graph = new PieGraph(530,300); $graph->SetShadow(); @@ -107,7 +91,7 @@ function generation_image($TYPE, $lang) { $p1->SetLegends($legend); $graph->Add($p1); - $graph->Stroke('../www/images/revcheck/info_revcheck_' . $TYPE . '_' . $lang . '.png'); + $graph->Stroke('../www/images/revcheck/info_revcheck_php_' . $lang . '.png'); return TRUE; diff --git a/scripts/gen_picture_info_all_lang.php b/scripts/gen_picture_info_all_lang.php index 0300a4e..4df4bc7 100644 --- a/scripts/gen_picture_info_all_lang.php +++ b/scripts/gen_picture_info_all_lang.php @@ -1,5 +1,4 @@ <?php - include '../include/jpgraph/src/jpgraph.php'; include '../include/jpgraph/src/jpgraph_bar.php'; @@ -7,61 +6,28 @@ $inCli = true; include '../include/init.inc.php'; include '../include/lib_revcheck.inc.php'; +$idx = sqlite_open(SQLITE_DIR . 'rev.php.sqlite'); -// Couleurs des barres, suivant le type de la doc -$type_col_bar = array( - -'php' => '9999cc' - -); - - -foreach($type_col_bar as $type => $pos) { - - if (is_file(SQLITE_DIR . 'rev.' . $type . '.sqlite') && filesize(SQLITE_DIR . 'rev.' . $type . '.sqlite') != 0 ) { - - $idx = sqlite_open(SQLITE_DIR . 'rev.' . $type . '.sqlite'); - - $language = revcheck_available_languages($idx, $type); - sort($language); - $files_EN = get_nb_EN_files($idx); - - - $tmp = Array(); - $datay_tmp = Array(); - $legendy_tmp = Array(); - $datay = Array(); - $legendy = Array(); - +$language = revcheck_available_languages($idx, 'php'); +sort($language); +$files_EN = get_nb_EN_files($idx); - 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 - -} // end foreach +foreach ($language as $lang) { + $tmp = get_nb_LANG_files_Translated($idx, $lang); + $percent_tmp[] = round($tmp['total'] * 100 / $files_EN); + $legend_tmp[] = $lang; +} +$percent = array_values($percent_tmp); +$legend = array_values($legend_tmp); +echo "Generating PHP graphic for all languages..."; +generate_image(); +echo " Done.\n"; -function generation_image($TYPE) { - global $datay; - global $legendy; - global $type_col_bar; +function generate_image() { + global $percent, $legend; // Create the graph. These two calls are always required $graph = new Graph(550,250); @@ -69,8 +35,7 @@ function generation_image($TYPE) { $graph->yaxis->scale->SetGrace(20); $graph->xaxis->SetLabelmargin(5); - $graph->xaxis->SetTickLabels($legendy); - + $graph->xaxis->SetTickLabels($legend); $graph->ygrid->SetFill(true,'#EFEFEF@0.5','#BBCCFF@0.5'); @@ -81,10 +46,10 @@ function generation_image($TYPE) { $graph->img->SetMargin(50,30,20,40); // Create a bar pot - $bplot = new BarPlot($datay); + $bplot = new BarPlot($percent); // Adjust fill color - $bplot->SetFillColor('#'.$type_col_bar[$TYPE]); + $bplot->SetFillColor('#9999CC'); $bplot->SetShadow(); $bplot->value->Show(); @@ -98,7 +63,7 @@ function generation_image($TYPE) { $graph->Add($bplot); // Setup the titles - $graph->title->Set(strtoupper($TYPE)." documentation"); + $graph->title->Set("PHP documentation"); $graph->xaxis->title->Set("Language"); $graph->yaxis->title->Set("Files up to date (%)"); @@ -107,6 +72,6 @@ function generation_image($TYPE) { $graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD); // Display the graph - $graph->Stroke('../www/images/revcheck/info_revcheck_' . $TYPE . '_all_lang.png'); + $graph->Stroke('../www/images/revcheck/info_revcheck_php_all_lang.png'); } diff --git a/scripts/generation.sh b/scripts/generation.sh index 493094b..07c6b27 100755 --- a/scripts/generation.sh +++ b/scripts/generation.sh @@ -9,21 +9,12 @@ cd ${SCRIPTSDIR} # PHP echo "Generating PHP database" -${PHP} -q ./rev.php php +${PHP} -q ./rev.php echo "... done." echo "Generating PHP pictures" -${PHP} -q ./gen_picture_info.php php -echo "... done" - - -# PEAR -echo "Generating PEAR database" -${PHP} -q ./rev.php pear -echo "... done." -echo "Generating PEAR pictures" -${PHP} -q ./gen_picture_info.php pear +${PHP} -q ./gen_picture_info.php echo "... done" echo "Generating global graphs" ${PHP} -q ./gen_picture_info_all_lang.php -echo "... done" +echo "... done" \ No newline at end of file diff --git a/scripts/populatedocs.sh b/scripts/populatedocs.sh index ac7da65..ddce6d1 100755 --- a/scripts/populatedocs.sh +++ b/scripts/populatedocs.sh @@ -2,7 +2,7 @@ # +----------------------------------------------------------------------+ # | PHP Documentation Tools Site Source Code | # +----------------------------------------------------------------------+ -# | Copyright (c) 1997-2011 The PHP Group | +# | Copyright (c) 1997-2014 The PHP Group | # +----------------------------------------------------------------------+ # | This source file is subject to version 3.0 of the PHP license, | # | that is bundled with this package in the file LICENSE, and is | @@ -15,7 +15,6 @@ # | Authors: Jacques Marneweck <jacques@php.net> | # +----------------------------------------------------------------------+ # -# $Id$ SVNBIN=/usr/bin/svn pushd . @@ -40,22 +39,6 @@ else ${SVNBIN} co http://svn.php.net/repository/phpdoc/modules/doc-all ${DOCDIR} fi -echo "Checking out PHP GTK docs..." -if [ -d ${GTKDIR} ] -then - (cd ${GTKDIR} && ${SVNBIN} up) -else - ${SVNBIN} co http://svn.php.net/repository/gtk/php-gtk-doc/trunk ${GTKDIR} -fi - -echo "Checking out PEAR docs..." -if [ -d ${PEARDIR} ] -then - (cd ${PEARDIR} && ${SVNBIN} up) -else - ${SVNBIN} co http://svn.php.net/repository/pear/peardoc/trunk ${PEARDIR} -fi - echo "Checking out php-src..." if [ -d ${SRCDIR} ] then @@ -66,7 +49,4 @@ else fi echo -n "Reverting directory:" -popd - -# vim: et ts=2 sw=2 - +popd \ No newline at end of file diff --git a/scripts/rev.php b/scripts/rev.php index af90f60..8f90f7a 100644 --- a/scripts/rev.php +++ b/scripts/rev.php @@ -1,9 +1,9 @@ <?php /* +----------------------------------------------------------------------+ -| PHP Version 4 | +| PHP Documentation Tools Site Source Code | +----------------------------------------------------------------------+ -| Copyright (c) 1997-2011 The PHP Group | +| Copyright (c) 1997-2014 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.0 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -18,70 +18,24 @@ | Mark Kronsbein <mk at php dot net> | | Jan Fabry <cheezy at php dot net> | | SQLite version Authors: | -| Mehdi Achour <didou at php dot net> | +| Mehdi Achour <didou at php dot net> | +| Maciej Sobaczewski <sobak at php dot net> | +----------------------------------------------------------------------+ */ error_reporting(E_ALL); set_time_limit(0); -/** -* Usage -**/ - -// keep this call, we need it -$self = array_shift($argv); - -if ($argc < 2) { -?> - Usage: - <?php echo $self;?> type [lang1 [lang2 [lang3 [..]]]] - - Checks the revision of translated files against the actual english - xml files, and create an sqlite database to generate statisctics - - type should be a registered documentation type in - <?php echo dirname($self);?>/common.php - - langN should be a valid language code used in the documentation - repository - - Read more about Revision comments and related functionality in - the PHP Documentation Howto : - http://php.net/manual/howto/translation-revtrack.html (9.4.2) - -<?php -exit(0); -} - -/** -* Configuration -**/ // define some common variables $inCli = true; include '../include/init.inc.php'; +include '../include/lib_proj_lang.inc.php'; -// grab the documentation type -$TYPE = array_shift($argv); - -if ($TYPE != 'php') { - echo "Error: The revcheck script is not available yet for $TYPE\n"; - exit(0); -} - -$DOCS = SVN_DIR . get_svn_dir($TYPE); - -// $argv was shifted before -$LANGS = $argv; - -// generate all languages -if (count($LANGS) == 0) { - include "../include/lib_proj_lang.inc.php"; - $LANGS = array_keys($LANGUAGES); -} +$DOCS = SVN_DIR . get_svn_dir('php'); -// Test the languages : +// Test the languages: +$LANGS = array_keys($LANGUAGES); $langc = count($LANGS); for ($i = 0; $i < $langc; $i++) { // make sure we don't parse the en tree @@ -89,16 +43,15 @@ for ($i = 0; $i < $langc; $i++) { unset($LANGS[$i]); continue; } - + if (!is_dir($DOCS . $LANGS[$i])) { - echo "Error: the \"{$LANGS[$i]}\" lang doesn't exist for $TYPE in dir {$DOCS}, skipping..\n"; + echo "Error: the \"{$LANGS[$i]}\" lang doesn't exist in dir {$DOCS}, skipping..\n"; unset($LANGS[$i]); } } -if (count($LANGS) == 0) -{ +if (count($LANGS) == 0) { echo "Error: No language to revcheck, exiting.\n"; - exit(0); + exit; } $SQL_BUFF = "INSERT INTO dirs (id, name) VALUES (1, '/');\n"; @@ -434,7 +387,7 @@ function get_tags($file) { // Read the first 500 chars. The comment should be at // the begining of the file - $fp = @fopen($file, "r") or die ("Unable to read $file."); + $fp = @fopen($file, "r") or die("Unable to read $file."); $line = fread($fp, 500); fclose($fp); @@ -493,17 +446,17 @@ function getmicrotime() $time_start = getmicrotime(); -$db_name = SQLITE_DIR . 'rev.' . $TYPE . '.sqlite'; -$tmp_db = SQLITE_DIR . 'rev.' . $TYPE . '.tmp.sqlite'; +$db_name = SQLITE_DIR . 'rev.php.sqlite'; +$tmp_db = SQLITE_DIR . 'rev.php.tmp.sqlite'; // 1 - Drop the old database and create the new one if (is_file($tmp_db)) { - echo "Temporary database found : remove.\n"; + echo "Temporary database found: remove.\n"; if (!@unlink($tmp_db)) { - echo "Error : Can't remove temporary database\n"; - exit(0); + echo "Error: Can't remove temporary database\n"; + exit; } } @@ -512,7 +465,8 @@ if (is_file($tmp_db)) { $idx = sqlite_open($tmp_db, 0666); if (!$idx) { - die("could not open $tmp_name"); + echo "Could not open $tmp_name"; + exit; } sqlite_query($idx, $CREATE); @@ -529,7 +483,7 @@ do_revcheck(); // 4:1 - Recurse in the manuel seeking for old files for each language and fill $SQL_BUFF foreach ($LANGS as $lang) { - check_old_files('', $lang); + check_old_files('', $lang); } // 5 - Query $SQL_BUFF and exit @@ -547,6 +501,5 @@ copy($tmp_db, $db_name); $time_end = getmicrotime(); $time = $time_end - $time_start; -echo "Time of generation : " . $time . " s\n"; -echo "End\n"; -exit(1); +echo "Time of generation: $time s\n"; +echo "End\n"; \ No newline at end of file
diff --git a/cron/daily/populatedocs b/cron/daily/populatedocs index 7de32e2..b840631 100755 --- a/cron/daily/populatedocs +++ b/cron/daily/populatedocs @@ -1,5 +1,9 @@ #!/bin/sh +# This task run two shell scripts responsible for revision check +# - populatedocs.sh - checking out SVN docs repository into local filesystem +# - generation.sh - generating revision check database and charts + . `dirname $0`/../../build-ops cd ${SCRIPTSDIR} diff --git a/scripts/gen_picture_info.php b/scripts/gen_picture_info.php index c8c9a33..9afded2 100644 --- a/scripts/gen_picture_info.php +++ b/scripts/gen_picture_info.php @@ -1,6 +1,4 @@ <?php -/* $Id$ */ - include '../include/jpgraph/src/jpgraph.php'; include '../include/jpgraph/src/jpgraph_pie.php'; include '../include/jpgraph/src/jpgraph_pie3d.php'; @@ -8,45 +6,33 @@ include '../include/jpgraph/src/jpgraph_pie3d.php'; $inCli = true; include '../include/init.inc.php'; include '../include/lib_revcheck.inc.php'; +include '../include/lib_proj_lang.inc.php'; -$self = array_shift($argv); - -$TYPE = array_shift($argv); // Type of documentation -$LANGS = $argv; - -// generate all languages -if (count($LANGS) == 0) { - include "../include/lib_proj_lang.inc.php"; - $LANGS = array_keys($LANGUAGES); -} - - -foreach ($LANGS as $lang) { - if ($lang === 'en' || $lang === 'all') { +$langs = array_key($LANGUAGES); +foreach ($langs as $lang) { + if ($lang === 'en') { continue; } - if (!generation_image($TYPE, $lang) ) { - echo "The $TYPE documentation for $lang language does not exist.\n"; + if (!generate_image($lang)) { + echo "Documentation for $lang language does not exist.\n"; } else { - echo " Generated images/revcheck/info_revcheck_" . $TYPE . "_" . $lang . ".png\n"; + echo "Generated images/revcheck/info_revcheck_php_" . $lang . ".png\n"; } } - -function generation_image($TYPE, $lang) { +function generate_image($lang) { global $LANGUAGES; - $idx = sqlite_open(SQLITE_DIR . 'rev.' . $TYPE . '.sqlite'); + $idx = sqlite_open(SQLITE_DIR . 'rev.php.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']; + $up_to_date = ($up_to_date['total'] == '') ? 0 : $up_to_date['total']; // $critical = @get_stats_critical($idx, $lang); $critical = $critical[0]; @@ -61,20 +47,18 @@ function generation_image($TYPE, $lang) { // $data = array($up_to_date,$critical,$old,$missing,$no_tag); - $pourcent = array(); + $percent = array(); $total = 0; $total = array_sum($data); - foreach ( $data as $valeur ) { - - $pourcent[] = round($valeur * 100 / $total); - + foreach ($data as $value) { + $percent[] = round($value * 100 / $total); } $noExplode = ($Total_files_lang == $up_to_date) ? 1 : 0; - $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'; + $legend = array($percent[0] . '%% up to date ('.$up_to_date.')', $percent[1] . '%% critical ('.$critical.')', $percent[2] . '%% old ('.$old.')', $percent[3] . '%% missing ('.$missing.')', $percent[4] . '%% without revtag ('.$no_tag.')'); + $title = 'Details for '.$LANGUAGES[$lang].' PHP Manual'; $graph = new PieGraph(530,300); $graph->SetShadow(); @@ -107,7 +91,7 @@ function generation_image($TYPE, $lang) { $p1->SetLegends($legend); $graph->Add($p1); - $graph->Stroke('../www/images/revcheck/info_revcheck_' . $TYPE . '_' . $lang . '.png'); + $graph->Stroke('../www/images/revcheck/info_revcheck_php_' . $lang . '.png'); return TRUE; diff --git a/scripts/gen_picture_info_all_lang.php b/scripts/gen_picture_info_all_lang.php index 0300a4e..4df4bc7 100644 --- a/scripts/gen_picture_info_all_lang.php +++ b/scripts/gen_picture_info_all_lang.php @@ -1,5 +1,4 @@ <?php - include '../include/jpgraph/src/jpgraph.php'; include '../include/jpgraph/src/jpgraph_bar.php'; @@ -7,61 +6,28 @@ $inCli = true; include '../include/init.inc.php'; include '../include/lib_revcheck.inc.php'; +$idx = sqlite_open(SQLITE_DIR . 'rev.php.sqlite'); -// Couleurs des barres, suivant le type de la doc -$type_col_bar = array( - -'php' => '9999cc' - -); - - -foreach($type_col_bar as $type => $pos) { - - if (is_file(SQLITE_DIR . 'rev.' . $type . '.sqlite') && filesize(SQLITE_DIR . 'rev.' . $type . '.sqlite') != 0 ) { - - $idx = sqlite_open(SQLITE_DIR . 'rev.' . $type . '.sqlite'); - - $language = revcheck_available_languages($idx, $type); - sort($language); - $files_EN = get_nb_EN_files($idx); - - - $tmp = Array(); - $datay_tmp = Array(); - $legendy_tmp = Array(); - $datay = Array(); - $legendy = Array(); - +$language = revcheck_available_languages($idx, 'php'); +sort($language); +$files_EN = get_nb_EN_files($idx); - 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 - -} // end foreach +foreach ($language as $lang) { + $tmp = get_nb_LANG_files_Translated($idx, $lang); + $percent_tmp[] = round($tmp['total'] * 100 / $files_EN); + $legend_tmp[] = $lang; +} +$percent = array_values($percent_tmp); +$legend = array_values($legend_tmp); +echo "Generating PHP graphic for all languages..."; +generate_image(); +echo " Done.\n"; -function generation_image($TYPE) { - global $datay; - global $legendy; - global $type_col_bar; +function generate_image() { + global $percent, $legend; // Create the graph. These two calls are always required $graph = new Graph(550,250); @@ -69,8 +35,7 @@ function generation_image($TYPE) { $graph->yaxis->scale->SetGrace(20); $graph->xaxis->SetLabelmargin(5); - $graph->xaxis->SetTickLabels($legendy); - + $graph->xaxis->SetTickLabels($legend); $graph->ygrid->SetFill(true,'#EFEFEF@0.5','#BBCCFF@0.5'); @@ -81,10 +46,10 @@ function generation_image($TYPE) { $graph->img->SetMargin(50,30,20,40); // Create a bar pot - $bplot = new BarPlot($datay); + $bplot = new BarPlot($percent); // Adjust fill color - $bplot->SetFillColor('#'.$type_col_bar[$TYPE]); + $bplot->SetFillColor('#9999CC'); $bplot->SetShadow(); $bplot->value->Show(); @@ -98,7 +63,7 @@ function generation_image($TYPE) { $graph->Add($bplot); // Setup the titles - $graph->title->Set(strtoupper($TYPE)." documentation"); + $graph->title->Set("PHP documentation"); $graph->xaxis->title->Set("Language"); $graph->yaxis->title->Set("Files up to date (%)"); @@ -107,6 +72,6 @@ function generation_image($TYPE) { $graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD); // Display the graph - $graph->Stroke('../www/images/revcheck/info_revcheck_' . $TYPE . '_all_lang.png'); + $graph->Stroke('../www/images/revcheck/info_revcheck_php_all_lang.png'); } diff --git a/scripts/generation.sh b/scripts/generation.sh index 493094b..07c6b27 100755 --- a/scripts/generation.sh +++ b/scripts/generation.sh @@ -9,21 +9,12 @@ cd ${SCRIPTSDIR} # PHP echo "Generating PHP database" -${PHP} -q ./rev.php php +${PHP} -q ./rev.php echo "... done." echo "Generating PHP pictures" -${PHP} -q ./gen_picture_info.php php -echo "... done" - - -# PEAR -echo "Generating PEAR database" -${PHP} -q ./rev.php pear -echo "... done." -echo "Generating PEAR pictures" -${PHP} -q ./gen_picture_info.php pear +${PHP} -q ./gen_picture_info.php echo "... done" echo "Generating global graphs" ${PHP} -q ./gen_picture_info_all_lang.php -echo "... done" +echo "... done" \ No newline at end of file diff --git a/scripts/populatedocs.sh b/scripts/populatedocs.sh index ac7da65..ddce6d1 100755 --- a/scripts/populatedocs.sh +++ b/scripts/populatedocs.sh @@ -2,7 +2,7 @@ # +----------------------------------------------------------------------+ # | PHP Documentation Tools Site Source Code | # +----------------------------------------------------------------------+ -# | Copyright (c) 1997-2011 The PHP Group | +# | Copyright (c) 1997-2014 The PHP Group | # +----------------------------------------------------------------------+ # | This source file is subject to version 3.0 of the PHP license, | # | that is bundled with this package in the file LICENSE, and is | @@ -15,7 +15,6 @@ # | Authors: Jacques Marneweck <jacques@php.net> | # +----------------------------------------------------------------------+ # -# $Id$ SVNBIN=/usr/bin/svn pushd . @@ -40,22 +39,6 @@ else ${SVNBIN} co http://svn.php.net/repository/phpdoc/modules/doc-all ${DOCDIR} fi -echo "Checking out PHP GTK docs..." -if [ -d ${GTKDIR} ] -then - (cd ${GTKDIR} && ${SVNBIN} up) -else - ${SVNBIN} co http://svn.php.net/repository/gtk/php-gtk-doc/trunk ${GTKDIR} -fi - -echo "Checking out PEAR docs..." -if [ -d ${PEARDIR} ] -then - (cd ${PEARDIR} && ${SVNBIN} up) -else - ${SVNBIN} co http://svn.php.net/repository/pear/peardoc/trunk ${PEARDIR} -fi - echo "Checking out php-src..." if [ -d ${SRCDIR} ] then @@ -66,7 +49,4 @@ else fi echo -n "Reverting directory:" -popd - -# vim: et ts=2 sw=2 - +popd \ No newline at end of file diff --git a/scripts/rev.php b/scripts/rev.php index af90f60..8f90f7a 100644 --- a/scripts/rev.php +++ b/scripts/rev.php @@ -1,9 +1,9 @@ <?php /* +----------------------------------------------------------------------+ -| PHP Version 4 | +| PHP Documentation Tools Site Source Code | +----------------------------------------------------------------------+ -| Copyright (c) 1997-2011 The PHP Group | +| Copyright (c) 1997-2014 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.0 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -18,70 +18,24 @@ | Mark Kronsbein <mk at php dot net> | | Jan Fabry <cheezy at php dot net> | | SQLite version Authors: | -| Mehdi Achour <didou at php dot net> | +| Mehdi Achour <didou at php dot net> | +| Maciej Sobaczewski <sobak at php dot net> | +----------------------------------------------------------------------+ */ error_reporting(E_ALL); set_time_limit(0); -/** -* Usage -**/ - -// keep this call, we need it -$self = array_shift($argv); - -if ($argc < 2) { -?> - Usage: - <?php echo $self;?> type [lang1 [lang2 [lang3 [..]]]] - - Checks the revision of translated files against the actual english - xml files, and create an sqlite database to generate statisctics - - type should be a registered documentation type in - <?php echo dirname($self);?>/common.php - - langN should be a valid language code used in the documentation - repository - - Read more about Revision comments and related functionality in - the PHP Documentation Howto : - http://php.net/manual/howto/translation-revtrack.html (9.4.2) - -<?php -exit(0); -} - -/** -* Configuration -**/ // define some common variables $inCli = true; include '../include/init.inc.php'; +include '../include/lib_proj_lang.inc.php'; -// grab the documentation type -$TYPE = array_shift($argv); - -if ($TYPE != 'php') { - echo "Error: The revcheck script is not available yet for $TYPE\n"; - exit(0); -} - -$DOCS = SVN_DIR . get_svn_dir($TYPE); - -// $argv was shifted before -$LANGS = $argv; - -// generate all languages -if (count($LANGS) == 0) { - include "../include/lib_proj_lang.inc.php"; - $LANGS = array_keys($LANGUAGES); -} +$DOCS = SVN_DIR . get_svn_dir('php'); -// Test the languages : +// Test the languages: +$LANGS = array_keys($LANGUAGES); $langc = count($LANGS); for ($i = 0; $i < $langc; $i++) { // make sure we don't parse the en tree @@ -89,16 +43,15 @@ for ($i = 0; $i < $langc; $i++) { unset($LANGS[$i]); continue; } - + if (!is_dir($DOCS . $LANGS[$i])) { - echo "Error: the \"{$LANGS[$i]}\" lang doesn't exist for $TYPE in dir {$DOCS}, skipping..\n"; + echo "Error: the \"{$LANGS[$i]}\" lang doesn't exist in dir {$DOCS}, skipping..\n"; unset($LANGS[$i]); } } -if (count($LANGS) == 0) -{ +if (count($LANGS) == 0) { echo "Error: No language to revcheck, exiting.\n"; - exit(0); + exit; } $SQL_BUFF = "INSERT INTO dirs (id, name) VALUES (1, '/');\n"; @@ -434,7 +387,7 @@ function get_tags($file) { // Read the first 500 chars. The comment should be at // the begining of the file - $fp = @fopen($file, "r") or die ("Unable to read $file."); + $fp = @fopen($file, "r") or die("Unable to read $file."); $line = fread($fp, 500); fclose($fp); @@ -493,17 +446,17 @@ function getmicrotime() $time_start = getmicrotime(); -$db_name = SQLITE_DIR . 'rev.' . $TYPE . '.sqlite'; -$tmp_db = SQLITE_DIR . 'rev.' . $TYPE . '.tmp.sqlite'; +$db_name = SQLITE_DIR . 'rev.php.sqlite'; +$tmp_db = SQLITE_DIR . 'rev.php.tmp.sqlite'; // 1 - Drop the old database and create the new one if (is_file($tmp_db)) { - echo "Temporary database found : remove.\n"; + echo "Temporary database found: remove.\n"; if (!@unlink($tmp_db)) { - echo "Error : Can't remove temporary database\n"; - exit(0); + echo "Error: Can't remove temporary database\n"; + exit; } } @@ -512,7 +465,8 @@ if (is_file($tmp_db)) { $idx = sqlite_open($tmp_db, 0666); if (!$idx) { - die("could not open $tmp_name"); + echo "Could not open $tmp_name"; + exit; } sqlite_query($idx, $CREATE); @@ -529,7 +483,7 @@ do_revcheck(); // 4:1 - Recurse in the manuel seeking for old files for each language and fill $SQL_BUFF foreach ($LANGS as $lang) { - check_old_files('', $lang); + check_old_files('', $lang); } // 5 - Query $SQL_BUFF and exit @@ -547,6 +501,5 @@ copy($tmp_db, $db_name); $time_end = getmicrotime(); $time = $time_end - $time_start; -echo "Time of generation : " . $time . " s\n"; -echo "End\n"; -exit(1); +echo "Time of generation: $time s\n"; +echo "End\n"; \ No newline at end of file