]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-18208: Make xmldb give sensible error if you try to generate documentation withou...
authorsam_marshall <sam_marshall>
Tue, 17 Feb 2009 12:53:51 +0000 (12:53 +0000)
committersam_marshall <sam_marshall>
Tue, 17 Feb 2009 12:53:51 +0000 (12:53 +0000)
admin/xmldb/actions/generate_documentation/generate_documentation.class.php
lang/en_utf8/xmldb.php

index f733d0ec211aa9b45d8dd61517784b15dd3f3c10..f45dcb6b6193b4335cc85f60d1fb8c54ca66067e 100644 (file)
@@ -74,16 +74,20 @@ class generate_documentation extends XMLDBAction {
         $b .= '</p>';
         $this->output=$b;
         
-    /// Transform XML file and display it
-        $doc = new DOMDocument();
-        $xsl = new XSLTProcessor();
-        
-        $doc->load(dirname(__FILE__).'/xmldb.xsl');
-        $xsl->importStyleSheet($doc);
-        
-        $doc->load($path);                        
-        $this->output.=$xsl->transformToXML($doc);
-        $this->output.=$b;            
+        if(class_exists('XSLTProcessor')) {
+        /// Transform XML file and display it
+            $doc = new DOMDocument();
+            $xsl = new XSLTProcessor();
+            
+            $doc->load(dirname(__FILE__).'/xmldb.xsl');
+            $xsl->importStyleSheet($doc);
+            
+            $doc->load($path);
+            $this->output.=$xsl->transformToXML($doc);
+            $this->output.=$b;
+        } else {
+            $this->output.=get_string('extensionrequired','xmldb','xsl');
+        }
 
     /// Launch postaction if exists (leave this unmodified)
         if ($this->getPostAction() && $result) {
index c2b87ffe20af47dd52668f49f0ee2e8c331916ca..1413852738805b94602b4f6371521d9895ec7d19 100644 (file)
@@ -67,6 +67,7 @@ $string['edit_table'] = 'Edit Table';
 $string['edit_xml_file'] = 'Edit XML File';
 $string['enumvaluesincorrect'] = 'Incorrect values for enum field';
 $string['expected'] = 'Expected';
+$string['extensionrequired'] = 'Sorry - the PHP extension \'$a\' is required for this action. Please install the extension if you want to use this feature.';
 $string['field'] = 'Field';
 $string['fieldnameempty'] = 'Name field empty';
 $string['fields'] = 'Fields';