[prev in list] [next in list] [prev in thread] [next in thread]
List: php-doc-cvs
Subject: [DOC-CVS] [doc-base] master: Create QA folder within scripts (#30)
From: George Peter Banyard via GitHub <noreply () php ! net>
Date: 2021-05-31 23:13:32
Message-ID: VqFGF0sOr5vxAgVqgsPLLFRND2YWXZCPCdkmOhGgQ () main ! php ! net
[Download RAW message or body]
Author: George Peter Banyard (Girgias)
Committer: GitHub (web-flow)
Pusher: Girgias
Date: 2021-06-01T00:13:47+01:00
Commit: https://github.com/php/doc-base/commit/0477c1494843e062a3fbb7aaf0a4d65565cd5f60
Raw diff: https://github.com/php/doc-base/commit/0477c1494843e062a3fbb7aaf0a4d65565cd5f60.diff
Create QA folder within scripts (#30)
This moves various QA scripts from the 'scripts/' folder into 'scripts/qa/'.
Refactored some of them to make them more useful/up to scratch for PHP 8.
There are probably still some within the scripts base folder but this should be a \
good start.
Ideally, at one point we would be able to run some of these scripts in CI to ensure \
the quality of the docs.
Changed paths:
A scripts/qa/check-acronyms.php
A scripts/qa/check-grammar.php
A scripts/qa/check-missing-initializers.php
A scripts/qa/check-valid-function.php
A scripts/qa/checkent.php
A scripts/qa/entities.php
A scripts/qa/entity-usage.php
A scripts/qa/extensions.xml.php
D scripts/check-acronyms.php
D scripts/check-grammar.php
D scripts/check-missing-initializers.php
D scripts/check-valid-function.php
D scripts/checkent.php
D scripts/entities.php
D scripts/entity-usage.php
D scripts/extensions.xml.php
M README.md
Diff:
diff --git a/README.md b/README.md
index 721dcaea..e2f0d592 100644
--- a/README.md
+++ b/README.md
@@ -134,3 +134,12 @@ and concerns.
Be sure to check out [global.ent](entities/global.ent) and
language-snippets.ent (located within each language's repo) for
more information for entities and URLs.
+
+# Quality Assurance Tools (QA Tools)
+
+There are various scripts available to ensure the quality of the documentation
+and find issues with it, they are located in the `scripts/qa/` directory.
+
+There might be some more just in `scripts/` but they need to be checked if they
+are still relevant and/or given some love.
+
diff --git a/scripts/check-valid-function.php b/scripts/check-valid-function.php
deleted file mode 100644
index e3ae5c93..00000000
--- a/scripts/check-valid-function.php
+++ /dev/null
@@ -1,102 +0,0 @@
-<?php
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2011 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 |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Dave Barr <dave@php.net> |
- +----------------------------------------------------------------------+
- | Description: This file parses the manual and outputs all erroneous |
- | <function> tag usage. |
- +----------------------------------------------------------------------+
-
-*/
-
-/* path to phpdoc CVS checkout. if this file is in the scripts/ directory
- * then the value below will be correct!
- */
-$phpdoc = '../';
-
-/* english! */
-$lang = 'en';
-
-/* initialize array and declare some language constructs */
-$funcs = array( 'include' => true,
- 'include_once' => true,
- 'require' => true,
- 'require_once' => true,
- 'return' => true,
- );
-
-$total = 0;
-
-/* recursive glob() with a callback function */
-function globbetyglob($globber, $userfunc)
-{
- foreach (glob("$globber/*") as $file) {
- if (is_dir($file)) {
- globbetyglob($file, $userfunc);
- }
- else {
- call_user_func($userfunc, $file);
- }
- }
-}
-
-/* make a function list from files in the functions/ directories */
-function make_func_list($file)
-{
- global $funcs;
-
- if (fnmatch("*/reference/*/functions/*.xml", $file)) {
- $func = strtolower(str_replace(array('-', '.'), '_', substr(basename($file), \
0, -4)));
- $funcs[$func] = true;
- }
-}
-
-/* find all <function> tags and report invalid functions */
-function parse_file($file)
-{
- global $funcs, $phpdoc, $lang, $total;
-
- /* ignore old functions directory */
- if (fnmatch("$phpdoc/$lang/functions/*", $file))
- return;
-
- $f = file_get_contents($file);
-
- if ($f != '') {
- if (preg_match_all('|<function>(.*?)</function>|s', $f, $m)
- && is_array($m)
- && is_array($m[1]))
- {
- foreach ($m[1] as $func) {
- $func = strtolower(str_replace(array('::', '->'), '_', \
trim($func)));
- if ($funcs[$func] !== true) {
- $total++;
- $fileout = substr($file, strlen($phpdoc) + 1);
-
- printf("%-60.60s <function>$func</function>\n", $fileout);
- }
- }
- }
- }
-}
-
-echo "Building a list of functions...\n";
-globbetyglob("$phpdoc/$lang", 'make_func_list');
-echo 'List complete. ' . count($funcs) . " functions.\n";
-
-echo "Checking the manual for <function> tags that contain invalid functions...\n";
-globbetyglob("$phpdoc/$lang", 'parse_file');
-echo "Found $total occurrences.\n";
-?>
diff --git a/scripts/check-acronyms.php b/scripts/qa/check-acronyms.php
similarity index 100%
rename from scripts/check-acronyms.php
rename to scripts/qa/check-acronyms.php
diff --git a/scripts/check-grammar.php b/scripts/qa/check-grammar.php
similarity index 98%
rename from scripts/check-grammar.php
rename to scripts/qa/check-grammar.php
index 87699436..efaa4d72 100644
--- a/scripts/check-grammar.php
+++ b/scripts/qa/check-grammar.php
@@ -66,7 +66,7 @@
/*** Duplicate words ******************************************/
// @todo improve output
if (in_array($type, array('a', 'd'))) {
- if (preg_match_all('/\b(\w+)\s+\1\b/i', implode($lines, "\n"), $matches)) {
+ if (preg_match_all('/\b(\w+)\s+\1\b/i', implode("\n", $lines), $matches)) {
if ($matches) {
$dups = array();
foreach ($matches[1] as $key => $match) {
diff --git a/scripts/check-missing-initializers.php \
b/scripts/qa/check-missing-initializers.php similarity index 100%
rename from scripts/check-missing-initializers.php
rename to scripts/qa/check-missing-initializers.php
diff --git a/scripts/qa/check-valid-function.php \
b/scripts/qa/check-valid-function.php new file mode 100644
index 00000000..bc675466
--- /dev/null
+++ b/scripts/qa/check-valid-function.php
@@ -0,0 +1,110 @@
+<?php
+/*
+ +----------------------------------------------------------------------+
+ | PHP Version 8 |
+ +----------------------------------------------------------------------+
+ | Copyright (c) 1997-2021 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 |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_0.txt. |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Dave Barr <dave@php.net> |
+ | George Peter Banyard <girgias@php.net> |
+ +----------------------------------------------------------------------+
+ | Description: This file parses the manual and outputs all erroneous |
+ | <function> tag usage. |
+ +----------------------------------------------------------------------+
+
+*/
+
+/** TODO
+ * - Handle Class and methods
+ */
+
+/* Path to the root of EN extension reference tree */
+$doc_en_root = dirname(__DIR__, 3) . '/en/reference';
+
+$total = 0;
+
+/* make a function list from files in the functions/ directories */
+function make_func_list(string $lang_doc_root): array
+{
+ /* initialize array and declare some language constructs */
+ $functions = [
+ 'include' => true,
+ 'include_once' => true,
+ 'require' => true,
+ 'require_once' => true,
+ 'return' => true,
+ ];
+
+ foreach (new DirectoryIterator($lang_doc_root) as $extensions) {
+ if ($extensions->isDot() || !$extensions->isDir() || \
!$extensions->isReadable()) { + continue;
+ }
+
+ foreach (new DirectoryIterator($extensions->getPathname()) as $extension) {
+ if ($extension->isDot() || !$extension->isDir() || \
!$extension->isReadable()) { + continue;
+ }
+ if ($extension->getFilename() !== 'functions') {
+ continue;
+ }
+
+ foreach (new DirectoryIterator($extension->getPathname()) as $file) {
+ if ($file->isDot() || !$file->isReadable()) {
+ continue;
+ }
+ $function = str_replace(['-', '.'], '_', \
$file->getBasename('.xml')); + $functions[$function] = true;
+ }
+ }
+ }
+
+ return $functions;
+}
+
+echo "Building a list of functions...\n";
+$functions = make_func_list($doc_en_root);
+
+echo 'List complete. ' . count($functions) . " functions.\n";
+
+echo "Checking the manual for <function> tags that contain invalid functions...\n";
+foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($doc_en_root)) \
as $file) { + if ($file->isDir() || !$file->isReadable()) {
+ continue;
+ }
+
+ $name = $file->getBasename();
+ $path = $file->getPathname();
+ $contents = file_get_contents($path);
+
+ if ($contents == '') {
+ continue;
+ }
+
+ if (preg_match_all('|<function>(.*?)</function>|s', $contents, $m)
+ && is_array($m)
+ && is_array($m[1]))
+ {
+ foreach ($m[1] as $func) {
+ //$func = strtolower(str_replace(array('::', '->'), '_', trim($func)));
+ $func = trim($func);
+
+ if (!\array_key_exists($func, $functions)) {
+ $total++;
+ $fileout = substr($file, strlen($doc_en_root) + 1);
+
+ printf("%-60.60s <function>$func</function>\n", $fileout);
+ }
+ }
+ }
+}
+echo "Found $total occurrences.\n";
+
+exit((bool) $total);
diff --git a/scripts/checkent.php b/scripts/qa/checkent.php
similarity index 96%
rename from scripts/checkent.php
rename to scripts/qa/checkent.php
index 762c4485..919070ef 100644
--- a/scripts/checkent.php
+++ b/scripts/qa/checkent.php
@@ -47,8 +47,8 @@
// Schemes we had to check
$schemes = array("http", "ftp");
-// Start this script only from the scripts dir
-$filename = "../entities/global.ent";
+// Start this script only from the scripts/qa dir
+$filename = dirname(__DIR__, 2) . "/entities/global.ent";
// Read in the file, or die
$file_string = file_get_contents($filename);
@@ -108,7 +108,7 @@
if ($ftp = @ftp_connect($url["host"])) {
if (@ftp_login($ftp, "anonymous", "georg@php.net")) {
$flist = ftp_nlist($ftp, $url["path"]);
- if (!count($flist)) {
+ if ($flist === false || !count($flist)) {
errormsg($entity, "unknown path: " . $url["path"] . " \
for ftp host: " . $url['host']); }
} else {
diff --git a/scripts/entities.php b/scripts/qa/entities.php
similarity index 80%
rename from scripts/entities.php
rename to scripts/qa/entities.php
index fce062c5..20b47527 100644
--- a/scripts/entities.php
+++ b/scripts/qa/entities.php
@@ -2,9 +2,9 @@
<?php
/*
+----------------------------------------------------------------------+
- | PHP Version 4 |
+ | PHP Version 8 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2011 The PHP Group |
+ | Copyright (c) 1997-2021 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,6 +15,7 @@
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Gabor Hojtsy <goba@php.net> |
+ | George Peter Banyard <girgias@php.net> |
+----------------------------------------------------------------------+
$Id$
@@ -31,10 +32,10 @@
<entity-file> must be a file name (with relative
path from the phpdoc root) to a file containing
- <!ENTITY...> definitions. Defaults to doc-base/entities/global.ent.
+ <!ENTITY...> definitions. Defaults to 'base/entities/global.ent' and \
'en/language-snippets.ent'.
<language-code> must be a valid language code used in the repository, or
- 'all' for all languages. Defaults to en.
+ 'all' for all languages. Defaults to 'all'.
The script will generate an entity_usage.txt
file, containing the entities defined in the
@@ -46,7 +47,7 @@
// CONFIG SECTION
// Main directory of the PHP documentation (two directories up in the structure)
-$docdir = realpath(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . \
'..') . DIRECTORY_SEPARATOR; +$docdir = dirname(__DIR__, 3) . DIRECTORY_SEPARATOR;
/*********************************************************************/
/* Nothing to modify below this line */
@@ -56,24 +57,34 @@
set_time_limit(0);
// Array to collect the entities
-$defined_entities = array();
+$defined_entities = [];
// Default values
-$langcodes = array("en");
-$filename = "doc-base/entities/global.ent";
+$langcodes = [
+ 'de',
+ 'en',
+ 'es',
+ 'fr',
+ 'it',
+ 'ja',
+ 'pl',
+ 'pt_br',
+ 'ro',
+ 'ru',
+ 'tr',
+ 'zh'
+];
+$files = ['base/entities/global.ent', 'en/language-snippets.ent'];
// Parameter value copying
-if ($argc == 3) {
- $langcodes = array($argv[2]);
- if ($argv[2] === 'all') {
- $langcodes = array("ar", "cs", "de", "en", "es", "fr",
- "hk", "hu", "it", "ja", "kr", "nl",
- "pl", "pt_BR", "ru", "tr", "tw");
+if ($argc == 3) {
+ if ($argv[2] !== 'all') {
+ $langcodes = [$argv[2]];
}
}
if ($argc >= 2) {
- $filename = $argv[1];
+ $files = [$argv[1]];
}
/*********************************************************************/
@@ -96,20 +107,22 @@ function extract_entity_definitions ($filename, &$entities)
// Convert to hash
foreach ($entities_found as $entity_name) {
- $entities[$entity_name] = array();
+ $entities[$entity_name] = [];
}
+} // extract_entity_definitions() function end
- // Return with a useful regexp part
+function entities_list_to_regex(array $entities): string
+{
+ $entities_found = array_keys($entities);
return "&(" . join("|", $entities_found) . ");";
-
-} // extract_entity_definitions() function end
+}
-// Checks a diretory of phpdoc XML files
+// Checks a directory of phpdoc XML files
function check_dir($dir, &$defined_entities, $entity_regexp)
{
- // Collect files and diretcories in these arrays
- $directories = array();
- $files = array();
+ // Collect files and directories in these arrays
+ $directories = [];
+ $files = [];
// Open and traverse the directory
$handle = @opendir($dir);
@@ -165,9 +178,16 @@ function check_file ($filename, &$defined_entities, \
$entity_regexp) /*********************************************************************/
// Get entity definitions
-$entity_regexp = extract_entity_definitions($docdir . $filename, $defined_entities);
+foreach ($files as $file) {
+ echo "Registering entities defined in '$file'\n";
+ extract_entity_definitions($docdir . $file, $defined_entities);
+}
+
+echo "Found " . count($defined_entities) . " entities to check \n";
+
+$entity_regexp = entities_list_to_regex($defined_entities);
-// Chechking all languages
+// Checking all languages
foreach ($langcodes as $langcode) {
// Check for directory validity
@@ -189,17 +209,17 @@ function check_file ($filename, &$defined_entities, \
$entity_regexp) echo "Generating entity_usage.txt ...\n";
$fp = fopen("entity_usage.txt", "w");
-fwrite($fp, "ENTITY USAGE STATISCTICS
+fwrite($fp, "ENTITY USAGE STATISTICS
=========================================================
In this file you can find entity usage stats compiled
-from the entity file: $filename. The entity usage
+from the entity file: $file. The entity usage
was tested in the following tree[s] at phpdoc:\n" .
join(", ", $tested_trees) . ".
You may find many unused entities here. Please do
not delete the entities, unless you make sure, no
-translation makes use of the entity. The purpouse
+translation makes use of the entity. The purpose
of this statistics is to reduce the number of unused
entities in phpdoc. Here comes the numbers and file
names:
diff --git a/scripts/entity-usage.php b/scripts/qa/entity-usage.php
similarity index 83%
rename from scripts/entity-usage.php
rename to scripts/qa/entity-usage.php
index b3f8f706..e491d986 100755
--- a/scripts/entity-usage.php
+++ b/scripts/qa/entity-usage.php
@@ -2,9 +2,9 @@
<?php
/*
+----------------------------------------------------------------------+
- | PHP Version 4 |
+ | PHP Version 8 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2011 The PHP Group |
+ | Copyright (c) 1997-2021 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,6 +15,7 @@
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Nuno Lopes <nlopess@php.net> |
+ | George Peter Banyard <girgias@php.net> |
+----------------------------------------------------------------------+
$Id$
@@ -31,14 +32,15 @@
<entity> is the entity you want to search.
<language-code> must be a valid language code used in the repository, or
- 'all' for all languages. Defaults to en.
+ 'all' for all languages. Defaults to 'all'.
<?php
exit;
}
// CONFIG SECTION
-$docdir = "../../"; // Main directory of the PHP documentation (one dir up in cvs)
+// Main directory of the PHP documentation (two directories up in the structure)
+$docdir = dirname(__DIR__, 3) . DIRECTORY_SEPARATOR;
/*********************************************************************/
/* Nothing to modify below this line */
@@ -50,16 +52,25 @@
set_time_limit(0);
// Default values
-$langcodes = array("en");
+$langcodes = [
+ 'de',
+ 'en',
+ 'es',
+ 'fr',
+ 'it',
+ 'ja',
+ 'pl',
+ 'pt_br',
+ 'ro',
+ 'ru',
+ 'tr',
+ 'zh'
+];
// Parameter value copying
-if ($argc == 3) {
- $langcodes = array($argv[2]);
- if ($argv[2] === 'all') {
- $langcodes = array("ar", "cs", "de", "el", "en", "es", "fi",
- "fr", "he", "hk", "hu", "it", "ja", "kr",
- "lt", "nl", "pt", "pl", "pt_BR", "ro",
- "ru", "sk", "sl", "sv", "tr", "tw", "zh");
+if ($argc == 3) {
+ if ($argv[2] !== 'all') {
+ $langcodes = [$argv[2]];
}
}
@@ -67,12 +78,12 @@
/* Here starts the functions part */
/*********************************************************************/
-// Checks a diretory of phpdoc XML files
+// Checks a directory of phpdoc XML files
function check_dir($dir, $entity)
{
- // Collect files and diretcories in these arrays
- $directories = array();
- $files = array();
+ // Collect files and directories in these arrays
+ $directories = [];
+ $files = [];
// Skip old and unused functions directories (theoretically
// it should only be in the English tree, but we are smart
@@ -131,7 +142,7 @@ function check_file ($filename, $entity)
/* Here starts the program */
/*********************************************************************/
-// Chechking all languages
+// Checking all languages
foreach ($langcodes as $langcode) {
$usage = 0;
@@ -153,5 +164,3 @@ function check_file ($filename, $entity)
}
echo "Done!\n";
-
-?>
diff --git a/scripts/extensions.xml.php b/scripts/qa/extensions.xml.php
similarity index 68%
rename from scripts/extensions.xml.php
rename to scripts/qa/extensions.xml.php
index d2b0fe87..20179e17 100755
--- a/scripts/extensions.xml.php
+++ b/scripts/qa/extensions.xml.php
@@ -1,9 +1,10 @@
+#!/usr/bin/php -q
<?php
/*
+----------------------------------------------------------------------+
| PHP Documentation |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2011 The PHP Group |
+ | Copyright (c) 1997-2021 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 |
@@ -14,25 +15,38 @@
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Nuno Lopes <nlopess@php.net> |
+ | George Peter Banyard <girgias@php.net> |
+ +----------------------------------------------------------------------+
+ | Description: This file parses the manual to find all documented |
+ | extensions, and create the extension reference page by |
+ using its membership status and state. |
+ | Also used in CI to check the file is up to date |
+----------------------------------------------------------------------+
-
- $Id$
*/
-/*
- This script updates the appendices/extensions.xml file automatically based
- on the tags placed in the 'reference.xml' files:
-<?phpdoc extension-membership="core, bundled, bundledexternal" ?>
-<!-- State: deprecated, experimental -->
-
- --- NOTE: PHP >= 5.2 needed ---
+/**
+ * This script updates the appendices/extensions.xml file automatically based on
+ * the tags placed in the 'book.xml' (and 'reference.xml' for pdo drivers) files:
+<?phpdoc extension-membership="(core|bundled|bundledexternal|pecl)" ?>
+<!-- State: (deprecated|experimental) -->
*/
-$basedir = realpath(dirname(__FILE__) . '/../..');
-$files = array_merge(glob("$basedir/en/reference/*/book.xml"), \
glob("$basedir/en/reference/pdo_*/reference.xml")); +$checkFile = false;
+
+$opts = getopt('c', ['check']);
+if (array_key_exists('c', $opts) || array_key_exists('check', $opts)) {
+ $checkFile = true;
+}
+
+
+$basedir = dirname(__DIR__, 3);
+$files = array_merge(
+ glob("$basedir/en/reference/*/book.xml"),
+ glob("$basedir/en/reference/pdo_*/reference.xml"),
+);
sort($files);
-$Membership = $State = $Alphabetical = $debug = array();
+$Membership = $State = $Alphabetical = $debug = [];
// read the files and save the tags' info
foreach ($files as $filename) {
@@ -49,12 +63,16 @@
}
$Alphabetical['alphabetical'][$ext] = 1;
- $m = 'pecl';
+ $m = '';
if (preg_match('/<\?phpdoc extension-membership="([^"]+)" *\?>/S', $file, $match)) \
{ $m = $match[1];
}
switch($m) {
+ case '':
+ $debug['membership'][] = $ext;
+ // Add to PECL as a fallback
+ $Membership['pecl'][$ext] = 1;
case 'bundledexternal':
$Membership['external'][$ext] = 1;
break;
@@ -74,11 +92,16 @@
$xml = file_get_contents("$basedir/en/appendices/extensions.xml");
+
+if ($checkFile) {
+ $originalXml = $xml;
+}
+
// little hack to avoid loosing the entities
$xml = preg_replace('/&([^;]+);/', PHP_EOL.'<!--'.PHP_EOL.'entity: \
"$1"'.PHP_EOL.'-->'.PHP_EOL, $xml);
-$simplexml = simplexml_load_string($xml);
+$simplexml = simplexml_load_string($xml);
foreach ($simplexml->children() as $node) {
@@ -91,7 +114,7 @@
$tmp = $$section;
- // we can get here as a father of 2 levels childs
+ // we can get here as a father of 2 levels children
if (empty($tmp[$topname])) continue;
$topnode->itemizedlist = PHP_EOL; // clean the list
@@ -120,11 +143,18 @@
$xml = strtr(html_entity_decode($simplexml->asXML()), array("\r\n" => PHP_EOL, "\r" \
=> PHP_EOL, "\n" => PHP_EOL)); // get the entities back again
$xml = preg_replace('/( *)[\r\n]*<!--\s+entity: "([^"]+)"\s+-->[\r\n]*/', \
'$1&$2;'.PHP_EOL.PHP_EOL, $xml);
-file_put_contents("$basedir/en/appendices/extensions.xml", $xml);
+if ($checkFile) {
+ if ($xml !== $originalXml) {
+ echo 'appendices/extensions.xml is not up to date.', \PHP_EOL;
+ exit(1);
+ }
+} else {
+ file_put_contents("$basedir/en/appendices/extensions.xml", $xml);
+ echo "{$basedir}/en/appendices/extensions.xml has been updated, check it for \
details\n"; +}
// print the debug messages:
-
if (isset($debug['membership'])) {
echo "\nExtensions Missing Membership:\n";
print_r($debug['membership']);
@@ -139,10 +169,3 @@
echo "\nExtensions with unknown extension title:\n";
print_r($debug['unknown-extension']);
}
-
-if (empty($debug)) {
- echo "Success: Check {$basedir}/en/appendices/extensions.xml for details\n";
-}
-
-
-?>
--
PHP Documentation Commits Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic