diff --git a/admin/xmldb/actions/XMLDBCheckAction.class.php b/admin/xmldb/actions/XMLDBCheckAction.class.php new file mode 100644 index 00000000000..378b678acee --- /dev/null +++ b/admin/xmldb/actions/XMLDBCheckAction.class.php @@ -0,0 +1,206 @@ +loadStrings(array( + $this->introstr => 'xmldb', + 'ok' => '', + 'wrong' => 'xmldb', + 'table' => 'xmldb', + 'field' => 'xmldb', + 'searchresults' => 'xmldb', + 'completelogbelow' => 'xmldb', + 'yes' => '', + 'no' => '', + 'error' => '', + 'back' => 'xmldb' + )); + } + + /** + * Invoke method, every class will have its own + * returns true/false on completion, setting both + * errormsg and output as necessary + */ + function invoke() { + parent::invoke(); + + $result = true; + + /// Set own core attributes + $this->does_generate = ACTION_GENERATE_HTML; + + /// These are always here + global $CFG, $XMLDB, $DB; + + /// And we nedd some ddl suff + $dbman = $DB->get_manager(); + + /// Here we'll acummulate all the wrong fields found + $problemsfound = array(); + + /// Do the job, setting $result as needed + + /// Get the confirmed to decide what to do + $confirmed = optional_param('confirmed', false, PARAM_BOOL); + + /// If not confirmed, show confirmation box + if (!$confirmed) { + $o = '
| ';
+ $o.= ' ' . $this->str[$this->introstr] . ' '; + $o.= '
|
| ';
- $o.= ' ' . $this->str['confirmcheckbigints'] . ' '; - if ($dbfamily == 'mysql') { - $o.= '' . $this->str['mysqlextracheckbigints'] . ' '; - } - $o.= '
|
';
+ $r.= ' ' . $this->str['searchresults'] . ''; + $r.= '' . $this->str['wrongints'] . ': ' . count($wrong_fields) . ' '; + $r.= ' | |||
';
- $this->output = $o;
- } else {
- /// The back to edit table button
- $b = ' ';
-
- /// Iterate over $XMLDB->dbdirs, loading their XML data to memory
- if ($XMLDB->dbdirs) {
- $dbdirs =& $XMLDB->dbdirs;
- $o='
' . $s; + } else { + $r.= ' ' . $this->str['nowrongintsfound'] . ' '; } + $r.= ' | |||
| ';
+ /// Add the complete log message
+ $r.= ' ' . $this->str['completelogbelow'] . ' '; + $r.= ' |
| ';
- $o.= ' ' . $this->str['confirmcheckdefaults'] . ' '; - $o.= '
|
';
+ $r.= ' ' . $this->str['searchresults'] . ''; + $r.= '' . $this->str['wrongdefaults'] . ': ' . count($wrong_fields) . ' '; + $r.= ' | |||
| ';
+
+ /// If we have found wrong defaults inform about them
+ if (count($wrong_fields)) {
+ $r.= ' ' . $this->str['yeswrongdefaultsfound'] . ' '; + $r.= '
' . str_replace("\n", ''; + } + } + $r.= ' ' . $s; } else { - /// The back to edit table button - $b = ' '; - - /// Iterate over $XMLDB->dbdirs, loading their XML data to memory - if ($XMLDB->dbdirs) { - $dbdirs =& $XMLDB->dbdirs; - $o='
' . $this->str['nowrongdefaultsfound'] . ' '; } + $r.= ' | |||
| ';
+ /// Add the complete log message
+ $r.= ' ' . $this->str['completelogbelow'] . ' '; + $r.= ' |
| ';
- $o.= ' ' . $this->str['confirmcheckindexes'] . ' '; - $o.= '
|
';
+ $r.= ' ' . $this->str['searchresults'] . ''; + $r.= '' . $this->str['missingindexes'] . ': ' . count($missing_indexes) . ' '; + $r.= ' | |||
| ';
+
+ /// If we have found missing indexes inform about them
+ if (count($missing_indexes)) {
+ $r.= ' ' . $this->str['yesmissingindexesfound'] . ' '; + $r.= '
' . str_replace("\n", ''; + + } + $r.= ' ' . $s; } else { - /// The back to edit table button - $b = ' '; - - /// Iterate over $XMLDB->dbdirs, loading their XML data to memory - if ($XMLDB->dbdirs) { - $dbdirs =& $XMLDB->dbdirs; - $o='
' . $this->str['nomissingindexesfound'] . ' '; } + $r.= ' | |||
| ';
+ /// Add the complete log message
+ $r.= ' ' . $this->str['completelogbelow'] . ' '; + $r.= ' |