/** * Checks to see if all of the indexes are in place for the BO's table, creates those that are missing. * * @since 1.2 */ private function checkIndexes() { self::$logger->debug('>>checkIndexes()'); $indexNames = $this->BO->getIndexes(); // process unique keys foreach ($this->BO->getUniqueAttributes() as $prop) { // check for composite indexes if (mb_strpos($prop, '+')) { $attributes = explode('+', $prop); $index_exists = false; foreach ($indexNames as $index) { if ($attributes[0] . '_' . $attributes[1] . '_unq_idx' == $index) { $index_exists = true; } if (count($attributes) == 3) { if ($attributes[0] . '_' . $attributes[1] . '_' . $attributes[2] . '_unq_idx' == $index) { $index_exists = true; } } } if (!$index_exists) { if (count($attributes) == 3) { $this->BO->createUniqueIndex($attributes[0], $attributes[1], $attributes[2]); } else { $this->BO->createUniqueIndex($attributes[0], $attributes[1]); } } } else { $index_exists = false; foreach ($indexNames as $index) { if ($prop . '_unq_idx' == $index) { $index_exists = true; } } if (!$index_exists) { $this->createUniqueIndex($prop); } } } self::$logger->debug('<<checkIndexes'); }