r9118 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r9117‎ | r9118 | r9119 >
Date:10:15, 21 May 2005
Author:jeluf
Status:old
Tags:
Comment:
Class for storing objects in an external DB cluster
Modified paths:
  • /trunk/phase3/includes/ExternalStoreDB.php (added) (history)

Diff [purge]

Index: trunk/phase3/includes/ExternalStoreDB.php
@@ -0,0 +1,37 @@
 2+<?php
 3+/**
 4+ *
 5+ * @package MediaWiki
 6+ *
 7+ * DB accessable external objects
 8+ *
 9+ */
 10+require_once( 'LoadBalancer.php' );
 11+
 12+
 13+
 14+class ExternalStoreDB {
 15+ /* Fetch data from given URL */
 16+ function fetchFromURL($url) {
 17+ global $wgExternalServers;
 18+ #
 19+ # URLs have the form db://cluster/id, e.g.
 20+ # mysql://cluster1/3298247
 21+ #
 22+ $path = explode( '/', $url );
 23+ $cluster = $path[2];
 24+ $id = $path[3];
 25+
 26+ $lb = LoadBalancer::NewFromParams( $wgExternalServers[$cluster] );
 27+ $db = $lb->getConnection( DB_SLAVE );
 28+
 29+ $ret = $db->selectField( 'text', 'text_text', array( 'text_id' => $id ) );
 30+
 31+ return $ret;
 32+ }
 33+
 34+ /* XXX: may require other methods, for store, delete,
 35+ * whatever, for initial ext storage
 36+ */
 37+}
 38+?>
Property changes on: trunk/phase3/includes/ExternalStoreDB.php
___________________________________________________________________
Name: svn:eol-style
139 + native
Name: svn:keywords
240 + Author Date Id Revision

Status & tagging log