Revision::getRevisionText should take wiki identifier, to allow for the loading
of revision blobs from another wiki's database. This is passed through to
ExternalStoreDB, so it uses the correct database connection.
Change-Id: I14a7ebb8aa31a4e50735db9c28ff8d2759cd872c
This change fixes fatal errors ocurring when Revision::loadText
returns false because of a failure to load the text blob.
Revision::getContent() should simply return null in such a case.
Change-Id: I1e13de14ff15b124b5a2e07155d368595a16fda7
Before the introduction of the content handler, missing content was
signified by getText() returning null instead of a string. null will
work much like an empty string in most contexts, so in many places,
it was not checked explcitely whether the conent was null.
Now, when getContent() returns null, this often caused a fatal error,
because the code would access whatever getContent() returned as an object,
without checking whether it was null (because no such check was performed
previously, when the content was represented as a string).
This check introduces explicite checks for getContent() returning null
in the most essential core classes.
Change-Id: I551a90b0b67b8edc7570ca5d252ecc1de903f097
The Revision object needs the Title to determine the default content model.
Providing the Title explicitely wherever possible avoids an extra database
lookup. Most importanlty, this fixes fatal errors that ocurr when the
database lookup fails due to slave lag or transaction state.
Change-Id: I516e82f7a893b274c513b128b8a46db491160b55
Undeletion was broken twice:
1) originally, it failed silently, restoring revision entries with
the wrong number in rev_page.
2) I789e45bd restores an overly zealous sanity check, causing
undeletion to fail with a fatal error.
This change fixes both issues.
Change-Id: I796fe54e81773f7982ae9bc15ba30f2a2ee3f174
This is a follow-up to I9db228c3 fixing an issue with undelete:
Page ID 47009 mismatches the ID 47010 provided by the Title object.
Backtrace:
0 /var/www/CephWiki/core/includes/Revision.php(188): Revision->__construct(Array)
1 /var/www/CephWiki/core/includes/specials/SpecialUndelete.php(548): Revision::newFromArchiveRow(Object(stdClass), Array)
2 /var/www/CephWiki/core/includes/specials/SpecialUndelete.php(381): PageArchive->undeleteRevisions(Array, false, '')
3 /var/www/CephWiki/core/includes/specials/SpecialUndelete.php(1510): PageArchive->undelete(Array, '', Array, false, Object(User))
4 /var/www/CephWiki/core/includes/specials/SpecialUndelete.php(778): SpecialUndelete->undelete()
5 /var/www/CephWiki/core/includes/SpecialPage.php(599): SpecialUndelete->execute(NULL)
Change-Id: I0517c5826bcba2a85fee596b0473a16da26c3b2f
With $wgContentHandlerUseDB, Revision needs access to the page's Title
object to determin the page's default content model. This apparently
failed in production for newly created pages (supposedly because of
some complication with database transactions or master/client setup).
This change makes WikiPage::doEditContent pass the Title object
directly to the Revision to avoid any database issues. This also
gets rid of a pointless database read.
Change-Id: I9db228c3fcda0f8dfe52be1659014a6e4b4775af
The introduction of the ContentHandler caused quite a few functions and hooks to
become deprecated. Usage of these has been removed in core, but is still present
in extensions. Extensions should be fixed after ContentHandler has settled in a
bit, but for now we need a way to silence the warnings.
Change-Id: Ia223243222675f778e8f8c32923f956790db0b4f
Make userWasLastToEdit a static method in the Revision class, so it can be
reused by extensions, etc.
Change-Id: Ib44423c3544dabab3be7fe6eb675315f2480838e
Revision::getContent must return a cloned instance of the Content object
if the Content object is mutable to avoid confusion.
Content::copy is used to achieve this, which is specified to return $this
for immutable Content.
Change-Id: Iace17b6ae8aa85a3500624441b69bc067c1ade00
This introduce the syntax from aliased table names for aliased field
names into the abstract database layer:
array( 'alias' => 'field' ) gives 'field AS alias'
This patch also includes changes to query pages, api and some more
places to show, how the new syntax looks in "production".
This allow us to remove the "AS" for Non-PostgreSQL databases, if we
want that.
Change-Id: I5f0de1c2f29092c173aec3de93ffdef436799e8d
* Replaced WikiPage::DATA_FROM_* constants with IDBAccessObject ones.
* Renamed IDBAccessObject constants a bit for visual consistency.
* Removed AVOID_MASTER parameter and replaced calling instances with READ_NORMAL.
Instead of getting page_latest from the master and the revision from a
slave, just get it all from the master in one RTT. Most callers used
AVOID_MASTER (and now READ_NORMAL), so this case is barely hit anymore.
Change-Id: Ifbefdcd4490094b38e49bbb46c95fdb71b5c9e1a
* The main Revision functions now allow various QoS and locking flags.
* Added tiny DBAO interface add made Revision implement it.
Since a lot of objects will need (or have) the same functionality.
* Use "self" keyword in Revision class consistently.
* Made Revisison::newFromConds() private.
Change-Id: I3139956999218a2bb44b5c845b8079e33b2328bb
The content model is stored as a varbinary(32), the format
as varbinary(64).
If the standard model resp. format is used, null is written
to the database instead of the actual id, saving space.
Change-Id: I32659b49a9ad3cb8ecae9019562cff7de42b65f9
Moving function getParentLength from SpecialContributions to Revision
and use it in the list module. The size of the parent is selected by a
batch, like the special page.
Change-Id: I6e388e75cd765f2a918b0c192477d87347e96bcd