20use Psr\Log\LoggerInterface;
21use Psr\Log\LoggerAwareInterface;
93 $this->lastError =
null;
104 public function __call( $name, $arguments ) {
106 $lname = strtolower(
$name );
108 ( $lname ===
'blpop' || $lname ===
'brpop' || $lname ===
'brpoplpush' )
109 && count( $arguments ) > 1
112 $timeout = end( $arguments );
114 $this->pool->resetTimeout( $this->conn, ( $timeout > 0 ? $timeout + 1 : $timeout ) );
128 private function tryCall( $method, $arguments ) {
129 $this->conn->clearLastError();
131 $res = $this->conn->$method( ...$arguments );
133 if ( $authError === self::AUTH_ERROR_TEMPORARY ) {
134 $res = $this->conn->$method( ...$arguments );
136 if ( $authError === self::AUTH_ERROR_PERMANENT ) {
137 throw new RedisException(
"Failure reauthenticating to Redis." );
156 public function scan( &$iterator, $pattern =
null, $count =
null ) {
157 return $this->
tryCall(
'scan', [ &$iterator, $pattern, $count ] );
171 public function sScan( $key, &$iterator, $pattern =
null, $count =
null ) {
172 return $this->
tryCall(
'sScan', [ $key, &$iterator, $pattern, $count ] );
186 public function hScan( $key, &$iterator, $pattern =
null, $count =
null ) {
187 return $this->
tryCall(
'hScan', [ $key, &$iterator, $pattern, $count ] );
201 public function zScan( $key, &$iterator, $pattern =
null, $count =
null ) {
202 return $this->
tryCall(
'zScan', [ $key, &$iterator, $pattern, $count ] );
211 if ( preg_match(
'/^ERR operation not permitted\b/', $this->conn->getLastError() ) ) {
212 if ( !$this->pool->reauthenticateConnection( $this->server, $this->conn ) ) {
215 $this->conn->clearLastError();
217 "Used automatic re-authentication for Redis.",
218 [
'redis_server' => $this->
server ]
234 $this->pool->resetTimeout( $this->conn );
245 $sha1 = sha1( $script );
250 $conn->clearLastError();
256 if ( preg_match(
'/^ERR operation not permitted\b/',
$conn->getLastError() ) ) {
257 $this->pool->reauthenticateConnection(
$server,
$conn );
258 $conn->clearLastError();
261 "Used automatic re-authentication for Lua script '$sha1'.",
266 if ( preg_match(
'/^NOSCRIPT/',
$conn->getLastError() ) ) {
267 $conn->clearLastError();
270 "Used eval() for Lua script '$sha1'.",
275 if (
$conn->getLastError() ) {
276 $this->logger->error(
277 'Lua script error on server "{redis_server}": {lua_error}',
280 'lua_error' =>
$conn->getLastError()
295 return $this->conn ===
$conn;
299 $this->pool->freeConnection( $this->
server, $this->conn );
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
Helper class to handle automatically marking connectons as reusable (via RAII pattern)
RedisConnectionPool $pool
zScan( $key, &$iterator, $pattern=null, $count=null)
Sorted Set Scan Handle this explicity due to needing the iterator passed by reference.
const AUTH_ERROR_PERMANENT
Authentication error was permanent and could not be recovered.
scan(&$iterator, $pattern=null, $count=null)
Key Scan Handle this explicity due to needing the iterator passed by reference.
tryCall( $method, $arguments)
Do the method call in the common try catch handler.
__call( $name, $arguments)
Magic __call handler for most Redis functions.
luaEval( $script, array $params, $numKeys)
sScan( $key, &$iterator, $pattern=null, $count=null)
Set Scan Handle this explicity due to needing the iterator passed by reference.
hScan( $key, &$iterator, $pattern=null, $count=null)
Hash Scan Handle this explicity due to needing the iterator passed by reference.
__construct(RedisConnectionPool $pool, $server, Redis $conn, LoggerInterface $logger)
setLogger(LoggerInterface $logger)
postCallCleanup()
Post Redis call cleanup.
checkAuthentication()
Handle authentication errors and automatically reauthenticate.
const AUTH_ERROR_TEMPORARY
Temporary authentication error; recovered by reauthenticating.
const AUTH_NO_ERROR
No authentication errors.
isConnIdentical(Redis $conn)
Helper class to manage Redis connections.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such and we might be restricted by PHP settings such as safe mode or open_basedir We cannot assume that the software even has read access anywhere useful Many shared hosts run all users web applications under the same so they can t rely on Unix and must forbid reads to even standard directories like tmp lest users read each others files We cannot assume that the user has the ability to install or run any programs not written as web accessible PHP scripts Since anything that works on cheap shared hosting will work if you have shell or root access MediaWiki s design is based around catering to the lowest common denominator Although we support higher end setups as the way many things work by default is tailored toward shared hosting These defaults are unconventional from the point of view of and they certainly aren t ideal for someone who s installing MediaWiki as MediaWiki does not conform to normal Unix filesystem layout Hopefully we ll offer direct support for standard layouts in the but for now *any change to the location of files is unsupported *Moving things and leaving symlinks will *probably *not break but it is *strongly *advised not to try any more intrusive changes to get MediaWiki to conform more closely to your filesystem hierarchy Any such attempt will almost certainly result in unnecessary bugs The standard recommended location to install relative to the web is it should be possible to enable the appropriate rewrite rules by if you can reconfigure the web server
Allows to change the fields on the form that will be generated $name
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))