r24001 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r24000‎ | r24001 | r24002 >
Date:12:15, 11 July 2007
Author:mkroetzsch
Status:old
Tags:
Comment:
Script for setting up database as an alternative to web interface (especially for wikis where the latter times out
on large upgrade operations such as new indexes).
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/maintenance/SMW_setup.php (added) (history)
  • /trunk/extensions/SemanticMediaWiki/specials/SMWAdmin/SMW_SpecialSMWAdmin.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/maintenance/SMW_setup.php
@@ -0,0 +1,26 @@
 2+<?php
 3+/**
 4+ * Sets up the storage backend currently selected in LocalSettings.php
 5+ * (or the default MySQL store if no other store was selected). This
 6+ * is equivalent to clicking the respective button on the page
 7+ * Special:SMWAdmin. However, the latter may timeout if the setup involves
 8+ * migrating a lot of existing data.
 9+ *
 10+ * Note: this file must be placed in MediaWiki's "maintenance" directory!
 11+ *
 12+ * Usage:
 13+ * php SMW_refreshData.php [options...]
 14+ *
 15+ * @author Markus Krötzsch
 16+ */
 17+
 18+require_once( 'commandLine.inc' );
 19+
 20+global $smwgIP;
 21+require_once($smwgIP . '/includes/SMW_GlobalFunctions.php');
 22+
 23+smwfGetStore()->setup();
 24+
 25+print "\n\nDone.";
 26+
 27+
Property changes on: trunk/extensions/SemanticMediaWiki/maintenance/SMW_setup.php
___________________________________________________________________
Added: svn:eol-style
128 + native
Index: trunk/extensions/SemanticMediaWiki/specials/SMWAdmin/SMW_SpecialSMWAdmin.php
@@ -42,10 +42,10 @@
4343 if ($sure == 'yes') {
4444 $wgOut->disable(); // raw output
4545 ob_start();
46 - print "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\" dir=\"ltr\">\n<head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /><title>Setting up Storage for Semantic MediaWiki</title></head><body><p style=\"font-family: courier, fixed, monospace; \">";
 46+ print "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\" dir=\"ltr\">\n<head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /><title>Setting up Storage for Semantic MediaWiki</title></head><body><p><pre>";
4747 header( "Content-type: application/rdf+xml; charset=UTF-8" );
4848 $result = smwfGetStore()->setup();
49 - print '</p>';
 49+ print '</pre></p>';
5050 if ($result === true) {
5151 print '<p><b>The storage engine was set up successfully.</b></p>';
5252 }
Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore.php
@@ -687,7 +687,7 @@
688688
689689 function setup($verbose = true) {
690690 global $wgDBname;
691 - $this->reportProgress('Setting up standard database configuration for SMW ...<br /><br />',$verbose);
 691+ $this->reportProgress("Setting up standard database configuration for SMW ...\n\n",$verbose);
692692
693693 $fname = 'SMW::setupDatabase';
694694 $db =& wfGetDB( DB_MASTER );
@@ -718,7 +718,7 @@
719719 }
720720
721721 $this->setupIndex($smw_relations, array('subject_id','relation_title','object_title,object_namespace'), $db);
722 - $this->reportProgress('Relation table set up successfully.<br />',$verbose);
 722+ $this->reportProgress("Relation table set up successfully.\n",$verbose);
723723
724724 // create attribute table
725725 if ($db->tableExists($smw_attributes) === false) {
@@ -736,7 +736,7 @@
737737 }
738738
739739 $this->setupIndex($smw_attributes, array('subject_id','attribute_title','value_num','value_xsd'), $db);
740 - $this->reportProgress('Attribute table set up successfully.<br />',$verbose);
 740+ $this->reportProgress("Attribute table set up successfully.\n",$verbose);
741741
742742 // create table for long string attributes
743743 if ($db->tableExists($smw_longstrings) === false) {
@@ -751,7 +751,7 @@
752752 }
753753
754754 $this->setupIndex($smw_longstrings, array('subject_id','attribute_title'), $db);
755 - $this->reportProgress('Table for long string values (Type:Text) set up successfully.<br />',$verbose);
 755+ $this->reportProgress("Table for long string values (Type:Text) set up successfully.\n",$verbose);
756756
757757 // create table for special properties
758758 if ($db->tableExists($smw_specialprops) === false) {
@@ -765,9 +765,9 @@
766766 $res = $db->query( $sql, $fname );
767767 }
768768 $this->setupIndex($smw_specialprops, array('subject_id', 'property_id'), $db);
769 - $this->reportProgress('Table for special properties set up successfully.<br />',$verbose);
 769+ $this->reportProgress("Table for special properties set up successfully.\n",$verbose);
770770
771 - $this->reportProgress('Database initialised successfully.<br />',$verbose);
 771+ $this->reportProgress("Database initialised successfully.\n",$verbose);
772772 return true;
773773 }
774774

Status & tagging log