r25987 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r25986‎ | r25987 | r25988 >
Date:13:50, 21 September 2007
Author:proes
Status:old
Tags:
Comment:
Created utility function on VersionedTable to create versioned variants of the same index.
Modified paths:
  • /trunk/extensions/Wikidata/OmegaWiki/WikiDataTables.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Wikidata/OmegaWiki/WikiDataTables.php
@@ -170,6 +170,21 @@
171171 $this->addTransactionId = $this->createColumn("add_transaction_id");
172172 $this->removeTransactionId = $this->createColumn("remove_transaction_id");
173173 }
 174+
 175+ protected function createVersionedIndexes($name, $versionedEnd, $versionedStart, $unversioned, array $columns) {
 176+ $result = array();
 177+
 178+ if ($versionedEnd)
 179+ $result[] = new TableIndex("versioned_end_" . $name, array_merge(array($this->removeTransactionId), $columns));
 180+
 181+ if ($versionedStart)
 182+ $result[] = new TableIndex("versioned_start_" . $name, array_merge(array($this->addTransactionId), $columns));
 183+
 184+ if ($unversioned)
 185+ $result[] = new TableIndex("unversioned_" . $name, $columns);
 186+
 187+ return $result;
 188+ }
174189 }
175190
176191 class BootstrappedDefinedMeaningsTable extends Table {
@@ -252,44 +267,17 @@
253268
254269 $this->setKeyColumns(array($this->expressionId));
255270
256 - $this->setWebSiteIndexes(array(
257 - new TableIndex("versioned_end_expression", array(
258 - $this->removeTransactionId,
259 - $this->expressionId,
260 - $this->languageId
261 - )),
262 - new TableIndex("versioned_end_language", array(
263 - $this->removeTransactionId,
264 - $this->languageId,
265 - $this->expressionId
266 - )),
267 - new TableIndex("versioned_end_spelling", array(
268 - $this->removeTransactionId,
269 - $this->spelling->subPart(255),
270 - $this->expressionId,
271 - $this->languageId
272 - )),
273 - new TableIndex("versioned_start_expression", array(
274 - $this->addTransactionId,
275 - $this->expressionId,
276 - $this->languageId
277 - )),
278 - new TableIndex("versioned_start_language", array(
279 - $this->addTransactionId,
280 - $this->languageId,
281 - $this->expressionId
282 - )),
283 - new TableIndex("versioned_start_spelling", array(
284 - $this->addTransactionId,
285 - $this->spelling->subPart(255),
286 - $this->expressionId,
287 - $this->languageId
288 - )),
289 - new TableIndex("expressions_unique_idx", array(
290 - $this->expressionId,
291 - $this->languageId
292 - ))
293 - ));
 271+ $this->setWebSiteIndexes(array_merge(
 272+ $this->createVersionedIndexes("expression", true, true, true,
 273+ array($this->expressionId, $this->languageId)
 274+ ),
 275+ $this->createVersionedIndexes("language", true, true, false,
 276+ array($this->languageId, $this->expressionId)
 277+ ),
 278+ $this->createVersionedIndexes("spelling", true, true, false,
 279+ array($this->spelling->subPart(255),$this->languageId, $this->expressionId)
 280+ )
 281+ ));
294282 }
295283 }
296284

Status & tagging log