cvs: php-gtk-doc /scripts check-language-defs.ent.php
| From: | Christian Weiske | Date: | Tue, 03 Aug 2004 14:10:42 +0000 |
| Subject: | cvs: php-gtk-doc /scripts check-language-defs.ent.php | ||
| Groups: | php.gtk.doc | ||
| Request: | Send a blank email to php-gtk-doc+get-1061@lists.php.net to get a copy of this message | ||
cweiske Tue Aug 3 10:10:42 2004 EDT
Added files:
/php-gtk-doc/scripts check-language-defs.ent.php
Log:
Small script which checks if all the language-defs.ent contain
the same entities
http://cvs.php.net/co.php/php-gtk-doc/scripts/check-language-defs.ent.php?r=1.1&p=1
Index: php-gtk-doc/scripts/check-language-defs.ent.php
+++ php-gtk-doc/scripts/check-language-defs.ent.php
<?php
/**
* checks if the "language-defs.ent" files are in sync
*/
//go through all dirs
$hdlDir = opendir( '.');
$arEntities = array();
$arAllEntities = array();
while( $strFile = readdir( $hdlDir))
{
if( is_dir( $strFile) && $strFile[0] != '.') {
$strFullFile = $strFile . '/' . 'language-defs.ent';
if( file_exists( $strFullFile)) {
$strContents = file_get_contents( $strFullFile);
$arMatches = array();
preg_match_all( '|<!ENTITY\\s([a-zA-Z0-9]+)|', $strContents, $arMatches);
$arEntities[$strFullFile] = $arMatches[1];
$arAllEntities = array_merge( $arAllEntities, $arEntities[$strFullFile]);
}
}//is_dir
}//while all files
if( count( $arEntities) == 0) {
echo 'No "language-defs.ent" files were found in subfolders.' .
"\r\n";
echo 'Please run the script in the php-gtk-doc directory' . "\r\n";
exit( 1);
}
$arAllEntities = array_unique( $arAllEntities);
//now walk through all files and do a diff
foreach( $arEntities as $strFile => $arFileEntities) {
$arMissing = array_diff( $arAllEntities, $arFileEntities);
if( count( $arMissing) == 0) {
echo 'ok ' . $strFile . "\r\n";
} else {
echo 'missing: ' . implode( ', ' , $arMissing) . ' in ' . $strFile .
"\r\n";
}
}
//echo "check done\r\n";
?>