Przeglądaj źródła

Adding error reporting routines, by popular demand. :)

graf25 23 lat temu
rodzic
commit
6423057244

+ 16 - 1
plugins/squirrelspell/modules/check_me.mod

@@ -101,12 +101,27 @@ fclose($fp);
 /**
  * Execute ispell/aspell and catch the output.
  */
-exec("cat $floc | $sqspell_command", $sqspell_output);
+exec("cat $floc | $sqspell_command 2>&1", $sqspell_output, $sqspell_exitcode);
 /**
  * Remove the temp file.
  */
 unlink($floc);
 
+/**
+ * Check if the execution was successful. Bail out if it wasn't.
+ */
+if ($sqspell_exitcode){
+  $msg= "<div align='center'>"
+     . sprintf(_("I tried to execute '%s', but it returned:"),
+               $sqspell_command) . "<pre>"
+     . nl2br(join("\n", $sqspell_output)) . "</pre>"
+     . "<form onsubmit=\"return false\">"
+     . "<input type=\"submit\" value=\"  " . _("Close")
+     . "  \" onclick=\"self.close()\"></form></div>";
+  sqspell_makeWindow(null, _("SquirrelSpell is misconfigured."), null, $msg);
+  exit;
+}
+
 /**
  * Load the user dictionary.
  */

+ 1 - 1
plugins/squirrelspell/sqspell_functions.php

@@ -513,5 +513,5 @@ function sqspell_ckMOD($rMOD){
  * of the user dictionary files and messing with this can do ugly 
  * stuff. :)
  */
-$SQSPELL_VERSION="v0.3.7";
+$SQSPELL_VERSION="v0.3.8";
 ?>