r23003 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23002‎ | r23003 | r23004 >
Date:07:35, 15 June 2007
Author:mulligen
Status:old
Tags:
Comment:
modification to the wiki datasets data scheme
Modified paths:
  • /trunk/extensions/Wikidata/Database+scripts/Convenience/Recreate+indexes+for+all+tables.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Wikidata/Database scripts/Convenience/Recreate indexes for all tables.php
@@ -10,6 +10,20 @@
1111
1212 ob_end_flush();
1313
 14+/*
 15+ * This function wil retrieve a list of the data sets defined in this
 16+ * database and return it as an array
 17+ */
 18+function retrieve_datasets(){
 19+ $prefixes = array();
 20+ $dbr = &wfGetDB(DB_SLAVE);
 21+ $queryResult = $dbr->query("select set_prefix from wikidata_sets");
 22+ while ($datasetRecord = $dbr->fetchObject($queryResult) ) {
 23+ array_push( $prefixes, $datasetRecord->set_prefix );
 24+ }
 25+ return $prefixes;
 26+}
 27+
1428 function createIndexesForTable($dc,$tableName) {
1529 $handle = fopen("Create uw_" . $tableName . " indices.sql", "r");
1630 $sql = "";
@@ -43,34 +57,38 @@
4458 }
4559
4660 global
47 - $beginTime, $wgCommandLineMode;
 61+$beginTime, $wgCommandLineMode;
4862
4963 $beginTime = time();
5064 $wgCommandLineMode = true;
51 -$dc = "sp";
 65+$dc = "uw";
5266
53 -recreateIndexesForTables( "sp",
54 - array(
55 - "bootstrapped_defined_meanings",
56 - "transactions",
57 - "translated_content",
58 - "alt_meaningtexts",
59 - "class_attributes",
60 - "class_membership",
61 - "collection_contents",
62 - "collection_ns",
63 - "defined_meaning",
64 - "expression_ns",
65 - "meaning_relations",
66 - "option_attribute_options",
67 - "option_attribute_values",
68 - "syntrans",
69 - "text_attribute_values",
70 - "translated_content_attribute_values",
71 - "url_attribute_values"
72 - )
73 -);
 67+$tables = array(
 68+ "bootstrapped_defined_meanings",
 69+ "transactions",
 70+ "translated_content",
 71+ "alt_meaningtexts",
 72+ "class_attributes",
 73+ "class_membership",
 74+ "collection_contents",
 75+ "collection_ns",
 76+ "defined_meaning",
 77+ "expression_ns",
 78+ "meaning_relations",
 79+ "option_attribute_options",
 80+ "option_attribute_values",
 81+ "syntrans",
 82+ "text_attribute_values",
 83+ "translated_content_attribute_values",
 84+ "url_attribute_values"
 85+ );
 86+
 87+$prefixes = retrieve_datasets();
7488
 89+foreach( $prefixes as $prefix ){
 90+ recreateIndexesForTables( $prefix, $tables );
 91+}
 92+
7593 $endTime = time();
7694 echo("\n\nTime elapsed: " . durationToString($endTime - $beginTime));
7795

Status & tagging log