. /** * @package tool_xmldb * @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ /** * This class will compare all the indexes found in the XMLDB definitions * with the physical DB implementation, reporting about all the missing * indexes to be created to be 100% ok. * * @package tool_xmldb * @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class check_indexes extends XMLDBCheckAction { /** * Init method, every subclass will have its own */ function init() { $this->introstr = 'confirmcheckindexes'; parent::init(); // Set own core attributes // Set own custom attributes // Get needed strings $this->loadStrings(array( 'missing' => 'tool_xmldb', 'key' => 'tool_xmldb', 'index' => 'tool_xmldb', 'missingindexes' => 'tool_xmldb', 'nomissingindexesfound' => 'tool_xmldb', 'yesmissingindexesfound' => 'tool_xmldb', )); } protected function check_table(xmldb_table $xmldb_table, array $metacolumns) { global $DB; $dbman = $DB->get_manager(); $o = ''; $missing_indexes = array(); // Keys if ($xmldb_keys = $xmldb_table->getKeys()) { $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 { $r.= ' ' . $this->str['nomissingindexesfound'] . ''; } $r.= ' | 
| ';
        // Add the complete log message
        $r.= ' ' . $this->str['completelogbelow'] . ''; $r.= ' |