Re: [PHP-DOC] Improvements on revcheck.php script

2010-10-14 Thread Alexey Shein
One more little fix for revcheck.php: fixes directory name for files
situated in the root translation dir, was: ./en, now / (see Files
section).
Index: doc-base/scripts/revcheck.php
===
--- doc-base/scripts/revcheck.php	(revision 304390)
+++ doc-base/scripts/revcheck.php	(working copy)
@@ -897,8 +897,8 @@
   // Store the new actual directory
   $prev_dir = $new_dir;
 }
-// Drop out the unneeded parts from the dirname...
-$display_dir = str_replace($DOCDIR."en/", "", dirname($file["full_name"]));
+// Drop out the unneeded parts from the dirname, special case for root dir...
+$display_dir = str_replace(array($DOCDIR."en/", $DOCDIR."en"), array("", '/'), dirname($file["full_name"]));
 $prev_diplay_dir = "$display_dir";
 
 // Save the line for the current file (get file name shorter)


Re: [PHP-DOC] Improvements on revcheck.php script

2010-10-11 Thread Alexey Shein
2010/10/12 Philip Olson :
>
> On Oct 11, 2010, at 1:05 AM, Alexey Shein wrote:
>
>> Hello!
>> I've made some improvements of revcheck.php script and hope you'll
>> like them too so they could be taken into the svn:
>> 1) fixed E_NOTICE errors
>> 2) added console option --show-uptodate, which if supplied will also
>> show all up-to-date files in documentation. It can be useful to track
>> the translation progress with very obsolete status (as Russian one,
>> for example) so after some change translator will see one more green
>> (up-to-date) file than one less orange (untranslated) file from other
>> same orange 8.
>> I tried to keep BC as much as possible, hope there is no errors (at
>> least new :)).
>
> Greetings Alexey,
>
> Looks good, this patch has been committed. Thanks for improving the PHP 
> Documentation, and looking forward to seeing more ;)
>
> Regards,
> Philip
>
>

Thanks.


-- 
Regards,
Shein Alexey


Re: [PHP-DOC] Improvements on revcheck.php script

2010-10-11 Thread Philip Olson

On Oct 11, 2010, at 1:05 AM, Alexey Shein wrote:

> Hello!
> I've made some improvements of revcheck.php script and hope you'll
> like them too so they could be taken into the svn:
> 1) fixed E_NOTICE errors
> 2) added console option --show-uptodate, which if supplied will also
> show all up-to-date files in documentation. It can be useful to track
> the translation progress with very obsolete status (as Russian one,
> for example) so after some change translator will see one more green
> (up-to-date) file than one less orange (untranslated) file from other
> same orange 8.
> I tried to keep BC as much as possible, hope there is no errors (at
> least new :)).

Greetings Alexey,

Looks good, this patch has been committed. Thanks for improving the PHP 
Documentation, and looking forward to seeing more ;)

Regards,
Philip



[PHP-DOC] Improvements on revcheck.php script

2010-10-11 Thread Alexey Shein
Hello!
I've made some improvements of revcheck.php script and hope you'll
like them too so they could be taken into the svn:
1) fixed E_NOTICE errors
2) added console option --show-uptodate, which if supplied will also
show all up-to-date files in documentation. It can be useful to track
the translation progress with very obsolete status (as Russian one,
for example) so after some change translator will see one more green
(up-to-date) file than one less orange (untranslated) file from other
same orange 8.
I tried to keep BC as much as possible, hope there is no errors (at
least new :)).

-- 
Regards,
Shein Alexey
Index: doc-base/scripts/revcheck.php
===
--- doc-base/scripts/revcheck.php	(revision 293138)
+++ doc-base/scripts/revcheck.php	(revision )
@@ -22,14 +22,14 @@
 
   $Id: revcheck.php 293138 2010-01-05 10:21:11Z rquadling $
 */
-if ($argc < 2 || $argc > 3) {
+if ($argc < 2 || $argc > 4) {
 ?>
 
 Check the revision of translated files against
 the actual english xml files, and print statistics
 
   Usage:
-[]
+[] [--show-uptodate]
 
must be a valid language code used
   in the repository
@@ -37,6 +37,9 @@
   If you specify , the script only checks
   the files maintained by the person you add here
 
+  If you specify --show-uptodate option, the script will
+  also show uptodate files in the common file list
+
   Read more about Revision comments and related
   functionality in the PHP Documentation Howto:
 http://php.net/dochowto
@@ -76,17 +79,40 @@
   REV_WIP  => "wip",
 );
 
+function init_revisions() {
+	 global $CSS;
+	 return array_fill_keys(array_keys($CSS), 0);
+}
+
+function init_files_by_maint($persons) {
+  $result = array();
+  foreach($persons as $item) {
+$result[$item['nick']] = init_revisions();
+  }
+
+ 	return $result;
+}
+
+$file_sizes_by_mark = $files_by_mark = init_revisions();
+
 // Option for the link to svn.php.net:
 define('SVN_OPT', '&view=patch');
 define('SVN_OPT_NOWS', '');
 
 // Initializing variables from parameters
 $LANG = $argv[1];
+$MAINT = "";
+$SHOW_UPTODATE = FALSE;
 if ($argc == 3) {
-$MAINT = $argv[2];
+	if ($argv[2] == '--show-uptodate') {
+ $SHOW_UPTODATE = TRUE;
-} else {
+} else {
-$MAINT = "";
+ $MAINT = $argv[2];	
-}
+	}
+} elseif ($argc == 4) {
+$MAINT = $argv[2];
+$SHOW_UPTODATE = ($argv[3] == '--show-uptodate');
+}
 
 // Main directory of the PHP documentation (depends on the
 // sapi used). We do need the trailing slash!
@@ -172,7 +198,7 @@
 function get_file_status($file) {
 
   // The information is contained in these global arrays and vars
-  global $DOCDIR, $LANG, $MAINT, $files_by_mark, $files_by_maint;
+  global $DOCDIR, $LANG, $MAINT, $SHOW_UPTODATE, $files_by_mark, $files_by_maint;
   global $file_sizes_by_mark;
   global $missing_files, $missing_tags, $using_rev;
 
@@ -246,23 +272,17 @@
 $en_rev   = $en_rev;
   }
 
-  // If the file is up-to-date
-  if ($rev_diff === 0 && trim($this_status) === "ready") {
-// Store file by status and maintainer
-$files_by_mark[REV_UPTODATE]++;
-$files_by_maint[$this_maint][REV_UPTODATE]++;
-$file_sizes_by_mark[REV_UPTODATE] += $en_size;
-
-return FALSE;
-  }
-
   // Compute times and diffs
   $en_date= intval((time() - filemtime($file)) / 86400);
   $trans_date = intval((time() - filemtime($trans_file)) / 86400);
   $date_diff  = $en_date - $trans_date;
 
-  // Make decision on file category by revision, date and size
-  if ($rev_diff >= ALERT_REV || $size_diff >= ALERT_SIZE || $date_diff <= ALERT_DATE) {
+  // If the file is up-to-date
+  if ($rev_diff === 0 && trim($this_status) === "ready") {
+ $status_mark = REV_UPTODATE;
+  }
+  // Or make decision on file category by revision, date and size
+  elseif ($rev_diff >= ALERT_REV || $size_diff >= ALERT_SIZE || $date_diff <= ALERT_DATE) {
 $status_mark = REV_CRITICAL;
   } elseif ($rev_diff === "n/a") {
 $status_mark = REV_NOREV;
@@ -277,6 +297,10 @@
   $files_by_maint[$this_maint][$status_mark]++;
   $file_sizes_by_mark[$status_mark] += $en_size;
 
+  if (REV_UPTODATE === $status_mark && !$SHOW_UPTODATE) {
+return FALSE;
+  }
+
   return array(
   "full_name"  => $file,
   "short_name" => basename($trans_file),
@@ -579,6 +603,7 @@
 // Add WIP files to maintainers file count and figure out,
 // if we need to use optional date and revision columns
 $using_date = FALSE; $using_rev = FALSE;
+$files_by_maint = init_files_by_maint($translation['persons']);
 foreach ($translation["files"] as $num => $fileinfo) {
   $files_by_maint[$fileinfo["person"]][REV_WIP]++;
   if (isset($fileinfo["date"])) { $using_date = TRUE; }