17 self::LOCK_SH => self::LOCK_SH,
18 self::LOCK_UW => self::LOCK_SH,
19 self::LOCK_EX => self::LOCK_EX
23 parent::__construct( $config );
25 $this->session = substr( $this->session, 0, 31 );
29 # Let this transaction see lock rows from other transactions
30 $db->
query(
"SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;" );
31 # Do everything in a transaction as it all gets rolled back eventually
53 # Build up values for INSERT clause
58 if ( !isset( $this->locksHeld[$path][self::LOCK_EX] ) ) {
59 $checkEXKeys[] = $key;
63 # Block new writers (both EX and SH locks leave entries here)...
64 $db->insert(
'filelocks_shared', $data, __METHOD__, [
'IGNORE' ] );
65 # Actually do the locking queries...
66 if (
$type == self::LOCK_SH ) {
67 # Bail if there are any existing writers...
68 if ( count( $checkEXKeys ) ) {
69 $blocked = $db->selectField(
70 'filelocks_exclusive',
72 [
'fle_key' => $checkEXKeys ],
78 # Other prospective writers that haven't yet updated filelocks_exclusive
79 # will recheck filelocks_shared after doing so and bail due to this entry.
81 $encSession = $db->addQuotes( $this->session );
82 # Bail if there are any existing writers...
83 # This may detect readers, but the safe check for them is below.
84 # Note: if two writers come at the same time, both bail :)
85 $blocked = $db->selectField(
88 [
'fls_key' =>
$keys,
"fls_session != $encSession" ],
92 # Build up values for INSERT clause
95 $data[] = [
'fle_key' => $key ];
97 # Block new readers/writers...
98 $db->insert(
'filelocks_exclusive', $data, __METHOD__ );
99 # Bail if there are any existing readers...
100 $blocked = $db->selectField(
103 [
'fls_key' =>
$keys,
"fls_session != $encSession" ],
110 foreach ( $paths
as $path ) {
111 $status->fatal(
'lockmanager-fail-acquirelock', $path );
125 foreach ( $this->conns
as $lockDb => $db ) {
126 if ( $db->trxLevel() ) {
128 $db->rollback( __METHOD__ );
130 $status->fatal(
'lockmanager-fail-db-release', $lockDb );
initConnection($lockDb, IDatabase $db)
sha1Base36Absolute($path)
Get the base 36 SHA-1 of a string, padded to 31 digits.
Database error base class.
the array() calling protocol came about after MediaWiki 1.4rc1.
doGetLocksOnServer($lockSrv, array $paths, $type)
Get a connection to a lock DB and acquire locks on $paths.
div flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException'returning false will NOT prevent logging $e
query($sql, $fname=__METHOD__, $tempIgnore=false)
Run an SQL query and return the result.
Version of LockManager based on using named/row DB locks.
string $session
Random 32-char hex number.
array $lockTypeMap
Mapping of lock types to the type actually used.
static newGood($value=null)
Factory function for good results.
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 as
startAtomic($fname=__METHOD__)
Begin an atomic section of statements.
MySQL version of DBLockManager that supports shared locks.
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
getConnection($lockDb)
Get (or reuse) a connection to a lock DB.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set $status
__construct(array $config)
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached one of or reset my talk my contributions etc etc otherwise the built in rate limiting checks are if enabled allows for interception of redirect as a string mapping parameter names to values & $type
Basic database interface for live and lazy-loaded relation database handles.