| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
/**
* The InnoDB indexer is responsible for creating and destroying
if ($fresh || self::$singleton === NULL) {
$indices = array(
'civicrm_address' => array(
- array('street_address', 'city', 'postal_code')
+ array('street_address', 'city', 'postal_code'),
),
'civicrm_activity' => array(
array('subject', 'details'),
array('source', 'amount_level', 'trxn_Id', 'invoice_id'),
),
'civicrm_email' => array(
- array('email')
+ array('email'),
),
'civicrm_membership' => array(
array('source'),
*/
protected $isActive;
+ /**
+ * Class constructor.
+ *
+ * @param $isActive
+ * @param $indices
+ */
public function __construct($isActive, $indices) {
$this->isActive = $isActive;
$this->indices = $this->normalizeIndices($indices);
}
+ /**
+ * Fix schema differences.
+ *
+ * Limitation: This won't pick up stale indices on tables which are not
+ * declared in $this->indices. That's not much of an issue for now b/c
+ * we have a static list of tables.
+ */
public function fixSchemaDifferences() {
- // Limitation: This won't pick up stale indices on tables which are not
- // declared in $this->indices. That's not much of an issue for now b/c
- // we have a static list of tables.
foreach ($this->indices as $tableName => $ign) {
$todoSqls = $this->reconcileIndexSqls($tableName);
foreach ($todoSqls as $todoSql) {
}
/**
- * Determine if an index is expected to exist
+ * Determine if an index is expected to exist.
*
* @param string $table
* @param array $fields
* Get a list of FTS index names that are currently defined in the database.
*
* @param string $table
- * @return array (string $indexName => string $indexName)
+ * @return array
+ * (string $indexName => string $indexName)
*/
public function findActualFtsIndexNames($table) {
$mysqlVersion = CRM_Core_DAO::singleValueQuery('SELECT VERSION()');
* FTS index.
*
* @param $table
- * @return array (string $indexName => string $sql)
+ *
+ * @return array
+ * (string $indexName => string $sql)
*/
public function buildIndexSql($table) {
$sqls = array(); // array (string $idxName => string $sql)
}
/**
- * Generate a "DROP INDEX" statement for each existing FTS index
+ * Generate a "DROP INDEX" statement for each existing FTS index.
*
* @param string $table
- * @return array (string $idxName => string $sql)
+ *
+ * @return array
+ * (string $idxName => string $sql)
*/
public function dropIndexSql($table) {
$sqls = array();
* Construct a set of SQL statements which will create (or preserve)
* required indices and destroy unneeded indices.
*
- * @param $table
+ * @param string $table
+ *
* @return array
*/
public function reconcileIndexSqls($table) {
}
/**
- * Put the indices into a normalized format
+ * Put the indices into a normalized format.
*
* @param $indices
* @return array
}
/**
+ * Setter for isActive.
+ *
* @param bool $isActive
*/
public function setActive($isActive) {
}
/**
- * @return boolean
+ * Getter for isActive.
+ *
+ * @return bool
*/
public function getActive() {
return $this->isActive;
}
+
}