From: mjollnir_ Date: Fri, 20 Apr 2007 00:10:52 +0000 (+0000) Subject: xmldb: added $CFG options for disabling next / previous value checkings & enforced... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=c68e9d06f68719f097035cc96544aa7918af702e;p=moodle.git xmldb: added $CFG options for disabling next / previous value checkings & enforced comment checking. merged from mahara :) --- diff --git a/config-dist.php b/config-dist.php index 86d15ea0bd..a28282ebc1 100644 --- a/config-dist.php +++ b/config-dist.php @@ -281,7 +281,12 @@ $CFG->admin = 'admin'; // $CFG->allowvisiblecoursesinhiddencategories = true; // // NOTE: if you are using custompix in your theme, see /fixpix.php. - +// +// special magic evil developer only wanting to edit the xmldb files manually +// uncomment these if you're lazy like Penny +// $CFG->xmldbdisablecommentchecking = true; +// $CFG->xmldbdisablenextprevchecking = true; +// //========================================================================= // ALL DONE! To continue installation, visit your main page with a browser //========================================================================= diff --git a/lib/xmldb/classes/XMLDBObject.class.php b/lib/xmldb/classes/XMLDBObject.class.php index 10a90b971a..4aec0d87a7 100644 --- a/lib/xmldb/classes/XMLDBObject.class.php +++ b/lib/xmldb/classes/XMLDBObject.class.php @@ -194,6 +194,10 @@ class XMLDBObject { * have a consistent info in their previous/next fields */ function checkPreviousNextValues(&$arr) { + global $CFG; + if (!empty($CFG->xmldbdisablenextprevchecking)) { + return true; + } $result = true; /// Check that only one element has the previous not set if ($arr) { @@ -271,7 +275,11 @@ class XMLDBObject { * the previous/next rules */ function orderElements($arr) { + global $CFG; $result = true; + if (!empty($CFG->xmldbdisablenextprevchecking)) { + return $arr; + } /// Create a new array $newarr = array(); if (!empty($arr)) { diff --git a/lib/xmldb/classes/XMLDBStructure.class.php b/lib/xmldb/classes/XMLDBStructure.class.php index 3d051a5e85..e37aacadc9 100644 --- a/lib/xmldb/classes/XMLDBStructure.class.php +++ b/lib/xmldb/classes/XMLDBStructure.class.php @@ -330,6 +330,8 @@ class XMLDBStructure extends XMLDBObject { */ function arr2XMLDBStructure($xmlarr) { + global $CFG; + $result = true; /// Debug the structure @@ -354,6 +356,8 @@ class XMLDBStructure extends XMLDBObject { } if (isset($xmlarr['XMLDB']['@']['COMMENT'])) { $this->comment = trim($xmlarr['XMLDB']['@']['COMMENT']); + } else if (!empty($CFG->xmldbdisablecommentchecking)) { + $this->comment = ''; } else { $this->errormsg = 'Missing COMMENT attribute'; $this->debug($this->errormsg); diff --git a/lib/xmldb/classes/XMLDBTable.class.php b/lib/xmldb/classes/XMLDBTable.class.php index 621d1a8e16..55a2c2d99c 100644 --- a/lib/xmldb/classes/XMLDBTable.class.php +++ b/lib/xmldb/classes/XMLDBTable.class.php @@ -434,6 +434,8 @@ class XMLDBTable extends XMLDBObject { */ function arr2XMLDBTable($xmlarr) { + global $CFG; + $result = true; /// Debug the table @@ -451,6 +453,8 @@ class XMLDBTable extends XMLDBObject { } if (isset($xmlarr['@']['COMMENT'])) { $this->comment = trim($xmlarr['@']['COMMENT']); + } else if (!empty($CFG->xmldbdisablecommentchecking)) { + $this->comment = ''; } else { $this->errormsg = 'Missing COMMENT attribute'; $this->debug($this->errormsg);