public function __construct() { parent::__construct(); global $_CALEM_conf; $this->conf = $_CALEM_conf['po_conf']; $this->poStatus = array(); }
/** * Validate that all the tables are in the database */ public function validate() { global $_CALEM_conf; $dbo = new CalemDbo(); $tbls = $dbo->fetchBySql("SELECT table_name FROM INFORMATION_SCHEMA.TABLES WHERE table_schema = '" . $_CALEM_conf['calem_db_name'] . "'"); //Get tableMap $resourceMgr = CalemFactory::getResourceManager(); $tbMap = $resourceMgr->getTableMap(); $tableMap = $tbMap->getTableMapNoDropdown($resourceMgr); if ($this->logger->isDebugEnabled()) { $this->logger->debug("tableMap count=" . count($tableMap) . ", schema count=" . count($tbls)); } if (count($tableMap) > count($tbls)) { $this->logger->error("Some tables not in database: dbCount=" . count($tbls) . ", localCount=" . count($tableMap), 0); } //Let's validate by name here $schema = array(); foreach ($tbls as $val) { $schema[] = $val['table_name']; } $missing = array(); $missingIdx = array(); foreach ($tableMap as $table) { if (array_search($table, $schema) === false) { $missing[] = $table; } //Verify missing index try { $idxDb = $this->getIndexByDb($table, $dbo); $tblDd = $resourceMgr->getTableDd($table); $idx = $this->getIndexByTable($tblDd); $ar = $this->arrayDiff($idx, $idxDb); if (count($ar) > 0) { $missingIdx = array_merge($missingIdx, $ar); } } catch (CalemDboDataNotFoundException $e) { continue; } } if (count($missing) > 0 || count($missingIdx) > 0) { $this->logger->error("Missing items in database: missingTables=" . var_export($missing, true) . ", missingIndexes=" . var_export($missingIdx, true)); throw new CalemException("Missing tables in database: " . var_export($missing, true) . ", missinIndexes=" . var_export($missingIdx, true), 0); } }
public function __construct() { parent::__construct(); global $_CALEM_conf; $this->conf = $_CALEM_conf['req_conf']; }
/** * Update function */ public function update() { parent::update(); $this->updateCache(); }