MediaWiki REL1_31
ExternalStoreForTesting.php
Go to the documentation of this file.
1<?php
2
4
5 protected $data = [
6 'cluster1' => [
7 '200' => 'Hello',
8 '300' => [
9 'Hello', 'World',
10 ],
11 // gzip string below generated with gzdeflate( 'AAAABBAAA' )
12 '12345' => "sttttr\002\022\000",
13 ],
14 ];
15
21 public function fetchFromURL( $url ) {
22 // Based on ExternalStoreDB
23 $path = explode( '/', $url );
24 $cluster = $path[2];
25 $id = $path[3];
26 if ( isset( $path[4] ) ) {
27 $itemID = $path[4];
28 } else {
29 $itemID = false;
30 }
31
32 if ( !isset( $this->data[$cluster][$id] ) ) {
33 return null;
34 }
35
36 if ( $itemID !== false
37 && is_array( $this->data[$cluster][$id] )
38 && isset( $this->data[$cluster][$id][$itemID] )
39 ) {
40 return $this->data[$cluster][$id][$itemID];
41 }
42
43 return $this->data[$cluster][$id];
44 }
45
46}
fetchFromURL( $url)
Fetch data from given URL.