RE: [PHP-GTK-DOC] cvs: php-gtk-doc /scripts check-language-defs.ent.php
| From: | Steph | Date: | Tue, 03 Aug 2004 14:28:47 +0000 |
| Subject: | RE: [PHP-GTK-DOC] cvs: php-gtk-doc /scripts check-language-defs.ent.php | ||
| References: | 1 | Groups: | php.gtk.doc |
| Request: | Send a blank email to php-gtk-doc+get-1062@lists.php.net to get a copy of this message | ||
good thinking :)
> -----Original Message-----
> From: Christian Weiske [mailto:cweiske@php.net]
> Sent: 03 August 2004 15:11
> To: php-gtk-doc@lists.php.net
> Subject: [PHP-GTK-DOC] cvs: php-gtk-doc /scripts
> check-language-defs.ent.php
>
>
> 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";
> ?>
>
> --
> PHP-GTK Documentation Mailing List (http://gtk.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>