Commit graph

59 commits

Author SHA1 Message Date
Aaron Schulz
dcd0a3d534 Add isCurrentWikiId()/isCurrentWikiDomain()/getCurrentWikiDomain() to WikiMap
Use these in place of various wfWikiID() calls.

Also cleanup UserRightsProxy wiki ID variable names and removed unused
and poorly named getDBname() method.

Change-Id: Ib28889663989382d845511f8d34712b08317f60e
2018-10-29 14:53:37 -07:00
Aaron Schulz
f7009eeb95 Make ExternalStoreDB "wiki" context override the server "dbname" field
This is all that is needed for b/c and going beyond that can break
foreign wiki (domain) external store access if matching per-wiki DB
names *are* used for external store.

Follow up to 92e4ace7ea.

Bug: T200471
Change-Id: I877139ff659f542da04d4d8f5ef3297dbfcfd734
2018-08-15 03:02:56 +00:00
Aaron Schulz
92e4ace7ea Use LB server configuration to force DB domains in ExternalStorageDB
This is for backwards-compatibility for pre 14ee3f2107 external store
configuration that relied on not using the main wiki DB name(s).

Bug: T200471
Change-Id: Ie60cae64e32ff2532565cbd79c8e084634a61cce
2018-08-13 18:58:02 +00:00
daniel
53fd8295ff Use consistent caching strategy in Revision storage classes
DEPLOYMENT: This changes the cache key for revision
content blobs. Expect a brief rise in ExternalStore hits.

Bug: T198704
Change-Id: Icc2d16bc5a1e27ba4caea49a784ba7aeac15042a
2018-07-05 17:44:24 +02:00
Bartosz Dziewoński
485f66f174 Use PHP 7 '??' operator instead of '?:' with 'isset()' where convenient
Find: /isset\(\s*([^()]+?)\s*\)\s*\?\s*\1\s*:\s*/
Replace with: '\1 ?? '

(Everywhere except includes/PHPVersionCheck.php)
(Then, manually fix some line length and indentation issues)

Then manually reviewed the replacements for cases where confusing
operator precedence would result in incorrect results
(fixing those in I478db046a1cc162c6767003ce45c9b56270f3372).

Change-Id: I33b421c8cb11cdd4ce896488c9ff5313f03a38cf
2018-05-30 18:06:13 -07:00
Jayprakash12345
011711e79f Fix typo accessable --> accessible
Change-Id: I239a15e1bc3a311d9284285a04094afae331111d
2018-03-14 05:25:34 +00:00
Umherirrender
554f9c857c Replace wfGetLBFactory
@deprecated since 1.27

Change-Id: I11a7253cebe525948a55cebee183e6de128fdc39
2018-02-27 20:02:48 +00:00
Aaron Schulz
d9ba7cd005 Make LocalFile check early if the revision store is available
This reduces the odds of having files without corresponding
wiki pages, given that the later is done in a deferred update.

Also made some documentation cleanups.

Bug: T187942
Change-Id: Iff516669f535713d37e0011e2d7ed285c667f1c5
2018-02-22 22:07:30 +00:00
Aaron Schulz
656f60c154 Add ExternalStoreMedium::isReadOnly() method
Use this to abort out of store() calls early

Bug: T187942
Change-Id: I9334d36e8bc3e4589775471eee03be4f4a3119a3
2018-02-22 08:15:20 -08:00
addshore
24b24e493e Introduce ExternalStoreFactory
Change-Id: If0d8f503e3cc9fd83f3b40e2ac8a5f9dc8b7e0ea
2017-11-14 13:22:12 +00:00
Umherirrender
f739a8f368 Improve some parameter docs
Add missing @return and @param to function docs and fixed some @param

Change-Id: I810727961057cfdcc274428b239af5975c57468d
2017-09-10 20:32:31 +02:00
Brad Jorsch
01a10dba5a Remove reference to deprecated IDatabase->nextSequenceValue()
The method was deprecated and made unnecessary in Ib308190c.

Change-Id: I1729ac0b3a88270a4c2f064187a2472112aaeb1e
2017-09-01 12:28:39 -04:00
Aaron Schulz
82e2c924e4 Remove "@author Aaron Schulz" annotations
Bug: T139301
Change-Id: Ib5248e8e27d60611c7373bce4b29dd5e85aa3489
2017-06-27 15:24:14 -07:00
Aaron Schulz
3c2a172c3f Move DBConnRef/MaintainableDBConnRef to Rdbms namespace
Change-Id: I7ca6b40f973b2aae83747de92e280ded222c87e3
2017-03-29 11:04:47 -07:00
Aaron Schulz
488a647831 Move IDatabase/IMaintainableDatabase to Rdbms namespace
Change-Id: If7e8a8ff574661fd827de8bcec11d2c39a687300
2017-03-28 15:32:38 -07:00
Aaron Schulz
64df456b39 Move remaining LoadBalancer classes to Rdbms
The old names are left as aliases.

Change-Id: I52a327f2463a2ba7437324047b5b00d28cd1d758
2017-02-23 20:38:31 -08:00
Aaron Schulz
fe59c39da9 Add LoadBalancer::getMaintenanceConnectionRef() method
This is useful when IMaintainableDatabase methods are needed
for foreign wiki connections to things like external store.

Also:
* Set visibility for ExternalStoreDB methods.
* Cleaned up various type hints and comments.

Change-Id: Ie35b1ff21032cc4e78912dc499486da23aeba041
2016-12-10 15:35:09 -08:00
Aaron Schulz
0ceb2f8d4c Use getConnectionRef() in ExternalStoreDB to avoid connection leaks
Change-Id: I3df270241653841a4fb2f65e240aae9d2e0b650f
2016-09-21 08:01:00 +00:00
Aaron Schulz
950cf6016c Rename DB_SLAVE constant to DB_REPLICA
This is more consistent with LoadBalancer, modern, and inclusive
of master/master mysql, NDB cluster, and MariaDB galera cluster.

The old constant is an alias now.

Change-Id: I0b37299ecb439cc446ffbe8c341365d1eef45849
2016-09-05 22:55:53 -07:00
Aaron Schulz
16266edff3 Change "slave" => "replica DB" in /includes
Change-Id: Icb716219c9335ff8fa447b1733d04b71d9712bf9
2016-09-05 21:01:01 +00:00
Aaron Schulz
89557f204f Fix ExternalStoreDB IDEA errors
Change-Id: I6200173fd1cba4bdf03b61659a48016107672fad
2016-04-20 18:17:25 +00:00
Kunal Mehta
6e9b4f0e9c Convert all array() syntax to []
Per wikitech-l consensus:
 https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html

Notes:
* Disabled CallTimePassByReference due to false positives (T127163)

Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
2016-02-17 01:33:00 -08:00
Reedy
00c426e3c2 Replace wfBaseConvert with Wikimedia\base_convert
Change-Id: Iadab3d018c3559daf79be90edb23d131729bdb68
2015-11-24 22:51:42 +00:00
Aaron Schulz
7c07943eab Update more docs and type hints to use IDatabase
Change-Id: I8c8d85b32a8aba21e14d2a2dde4c25eb509186c1
2015-10-06 18:49:52 -07:00
Aaron Schulz
0f7893f877 Update various @params from DatabaseBase to IDatabase
Change-Id: I98e44cdffb0fc0d729f69f702799139afb988c20
2015-10-05 05:24:29 +00:00
Chad Horohoe
c33f4de066 Profile all external HTTP requests from MW
Change-Id: Ie980b080da2ef21ec7d9fc32f1accc55710de140
2015-03-03 20:54:30 -08:00
Aaron Schulz
6921770414 Updated some try-catch statements: MWException -> Exception
Change-Id: I76601a86e30f4984e3b1a8c8ec5ef5a0f652433a
2015-01-09 17:20:22 -08:00
Aaron Schulz
086e17a37c Clear the DBO_TRX flag for sanity in ExternalStore
* This avoids an explicit commit of an implicit transaction when the site
  config for the ES cluster does not clear that flag by mistake.

Change-Id: I57d8b04cbf3249849db1643fc82673e9de8ea15b
2014-09-12 11:43:34 -07:00
umherirrender
b883e8c7c0 Cleanup some docs (includes/[e-l])
- Swap "$variable type" to "type $variable"
- Added missing types
- Fixed spacing inside docs
- Makes beginning of @param/@return/@var/@throws in capital
- Changed some types to match the more common spelling

Change-Id: I41a84e8e1dec39170aa655250325ffc485eaeaef
2014-07-24 19:43:03 +02:00
umherirrender
9c614ac02d Fixed some @params documentation
Swapped some "$var type" to "type $var" or added missing types
before the $var. Changed some other types to match the more common
spelling. Makes beginning of some text in captial.

Change-Id: I8c9f30128b46086064326708a4878228ba459447
2014-04-14 19:52:18 +00:00
Alexandre Emsenhuber
449ee32451 Add missing line breaks to wfDebug() calls
Also removed true as second parameter to it from CloneDatabase.php
since it is the default value of that parameter.

Change-Id: I727ebae2bd4df0e26019985ce8c7ce73381c5642
2014-03-29 11:52:07 +01:00
Aaron Schulz
a071365392 Tweaked generated paths for ExternalStoreMwstore
* This improve the object store case (with B-Tree container listings
  and 2-level sharding set up).

Change-Id: If75f51fb07cd5df0da455d4e6eafe06d69e8b941
2014-02-13 10:15:13 -08:00
Alexandre Emsenhuber
8d701eeeea Remove trailing line breaks from wfDebugLog() messages
This is useless since the message is passed through trim() and a
line break is added afterwards.

Change-Id: I1a26b30a07f7c9c749fce5bb6b2b4b3d79901b7c
2014-02-04 22:16:13 +01:00
Tim Starling
ad9c52c217 ExternalStoreDB: update for PHP 5
Support for PHP 4 was dropped in 2006, so the ampersands are no longer
needed. I guess this code doesn't get looked at very often.

Change-Id: I344043d17061014d4370d8f68b3bc86b8c4f9453
2013-12-03 14:52:44 +11:00
Siebrand Mazeland
d4902a82db Update formatting of externalstore classes
Change-Id: Ie31c370ba497eedc7458973b704132cf4725cf1f
2013-11-26 13:16:02 +00:00
Siebrand Mazeland
bc02ae439b Do not call FileBackendGroup::get() statically
Change-Id: If63ba967177415d2f0e857dba33a09157c401909
2013-11-22 21:27:04 +01:00
Siebrand Mazeland
7f5c64a0ee Fix incorrect array type
Change-Id: I92193b46716d78125c8bce0ad9b2b098885b0a37
2013-11-22 21:11:31 +01:00
MatmaRex
df8ec1e216 No spaces after (casts)
Also removed some unnecessary ones. I think I've caught them all.

The spaceless version already appears in core ~300 times (after
accounting for false positives when grepping). Some consistency would
be nice.

Change-Id: I607655b5f4366e66dc78730d5fd2f57ed8776cae
2013-09-04 20:05:43 +02:00
jenkins-bot
02f476f2c8 Merge "Break some long lines" 2013-08-13 18:05:52 +00:00
Aaron Schulz
9e54e6239c Added batchFetchFromURLs() for mwstore backend
Change-Id: I71cfe206c8eef79acb6507bc841a4798747a5f84
2013-08-13 00:11:11 -07:00
Erik Bernhardson
660627f144 Reusable external store insertion with fallback
Minor refactor allows insertion to ES from an alternate set of backend servers.

Change-Id: I72cf2514265e052b839e0ac31c171e91727fb9af
2013-08-08 11:36:05 -07:00
Aaron Schulz
3969c43bcc Break some long lines
Change-Id: I6b984e03611f937320464e32567495e5b61e315f
2013-08-07 19:26:28 -07:00
Erik Bernhardson
bfe131448e Batch retreival of ES data with minimal round trips
Batches ES urls by schema and host to reduce round trips required to retreive
many pieces of data.  Takes array of ES urls to retreive and returns a map
from ES urls to their data.  Errored urls are represented with a boolean false
in the result set.  Initially implemented for ExternalStoreDB, other stores
fallback to serial requests.

Change-Id: If1bef25f57bfe7de32fc6787f553a90bd76e87ea
2013-08-05 10:36:53 -07:00
Tim Starling
1fe9340bb3 Remove hphpc support and deprecate related functions
hphpc has been superseded by hhvm, so support for hphpc is no longer
needed.

* Continue to use Preprocessor_Hash under HipHop since it is still
  faster under hhvm
* Keep $wgCompiledFiles for now, so that wikihiero doesn't give an error
  before Ic9d1e795 is merged
* Migrate the run-server script and associated configuration file to
  hhvm. Enable EnableStaticContentFromDisk since it doesn't seem
  ridiculously inefficient at first glance. Run from $IP rather than
  $IP/.. since hhvm is apparently not picky about sourcing files from
  outside of the current directory.

Change-Id: Ic3e769f1fbad4f7ad26dd819406796fee48c6b45
2013-05-09 08:28:05 +10:00
umherirrender
6f79eef473 Fixed spacing around parenthesis in includes
Change-Id: Ie8adc00f4ee8ecec4554e584c18d5d2073415397
2013-04-28 15:50:07 +00:00
umherirrender
892ee7a4af Fixed spacing in db/debug/diff/externalstore/objectcache folder
Added spaces before if, foreach
Added some braces for one line statements

Change-Id: I32a43c547630ce31b6b25cc1bc9eedc50e67b2d7
2013-04-20 22:28:52 +02:00
umherirrender
15abcf71ca Added/Removed spaces around string concatenation
And added/removed spaces around some other tokens,
like +, -, *, /, <, >, =, !

Fixed windows newline style

Change-Id: I0b9c8c408f3f6bfc0d685a074d7ec468fb848fc8
2013-04-13 13:36:24 +02:00
Yuri Astrakhan
9506e3d812 Spellchecked /includes directory
* Ran spell-checker over code comments in /includes/
* A few spellchecking fixes for wfDebug() calls

Found one very strange (NOOP?) line in Linker.php - see "TODO: BUG?"

Change-Id: Ibb86b51073b980eda9ecce2cf0b8dd33f058adbf
2013-03-13 03:42:41 -04:00
Tyler Anthony Romeo
4dcc7961df Fixed @param tags to conform with Doxygen format.
Doxygen expects parameter types to come before the
parameter name in @param tags. Used a quick regex
to switch everything around where possible. This
only fixes cases where a primitve variable (or a
primitive followed by other types) is the variable
type. Other cases will need to be fixed manually.

Change-Id: Ic59fd20856eb0489d70f3469a56ebce0efb3db13
2013-03-11 13:15:01 -04:00
Antoine Musso
6c35b02aa7 phpcs: Normalize methods declarations to "[final abstract] [visibility]".
CodeSniffer sniff is:
  [abstract final] [<visibility>] [static] function
As declared by:
  PSR2.Methods.MethodDeclaration.StaticBeforeVisibility
in:
  https://github.com/wikimedia/mediawiki-tools-codesniffer/blob/master/MediaWiki/ruleset.xml


Change-Id: Ifabd289e8668019ed752bdd711b3b43a9c346336
2013-02-19 16:56:35 +00:00