* This is a more specific form of the logic removed in 3c2bc32ae1.
It does not suffer the problem of causing constant master DB
queries due to a bad template reference or such.
* It will use the master if writes from the current thread
are pending or were recently committed. This deals with the
common problem of code that needs to read things it just wrote,
such as diffs on rollback or edit hooks.
* This commit reverts 8624e261f by making the hack obsolete.
Bug: T93866
Bug: T94407
Change-Id: Ib9ecb75e1236e767bdc86d124d5e22a03ae0fb5f
Somehow, revisions are getting added to the database without issue but
page_latest is being set to 0 rather than the newly-added revision ID.
Grepping through the code, the only places page_latest gets set are
WikiPage::insertOn() (which isn't relevant for an edit of an existing
page) and WikiPage::updateRevisionOn(). And the only relevant-looking
place WikiPage::updateRevisionOn() gets called seems to be
WikiPage::doEditContent(), which calls Revision::insertOn() just before
which *should* be setting the mId on the revision object.
Since there's no obvious bug in the code, let's add some checks to make
sure that the revision ID isn't 0. If we see exceptions being thrown, at
least we'll have narrowed down the places we need to look more deeply.
And if not (and the bug continues to be reported), we'll at least know
this part is working right.
Bug: T92046
Change-Id: I8cc60593fafb5702e29186ec14cb9d87f1767ef4
Added a truncate for multibyte characters to Revision::newNullRevision.
This avoids broken characters for long comment, mostly the comment for
move or protection in the history.
The whole comment is still visible on Special:Log.
Bug: T85700
Change-Id: Ie0863261484ee99006407c12c3a920ea476925e3
Revision->getRawUser()
=> Revision->getUser( Revision::RAW )
Revision->getRawUserText()
=> Revision->getUserText( Revision::RAW )
Revision->getRawComment()
=> Revision->getComment( Revision::RAW )
The body of Revision->getRawUserText() has been moved
into Revision->getUserText().
Every usage has been replaced.
Change-Id: Ic6fbfbc0507dcf88072fcb2a2e2364ae1436dce7
Xhprof generates this data now. Custom profiling of various
sub-function units are kept.
Calls to profiler represented about 3% of page execution
time on Special:BlankPage (1.5% in/out); after this change
it's down to about 0.98% of page execution time.
Change-Id: Id9a1dc9d8f80bbd52e42226b724a1e1213d07af7
When a revision's size is 0, don't clobber it by changing it to null. This
causes, among other things, moves of empty pages to not show a revision
size. If we get to where the else used to be, either mSize is 0 (and doing
nothing is correct), or mSize is already null, in which case this didn't
do anything anyway. We know this because, above, we initialized it with
$this->mSize = isset( $row['len'] ) ? intval( $row['len'] ) : null;
Change-Id: I3d9b9163368c57b9a7906f6569119081b945d57e
- Added space after reserved words: function, foreach, if
- Combined 'else if' into elseif
- Added braces to one-line statements
- Added spaces after comma, before parentheses
Change-Id: Ie5bbf680d6fbe0f0872dab2700c16b1394906a72
- 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: I783e4dbfe5f6f98b32b9a03ccf6439e13e132bcc
In this change, a new passive user right named "viewsuppressed"
which can be used in order to view suppressed page content was added
to MediaWiki core.
Furthermore, this right was also added to the list of available rights,
to qqq.json and to en.json where also the description of the
"suppressrevision" right was adjusted in order to reflect reality.
Bug: 20476
Change-Id: Id1baacb9c782763db5e05ef8b5c1b761997efcc9
- Remove isset for defined member variables
- Add a missing definition of member variable $mTextId
- Fix documentation of $mTextRow
- Standardize checks for null to use "=== null" or "!== null"
instead of is_null()
Change-Id: I56e364bc14b5a3961a2538371ae4b0088babc5c7
See Revision::newFromArchiveRow(). This is called from
populateRevisionLength.php's upgradeRow() which ultimately populates
$row from the fields returned by Revision::selectArchiveFields().
Revision::newFromArchiveRow() has the following condition:
if ( isset( $row->ar_text ) && !$row->ar_text_id ) {
And from the bug report:
> for old archived revisions, the rows in the archive table do _not_
> contain a pointer to the text in the text table, but that the text
> is stored in the archive table directly. Obviously the above code
> cannot handle this situation properly.
Credit goes to Joerg who found this and figured out the problem.
Bug: 65765
Change-Id: Iadcaae5e531d439780f5b6095286df78926ccaa7
Existing edit conflict logic relies on second-resolution timestamps,
which can fail in many exciting ways. This patch provides new support
functions which take an explicit revision ID instead of a timestamp.
No functionality is changed. Hopefully.
TODO:
* Make use of this code by replacing all edittime and starttime logic
with an explicit baseRevId.
Change-Id: I83cdd4adaaa67f81e933654228eccdc9fcdf9009
This avoids the use of $wgUser in Revision constructor and makes the
dependency on the global visible.
Change-Id: Ib67bd706a3c4ef081f475406e9aa1094c42222ef
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: Ie592d31e85651663e3b3e1aa4ee7c270d06d0c81
Variants included 'in <version>', 'as of <version>' and just the
version number.
Some @deprecated annotations do not have the version number at all,
I want to hunt them down separately.
Change-Id: I8208c6097098f4735d4f51bc42254675f1f27f6d
No uses found in core of Gerrit extensions.
- Revision::revText() (deprecated in 1.17)
- SkinTemplate::jstext() (deprecated in 1.21)
- WikiPage::quickEdit() (deprecated in 1.18)
- WikiPage::useParserCache() (deprecated in 1.18)
- WikiPage::viewUpdates() (deprecated in 1.18)
Change-Id: I9eee23ea3ce381b6b8373da899287bcaea4cead4
The Line continuation Coding conventions prefers the closing parenthesis
on the same line than the beginning curly braces. This is done for ifs
and functions.
Also move some boolean operator from the end of a line to the beginning
and changed some indentation to make the condition hopefully better
readable.
Change-Id: Id0437b06bde86eb5a75bc59eefa19e7edb624426
- Place commas correct
- Moved comments
- Add space after if/foreach/catch
- Reformat some conditions
- Removed trailing spaces/tabs
Change-Id: I40ccda72c418c4a33fcd675773cb08d971510cdb
The fallback to master makes sense in Revision::newFromId(), since a
revision ID known to exist by some other means might be present in the
master but not in the slave. But it doesn't make sense for
Revision::newFromTitle(), where by far the most common cause of this
case being hit is the page being nonexistent.
Change-Id: I41189fcde1b8065ac134982241376d63b78732a1
compressRevisionText() is already publicly available, but the decompression was
not. For others using compressRevisionText(), the only way to decompress was to
duplicate the gzinflate code.
Change-Id: I61cd87acb52a482ba88f7c9d3826ecee66c89911
This became necessary as it's quite hard to
get the rc id of a change from the html after
I1e24733c.
Bug: 49259
Change-Id: Ia7d3960cf11bf8ae0fc06ae1a0f7fcfb3c080f21