Permalink
Browse files

Displays file permissions for mimetex and uses md5_file if available

  • Loading branch information...
1 parent 0f87cb1 commit e072c85e653a9217dce9ebbe7bee34c41102d882 fiedorow committed Feb 23, 2004
Showing with 18 additions and 8 deletions.
  1. +9 −4 filter/algebra/algebradebug.php
  2. +9 −4 filter/tex/texdebug.php
@@ -236,10 +236,15 @@ function tex2image($texexp, $md5) {
}
if (file_exists($commandpath)) {
echo "File size of mimetex executable $commandpath is " . filesize($commandpath) . "<br>";
- $handle = fopen($commandpath,"rb");
- $contents = fread($handle,16384);
- fclose($handle);
- echo "The md5 checksum of the first 16384 bytes is " . md5($contents) . "<br>";
+ echo "The file permissions are: " . decoct(fileperms($commandpath)) . "<br>";
+ if (function_exists("md5_file")) {
+ echo "The md5 checksum of the file is " . md5_file($commandpath) . "<br>";
+ } else {
+ $handle = fopen($commandpath,"rb");
+ $contents = fread($handle,16384);
+ fclose($handle);
+ echo "The md5 checksum of the first 16384 bytes is " . md5($contents) . "<br>";
+ }
} else {
echo "mimetex executable $commandpath not found!<br>";
}
View
@@ -147,10 +147,15 @@ function tex2image($texexp) {
}
if (file_exists($commandpath)) {
echo "File size of mimetex executable $commandpath is " . filesize($commandpath) . "<br>";
- $handle = fopen($commandpath,"rb");
- $contents = fread($handle,16384);
- fclose($handle);
- echo "The md5 checksum of the first 16384 bytes is " . md5($contents) . "<br>";
+ echo "The file permissions are: " . decoct(fileperms($commandpath)) . "<br>";
+ if (function_exists("md5_file")) {
+ echo "The md5 checksum of the file is " . md5_file($commandpath) . "<br>";
+ } else {
+ $handle = fopen($commandpath,"rb");
+ $contents = fread($handle,16384);
+ fclose($handle);
+ echo "The md5 checksum of the first 16384 bytes is " . md5($contents) . "<br>";
+ }
} else {
echo "mimetex executable $commandpath not found!<br>";
}

0 comments on commit e072c85

Please sign in to comment.