Commit graph

264 commits

Author SHA1 Message Date
daniel
45a197b1a5 (bug 42948) $wiki parameter for getRevisionText().
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
2012-12-11 13:03:20 +01:00
daniel
d4d929b352 fix conflict marker in comment
Change-Id: I23e9593890ab5899e10d8eb61f63f38fb98072a7
2012-11-12 14:37:32 +01:00
daniel
2b440f71ea (Bug 41244) Gracefully handle failure to load text blob.
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
2012-11-10 15:58:17 +01:00
Alexandre Emsenhuber
1f8652df65 Follow-up I551a90b0 (c2172d4): add one more check for null content
Change-Id: Ifa26ea8df0c5dd1f4c6ecabb9c8020bb84401ea3
2012-11-10 14:02:51 +01:00
daniel
c2172d45e4 Beware that getContent() may return null
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
2012-11-09 19:45:12 +01:00
Siebrand Mazeland
2f91a00343 Add since 1.20 for Revision::READ_LATEST
Change-Id: Ifd33f6eca5478e2dc4d8092d509d5ca4f3eda34a
2012-11-08 07:04:02 +01:00
Demon
dc0e410e29 Merge "(Bug 41574) Supply Title object to Revision if possible." 2012-11-01 16:48:48 +00:00
daniel
b5b2b2f898 (Bug 41574) Supply Title object to Revision if possible.
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
2012-11-01 13:48:18 +01:00
daniel
ff31d6eb39 (Bug 41617) Fix undelete.
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
2012-11-01 12:12:11 +01:00
RobLa
789e45bdc9 Revert "(Bug 41436) Tone down sanity check, just warn, don't die."
This reverts commit 770b6519be

This seems to have introduced bug 41606.  By reverting, we get an exception rather than complete data loss.
2012-11-01 04:58:19 +00:00
daniel
770b6519be (Bug 41436) Tone down sanity check, just warn, don't die.
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
2012-10-29 19:51:50 +01:00
daniel
8498a4f575 (Big 41436) Make sure Revision knows page Title.
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
2012-10-29 16:31:16 +01:00
Reedy
df60d0ccf2 Fixup some method documentation return types
Remove an unused getTitle

Change-Id: Ic34ea605b39568f582d5f4f90cf36d3d654e4746
2012-10-17 23:04:22 +01:00
Demon
51c25010b5 Merge "Removed READ_LATEST default from Revision::newFromTitle()." 2012-10-15 14:57:02 +00:00
daniel
09c607f7b9 Silence warnings about deprecation by ContentHandler.
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
2012-10-12 14:56:02 +02:00
Aaron Schulz
63c82eeed7 Removed READ_LATEST default from Revision::newFromTitle().
Change-Id: I12bc0285147fff8d6f523a38950cf3f3cb51933f
2012-10-09 16:35:51 +00:00
IAlex
d29e334c63 Merge "Removed READ_LATEST default from Revision::newFromPageId()." 2012-10-09 16:21:14 +00:00
Siebrand Mazeland
d4b046a893 Update docs for return and exception info
* Removed some inline tabs in the process.
* IDE fixed some incorrect leading spaces, too.

Change-Id: Ic9303eff6db4424ac3f1fa2816839692b43e6190
2012-10-09 09:41:58 +00:00
daniel
bb51a58e57 Cleanup of Wikidata branch.
This cleans up several issues raised in comments to I3b2dad3a,
mostly style and merge artifacts.

Change-Id: I99f5e300a671db1353db151cd187ffd2e4478d03
2012-10-08 17:34:47 +02:00
daniel
7db9491d89 set mediawiki version number
Change-Id: I3479776bd3bb25c4d75d07e62ede2ad989025c5b
2012-10-05 15:03:24 +02:00
Aaron Schulz
402da95a4b Removed READ_LATEST default from Revision::newFromPageId().
Change-Id: If3feb424314be5db88cb0f25c0358b3be4cad572
2012-09-26 13:40:18 -07:00
daniel
b6b686c13b merged master
Change-Id: I0ef7c7f33a5dc5855f38b20c03ddc5306f38ec66
2012-09-19 12:34:10 +02:00
daniel
c4ff922e64 Make userWasLastToEdit reusable.
Make userWasLastToEdit a static method in the Revision class, so it can be
reused by extensions, etc.

Change-Id: Ib44423c3544dabab3be7fe6eb675315f2480838e
2012-09-03 12:22:52 +02:00
daniel
9994968774 merged master
Change-Id: Ib2b879c4daa17401eeeb50767c0e5a54254855c3
2012-08-29 15:20:15 +02:00
Daniel Kinzler
392af46809 Revert "merged master"
This reverts commit 67bfdc7a68
2012-08-29 13:14:49 +00:00
daniel
67bfdc7a68 merged master
Change-Id: Ib2b879c4daa17401eeeb50767c0e5a54254855c3
2012-08-29 12:06:38 +02:00
daniel
4339e201be Merge "Revision::getContent must return clone if mutable" into Wikidata 2012-08-28 11:40:32 +00:00
aude
5f7b761fa4 add docs for getContentInternal()
Change-Id: I87a0c9908975c236794bad39209ad8bdef4699c3
2012-08-22 19:57:53 +00:00
Aaron
e5e3fbb6f5 Fixed READ_LOCKING bitfield check
Change-Id: Ia37761bc21a37cad4d8357b9cbfc623b59065a11
2012-08-22 12:18:42 -07:00
daniel
266b66c899 Revision::getContent must return clone if mutable
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
2012-08-21 12:48:29 +02:00
daniel
0139923580 fixing long lines
Change-Id: Iebcd40a1a37a3a93cc571fa2c2b0a87f53dc97a4
2012-08-20 21:33:07 +02:00
daniel
29719f846b merging latest master
Change-Id: I36b7f2f63ab8c08f8412d521dc68ea45c8b67711
2012-08-20 16:55:28 +02:00
umherirrender
aff21af9ae Allow aliased field names with separated syntax
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
2012-08-15 15:16:09 +02:00
Aaron Schulz
eb183bac87 Revision and WikiPage cleanup with IDBAccessObject interface.
* 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
2012-08-08 16:34:08 +00:00
daniel
d87135d706 merged master
Change-Id: Iad12ee382d6aeb1fab6fefb611d290b74865ea4b
2012-07-23 22:07:18 +02:00
Tim Starling
fcd74e5dd3 Merge "Reduced some master queries by adding flags to Revision functions." 2012-06-28 05:11:04 +00:00
Aaron
8288b34eae Reduced some master queries by adding flags to Revision functions.
* 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
2012-06-27 20:59:20 -07:00
daniel
906a1ba51f [bug 37746] string ids for content model and format.
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
2012-06-26 15:56:06 +02:00
daniel
b801fa8b3b merged master
Change-Id: I6cf08c09c7d9b38ecce0b2bbed61431939edd7d4
2012-06-20 19:13:16 +02:00
umherirrender
fb9bd9c006 (bug 37301) add sizediff to list=usercontribs
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
2012-06-16 09:47:11 +02:00
daniel
429ae88de2 cleanup for comments and edge cases 2012-06-08 11:45:10 +02:00
daniel
2ce15203a6 getting rid of getRawText() 2012-06-08 08:34:38 +02:00
daniel
db0560f00a Added consistency checks to Revision.
This is to avoid corruption arising from confusion about which revision
uses which data model and format.
2012-06-07 17:35:37 +02:00
daniel
03a2cb6999 some cleanup and checks in the Revision class 2012-06-07 17:23:05 +02:00
daniel
48d0bedd78 cleanup and fixes for secondary data updates 2012-06-07 14:57:43 +02:00
daniel
3ac92cafb0 Merge branch 'Wikidata' of ssh://gerrit.wikimedia.org:29418/mediawiki/core into Wikidata 2012-06-06 17:43:57 +02:00
jeroendedauw
a7e28d2011 merged master
Change-Id: I4cf7b0f87cd571a6b50f66995dd9ad987a6ecdf8
2012-06-06 16:44:15 +02:00
awjrichards
c29fd59775 Big oops - merged to wrong branch.
Revert "Revert to arbitrarily old point before initial remote branch creation to help clean up"

This reverts commit ee0d3d330f
2012-06-05 22:58:54 +00:00
daniel
e134e3fecb comments and fixes from review session with tim. 2012-06-03 19:46:07 +02:00
awjrichards
ee0d3d330f Revert to arbitrarily old point before initial remote branch creation to help clean up
Change-Id: I41a3d1e55d3ea9dffa42451237fe065f9334361d
2012-06-02 08:43:04 -07:00