/** * Checks the comprofiler_fields table and upgrades if needed * Backend-use only. * @access private * * @param string $tableName * @param boolean $upgrade False: only check table, True: upgrades table (depending on $dryRun) * @param boolean $dryRun True: doesn't do the modifying queries, but lists them, False: does the job * @return string|boolean Message to display */ function checkTable( $tableName, $upgrade = false, $dryRun = false ) { $xml = $this->_getCbDbXml(); if ( $xml !== null ) { $db =& $xml->getElementByPath( 'database' ); if ( $db !== false ) { $table = $db->getChildByNameAttr( 'table', 'name', $tableName ); if ( $table !== false ) { cbimport( 'cb.sql.upgrader' ); $this->_sqlUpgrader = new CBSQLupgrader( $this->_db, $this->_silentWhenOK ); $this->_sqlUpgrader->setDryRun( $dryRun ); $success = $this->_sqlUpgrader->checkXmlTableDescription( $table, '', $upgrade, null ); /* var_dump( $success ); echo "<br>\nERRORS: " . $this->_sqlUpgrader->getErrors( "<br /><br />\n\n", "<br />\n" ); echo "<br>\nLOGS: " . $this->_sqlUpgrader->getLogs( "<br /><br />\n\n", "<br />\n" ); exit; */ } else { $success = array( sprintf( 'Error: could not find element table name="%s" in XML file', $tableName ), null ); } } else { $success = array( 'Error: could not find element "database" in XML file', null ); } } else { $success = array( 'Error: could not find XML file', null ); } return $success; }