]> git.mjollnir.org Git - moodle.git/commitdiff
Displays file permissions for mimetex and uses md5_file if available
authorfiedorow <fiedorow>
Mon, 23 Feb 2004 18:48:55 +0000 (18:48 +0000)
committerfiedorow <fiedorow>
Mon, 23 Feb 2004 18:48:55 +0000 (18:48 +0000)
filter/algebra/algebradebug.php
filter/tex/texdebug.php

index ddbe11f8e204a57c04f8d66004e846e717468173..caff0f6311596194dd902ddaf043a55930756683 100644 (file)
@@ -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>";
            }
index 32426976589bc8c7ce8d130c1e8358f5e3f1bbc7..13b846421ce09dca0420f653f0a71e0b4cef199e 100644 (file)
@@ -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>";
            }