From f0dee8c4eb9148e296b3da8228ba035c9361e3cb Mon Sep 17 00:00:00 2001
From: Andreas Heigl
Date: Thu, 15 Jun 2017 08:37:55 +0200
Subject: [PATCH 01/12] Renames README to README.md and adapts it
This was made to reflect the steps necessary to get the whole thing up
and running using git and not svn anymore
---
README | 126 ------------------------------------------------
README.md | 142 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 142 insertions(+), 126 deletions(-)
delete mode 100644 README
create mode 100644 README.md
diff --git a/README b/README
deleted file mode 100644
index a2e4102d..00000000
--- a/README
+++ /dev/null
@@ -1,126 +0,0 @@
----------------------------------------------------------------------------
-READ THIS FIRST
----------------------------------------------------------------------------
- This directory contains source files and a setup for converting
- PHP's XML documentation into presentation formats like HTML and
- RTF. You should not have to bother with this unless you are
- writing documentation yourself, or if you simply are curious
- about how the XML stuff works.
-
- If you just want to read the documentation, look at:
- http://www.php.net/docs.php
-
----------------------------------------------------------------------------
-HOW TO WRITE PHPDOC FILES
----------------------------------------------------------------------------
- If you are interested in information about how to
- set up the tools needed, how to work with SVN and
- DocBook on Linux or Windows, or what conventions you
- should follow when writing phpdoc files, please refer
- to the PHP Documentation HOWTO.
-
- You can read the HOWTO online at:
- http://doc.php.net/tutorial/
-
- If you are already working with the phpdoc module,
- then you can find its XML source in the howto directory
- of the module, and build it yourself with:
-
- phd -d .manual.xml
-
- However, PhD is a separate project which can be read about here:
-
- http://wiki.php.net/doc/phd
-
----------------------------------------------------------------------------
-QUICK REFERENCE
----------------------------------------------------------------------------
- [[source checkout]]
-
- a) Check out the source
-
- svn checkout http://svn.php.net/repository/phpdoc/modules/doc-en phpdoc
-
- Change 'doc-en' if you would like to check out a different language.
- The 'modules' directory contains 'svn externals' references, so the
- above actually checks out:
-
- svn checkout http://svn.php.net/repository/phpdoc/en/trunk phpdoc/en
- svn checkout http://svn.php.net/repository/phpdoc/doc-base/trunk phpdoc/doc-base
-
- Where en/ is contains the DocBook source files, and doc-base/ contains tools
- and resources used in all languages.
-
- [[edits]]
-
- a) Make the change. Use spaces not tabs. Be sure to carefully
- watch your whitespace!
-
- b) Look at your unified diff, make sure it looks right and that
- whitespace changes aren't mixed in:
-
- svn diff path/to/file.xml
-
- c) Make sure no errors are present, so at the command line in your
- phpdoc source directory run:
-
- php doc-base/configure.php
-
- Always 'php configure.php' before commit!
-
- d) Commit your changes
-
- svn commit path/to/file.xml
-
- Read the HOWTO for more information. After reading the HOWTO,
- email the phpdoc mailing list (phpdoc@lists.php.net) with questions
- and concerns.
-
- [[new functions]]
-
- a) Copy an existing xml file or use a skeleton from the HOWTO.
- Rename and place it into the appropriate directory.
-
- b) Edit. Be sure no leftover text exists. No tabs either.
-
- c) Now test locally before commit by first running
- (php configure.php)
-
- d) svn add path/to/yourfile.xml
-
- e) svn commit path/to/yourfile.xml
-
- Note that the version numbers are taken care of elsewhere (don't worry
- about them)
-
- [[some popular tags and entities]]
-
- filenames
- constants
- variables
- a function's parameter/argument
- functions, this links to function pages or bolds if
- already on the function's page. it also adds ().
-
- teletype/mono-space font
- italics
- see HOWTO, includes many other tags.
- internal manual links
- variables
-
- external links via global.ent
- mmm cookies
-
- types, this links to the given types manual
- page: object -> php.net/types.object
-
-
- &return.success; see: language-snippets.ent
- &true; TRUE
- &false; FALSE
- &php.ini; php.ini
-
- Be sure to check out globals.ent and language-snippets.ent for
- more information for entities and urls.
-
----------------------------------------------------------------------------
diff --git a/README.md b/README.md
new file mode 100644
index 00000000..0611b062
--- /dev/null
+++ b/README.md
@@ -0,0 +1,142 @@
+# Read Me
+
+## Read this first
+
+This directory contains source files and a setup for converting
+PHP's XML documentation into presentation formats like HTML and
+RTF. You should not have to bother with this unless you are
+writing documentation yourself, or if you simply are curious
+about how the XML stuff works.
+
+If you just want to read the documentation, look at: http://www.php.net/docs.php
+
+## How to write PHPDoc files
+
+If you are interested in information about how to
+set up the tools needed, how to work with Git and
+DocBook on Linux or Windows, or what conventions you
+should follow when writing phpdoc files, please refer
+to the PHP Documentation HOWTO.
+
+You can read the HOWTO online at http://doc.php.net/tutorial/
+
+If you are already working with the phpdoc module,
+then you can find its XML source in the howto directory
+of the module, and build it yourself with:
+
+```bash
+phd -d .manual.xml
+```
+
+However, PhD is a separate project which can be read about here: http://wiki.php.net/doc/phd
+
+## Quick Reference
+
+### Source checkout
+
+a. Fork the repository of the language you want to contribute to on [GitHub](https://github.com/phpdoctest)
+b. Check out the source
+
+ ```bash
+ git checkout git://github.com:[your github-username]/[language you want to contribute to].git
+ git remote add upstream https://github.com/phpdoctest/[language you want to contribute to].git
+ ```
+
+c. Check out the doc-base repository with the different tools
+
+ ```bash
+ git checkout https://github.com/phpdoctest/doc-base.git
+ ```
+
+That will leave you with a folder ```[language you want to contribute to]```
+which contains the source-files for the documentation and a folder ```doc-base```
+that contains the different tools and resources used in all languages.
+
+### Edits
+
+a. Bring everything up to date and create a new branch
+
+ ```
+ cd [language you want to contribute to]
+ git fetch upstream
+ git checkout -b [branchname] upstream/master
+ ```
+
+b. Make the change. Use spaces not tabs. Be sure to carefully watch your whitespace!
+c. Look at your unified diff, make sure it looks right and that whitespace changes aren't mixed in:
+
+ ```bash
+ git diff path/to/file.xml
+ ```
+
+d. Make sure no errors are present, so at the command line in your phpdoc source directory run:
+
+ ```bash
+ cd ..
+ php doc-base/configure.php
+ ```
+
+ Always ```php configure.php``` before commit!
+
+e. Commit your changes
+
+ ```
+ git add path/to/file.xml
+ git commit
+ git push origin branchname
+ ```
+
+f. Open a PullRequest on GitHub for your changes to be merged directly into the main repository.
+
+
+Read the HOWTO for more information. After reading the HOWTO, email the phpdoc
+mailing list (phpdoc@lists.php.net) with questions and concerns.
+
+### new functions
+
+ a) Copy an existing xml file or use a skeleton from the HOWTO.
+ Rename and place it into the appropriate directory.
+
+ b) Edit. Be sure no leftover text exists. No tabs either.
+
+ c) Now test locally before commit by first running
+ (php configure.php)
+
+ d) git add add path/to/yourfile.xml
+
+ e) git commit
+
+ Note that the version numbers are taken care of elsewhere (don't worry
+ about them)
+
+### some popular tags and entities
+
+ filenames
+ constants
+ variables
+ a function's parameter/argument
+ functions, this links to function pages or bolds if
+ already on the function's page. it also adds ().
+
+ teletype/mono-space font
+ italics
+ see HOWTO, includes many other tags.
+ internal manual links
+ variables
+
+ external links via global.ent
+ mmm cookies
+
+ types, this links to the given types manual
+ page: object -> php.net/types.object
+
+
+ &return.success; see: language-snippets.ent
+ &true; TRUE
+ &false; FALSE
+ &php.ini; php.ini
+
+ Be sure to check out globals.ent and language-snippets.ent for
+ more information for entities and urls.
+
+---------------------------------------------------------------------------
From 55874da981267e2b1dc5df09af8ce76260799afd Mon Sep 17 00:00:00 2001
From: Andreas Heigl
Date: Mon, 14 Aug 2017 22:23:58 +0200
Subject: [PATCH 02/12] Adapts scripts to git
---
TODO-GitTransfer | 0
configure.php | 27 ++++++++---------
scripts/revcheck.php | 61 +++++++++++++++++++++++++++++++++------
scripts/reviewedcheck.php | 9 +++---
4 files changed, 71 insertions(+), 26 deletions(-)
create mode 100644 TODO-GitTransfer
diff --git a/TODO-GitTransfer b/TODO-GitTransfer
new file mode 100644
index 00000000..e69de29b
diff --git a/configure.php b/configure.php
index 845ffcfa..a746070e 100755
--- a/configure.php
+++ b/configure.php
@@ -19,7 +19,7 @@
| Hannes Magnusson |
| Gwynne Raskind |
+----------------------------------------------------------------------+
-
+
$Id$
*/
@@ -31,7 +31,7 @@
function usage() // {{{
{
global $acd;
-
+
echo <<) [{$acd['PARTIAL']}]
- --disable-broken-file-listing Do not ignore translated files in
+ --disable-broken-file-listing Do not ignore translated files in
broken-files.txt
--redirect-stderr-to-stdout Redirect STDERR to STDOUT. Use STDOUT as the
standard output for XML errors [{$acd['STDERR_TO_STDOUT']}]
@@ -97,7 +97,7 @@ function is_windows() {
function checking($for) // {{{
{
global $ac;
-
+
if ($ac['quiet'] != 'yes') {
echo "Checking {$for}... ";
flush();
@@ -107,7 +107,7 @@ function checking($for) // {{{
function checkerror($msg) // {{{
{
global $ac;
-
+
if ($ac['quiet'] != 'yes') {
echo "\n";
}
@@ -118,7 +118,7 @@ function checkerror($msg) // {{{
function checkvalue($v) // {{{
{
global $ac;
-
+
if ($ac['quiet'] != 'yes') {
echo "{$v}\n";
}
@@ -315,7 +315,7 @@ function print_xml_errors($details = true) {
} else {
continue;
}
-
+
$overridden_settings[] = strtoupper($o);
switch ($o) {
case 'h':
@@ -399,7 +399,7 @@ function print_xml_errors($details = true) {
case 'basedir':
$ac['basedir'] = $v;
break;
-
+
case 'output':
$ac['OUTPUT_FILENAME'] = $v;
break;
@@ -414,7 +414,7 @@ function print_xml_errors($details = true) {
case 'stderr-to-stdout':
$ac['STDERR_TO_STDOUT'] = $v;
break;
-
+
case '':
break;
@@ -485,6 +485,8 @@ function print_xml_errors($details = true) {
if (file_exists("{$LANGDIR}/trunk")) {
$LANGDIR .= '/trunk';
}
+
+echo $LANGDIR;
if (!file_exists($LANGDIR) || !is_readable($LANGDIR)) {
checkerror("No language directory found.");
}
@@ -674,7 +676,7 @@ function print_xml_errors($details = true) {
echo "done.\n";
echo "Partial manual saved to {$filename}. To build it, run 'phd -d {$filename}'\n";
exit(0);
-} // }}}
+} // }}}
$mxml = $ac["OUTPUT_FILENAME"];
if ($dom->validate()) {
@@ -720,7 +722,7 @@ function print_xml_errors($details = true) {
echo "\nThe document didn't validate, ";
// Allow the .manual.xml file to be created, even if it is not valid.
- if ($ac['FORCE_DOM_SAVE'] == 'yes') {
+ if ($ac['FORCE_DOM_SAVE'] == 'yes') {
printf("writing %s anyway, and ", basename($ac["OUTPUT_FILENAME"]));
if ($ac["SEGFAULT_SPEED"] == "yes") {
$t = $dom->doctype;
@@ -755,4 +757,3 @@ function print_xml_errors($details = true) {
errors_are_bad(1); // Tell the shell that this script finished with an error.
}
?>
-
diff --git a/scripts/revcheck.php b/scripts/revcheck.php
index ed035506..9dadfa9b 100644
--- a/scripts/revcheck.php
+++ b/scripts/revcheck.php
@@ -52,7 +52,8 @@ functionality in the PHP Documentation Howto:
set_time_limit(0);
// A file is criticaly "outdated' if
-define("ALERT_REV", 10); // translation is 10 or more revisions behind the en one
+//define("ALERT_REV", 10); // translation is 10 or more revisions behind the en one
+define("ALERT_REV", 60); // translation is 60 days behind the en one
define("ALERT_SIZE", 3); // translation is 3 or more kB smaller than the en one
define("ALERT_DATE", -30); // translation is 30 or more days older than the en one
@@ -133,8 +134,12 @@ function init_files_by_maint($persons) {
// Grabs the revision tag and stores credits from the file given
function get_tags($file, $val = "en-rev") {
- // Read the first 500 chars. The comment should be at
+ global $LANG, $DOCDIR;
+ $basefile = substr($file, strlen($LANG) + 3);
+
+ // 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.");
$line = fread($fp, 500);
fclose($fp);
@@ -142,8 +147,10 @@ function get_tags($file, $val = "en-rev") {
// Check for English SVN revision tag (. is for $ in the preg!),
// Return if this was needed (it should be there)
if ($val == "en-rev") {
- preg_match("//", $line, $match);
- return $match[1];
+ // exec('cd ' . $DOCDIR . '/' . $LANG . ' && git log --pretty=format:"%h %at" ' . $basefile, $result, $output);
+ // return new DateTimeImmutable('@' . explode(' ', $result[0])[1]);
+ exec('cd ' . $DOCDIR . '/' . $LANG . ' && git log --pretty=format:"%h %at" ' . $basefile, $result, $output);
+ return new DateTimeImmutable('@' . explode(' ', $result[0])[1]);
}
// Handle credits (only if no maintainer is specified)
@@ -168,12 +175,22 @@ function get_tags($file, $val = "en-rev") {
$match = array();
// Check for the translations "revision tag"
- preg_match ("//U",
$line,
$match
);
+ // The tag with revision number is not found so search
+ // for anonymous ID revision comment (comment where revision is not known)
+ if (count($match) == 0) {
+ preg_match ("''U",
+ $line,
+ $match
+ );
+ }
+
// The tag with revision number is not found so search
// for n/a revision comment (comment where revision is not known)
if (count($match) == 0) {
@@ -184,6 +201,15 @@ function get_tags($file, $val = "en-rev") {
);
}
+ if (isset($match[1]) && $match[1] && $match[1] !== 'n/a') {
+ // We have a revision number of the english original and should now see to
+ // Get the last change date of that revision…
+ exec('cd ' . $DOCDIR . '/en && git log --pretty=format:"%h %at" ' . $basefile, $result, $output);
+
+ $match[1] = new DateTimeImmutable('@' . (explode(' ', $result[0]))[1]);
+
+ }
+
// Return with found revision info (number, maint, status)
return $match;
@@ -257,6 +283,9 @@ function get_file_status($file) {
// Distribute values in separate vars for further processing
list(, $this_rev, $this_maint, $this_status) = $trans_tag;
+ if ('n/a' === $this_rev) {
+ $this_rev = new DateTimeImmutable();
+ }
// Get English file revision
$en_rev = get_tags($file);
@@ -268,14 +297,21 @@ function get_file_status($file) {
} else {
// If we have no numeric revision, make all revision
// columns hold the rev from the translated file
- $rev_diff = $trans_rev = $this_rev;
+ $trans_rev = $this_rev;
+ $rev_diff = 0;
$en_rev = $en_rev;
}
// Compute times and diffs
$en_date = intval((time() - filemtime($file)) / 86400);
+ $en_date = (new DateTimeImmutable())->diff($en_rev)->days;
$trans_date = intval((time() - filemtime($trans_file)) / 86400);
+ $trans_date = (new DateTimeImmutable())->diff($this_rev)->days;
$date_diff = $en_date - $trans_date;
+ $date_diff = 0;
+ if ($trans_rev instanceof DateTimeInterface) {
+ $date_diff = $en_rev->diff($trans_rev)->days;
+ }
// If the file is up-to-date
if ($rev_diff === 0 && trim($this_status) === "ready") {
@@ -868,12 +904,13 @@ function parse_translation($DOCDIR, $LANG, $MAINT) {
'">' . $file["maintainer"] . '';
}
+ // FIXME: Is this diff necessary?
// If we have a 'numeric' revision diff and it is not zero,
// make a link to the SVN repository's diff script
if ($file["revision"][2] != "n/a" && $file["revision"][2] !== 0) {
$url = 'http://svn.php.net/viewvc/' .
- preg_replace( "'^".$DOCDIR."en/'", 'phpdoc/en/trunk/', $file['full_name']) .
- '?r1=' . $file['revision'][1] . '&r2=' . $file['revision'][0];
+ preg_replace( "'^".$DOCDIR."en/'", 'phpdoc/en/trunk/', $file['full_name']);
+ // '?r1=' . $file['revision'][1] . '&r2=' . $file['revision'][0];
$url_ws = $url . SVN_OPT_NOWS;
$url .= SVN_OPT;
@@ -902,6 +939,12 @@ function parse_translation($DOCDIR, $LANG, $MAINT) {
$display_dir = str_replace(array($DOCDIR."en/", $DOCDIR."en"), array("", '/'), dirname($file["full_name"]));
$prev_diplay_dir = "
$display_dir";
+ if ($file['revision'][0] instanceof DateTimeInterface) {
+ $file['revision'][0] = $file['revision'][0]->format('c');
+ }
+ if ($file['revision'][1] instanceof DateTimeInterface) {
+ $file['revision'][1] = $file['revision'][1]->format('c');
+ }
// Save the line for the current file (get file name shorter)
$lines .= "
\n";
diff --git a/scripts/reviewedcheck.php b/scripts/reviewedcheck.php
index 454fc7ef..041c0a9a 100644
--- a/scripts/reviewedcheck.php
+++ b/scripts/reviewedcheck.php
@@ -14,7 +14,7 @@
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
- | Authors: Yannick Torrès
+ | Authors: Yannick Torrès
+----------------------------------------------------------------------+
$Id$
@@ -34,7 +34,7 @@
If you specify >, the output is an html file.
- Authors: Yannick Torrès
+ Authors: Yannick Torrès File without tag | Files with Reviewed\'tags to No