2013-09-12 22:06:44 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Denormalizes object names to support queries which need to be ordered or
|
|
|
|
* grouped by things like projects.
|
|
|
|
*/
|
|
|
|
final class ManiphestNameIndex extends ManiphestDAO {
|
|
|
|
|
|
|
|
protected $indexedObjectPHID;
|
|
|
|
protected $indexedObjectName;
|
|
|
|
|
|
|
|
public function getConfiguration() {
|
|
|
|
return array(
|
|
|
|
self::CONFIG_TIMESTAMPS => false,
|
2014-09-19 20:46:44 +02:00
|
|
|
self::CONFIG_COLUMN_SCHEMA => array(
|
2014-10-01 17:18:53 +02:00
|
|
|
'indexedObjectName' => 'sort128',
|
2014-09-19 20:46:44 +02:00
|
|
|
),
|
|
|
|
self::CONFIG_KEY_SCHEMA => array(
|
|
|
|
'key_phid' => array(
|
|
|
|
'columns' => array('indexedObjectPHID'),
|
|
|
|
'unique' => true,
|
|
|
|
),
|
|
|
|
'key_name' => array(
|
|
|
|
'columns' => array('indexedObjectName'),
|
|
|
|
),
|
|
|
|
),
|
2013-09-12 22:06:44 +02:00
|
|
|
) + parent::getConfiguration();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function updateIndex($phid, $name) {
|
|
|
|
$table = new ManiphestNameIndex();
|
|
|
|
$conn_w = $table->establishConnection('w');
|
|
|
|
queryfx(
|
|
|
|
$conn_w,
|
|
|
|
'INSERT INTO %T (indexedObjectPHID, indexedObjectName) VALUES (%s, %s)
|
|
|
|
ON DUPLICATE KEY UPDATE indexedObjectName = VALUES(indexedObjectName)',
|
|
|
|
$table->getTableName(),
|
|
|
|
$phid,
|
|
|
|
$name);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|