use WANObjectCache;
use Wikimedia\Assert\Assert;
use Wikimedia\Rdbms\IDatabase;
-use Wikimedia\Rdbms\LoadBalancer;
+use Wikimedia\Rdbms\ILoadBalancer;
/**
* Service for storing and loading Content objects.
const TEXT_CACHE_GROUP = 'revisiontext:10';
/**
- * @var LoadBalancer
+ * @var ILoadBalancer
*/
private $dbLoadBalancer;
private $useExternalStore = false;
/**
- * @param LoadBalancer $dbLoadBalancer A load balancer for acquiring database connections
+ * @param ILoadBalancer $dbLoadBalancer A load balancer for acquiring database connections
* @param WANObjectCache $cache A cache manager for caching blobs. This can be the local
* wiki's default instance even if $wikiId refers to a different wiki, since
* makeGlobalKey() is used to constructed a key that allows cached blobs from the
* @param bool|string $wikiId The ID of the target wiki database. Use false for the local wiki.
*/
public function __construct(
- LoadBalancer $dbLoadBalancer,
+ ILoadBalancer $dbLoadBalancer,
WANObjectCache $cache,
$wikiId = false
) {
}
/**
- * @return LoadBalancer
+ * @return ILoadBalancer
*/
private function getDBLoadBalancer() {
return $this->dbLoadBalancer;
if ( $this->useExternalStore ) {
// Store and get the URL
$data = ExternalStore::insertToDefault( $data );
- if ( !$data ) {
- throw new BlobAccessException( "Failed to store text to external storage" );
- }
if ( $flags ) {
$flags .= ',';
}
/**
* Splits a blob address into three parts: the schema, the ID, and parameters/flags.
*
+ * @since 1.33
+ *
* @param string $address
*
* @throws InvalidArgumentException
* @return array [ $schema, $id, $parameters ], with $parameters being an assoc array.
*/
- private static function splitBlobAddress( $address ) {
+ public static function splitBlobAddress( $address ) {
if ( !preg_match( '/^(\w+):(\w+)(\?(.*))?$/', $address, $m ) ) {
throw new InvalidArgumentException( "Bad blob address: $address" );
}