Commit graph

206 commits

Author SHA1 Message Date
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
Aaron
e5e3fbb6f5 Fixed READ_LOCKING bitfield check
Change-Id: Ia37761bc21a37cad4d8357b9cbfc623b59065a11
2012-08-22 12:18:42 -07: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
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
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
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
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
Demon
1dc986a90f Merge "[FileRepo] Made getDescription() respect *_deleted fields." 2012-06-04 20:41:52 +00:00
Alexandre Emsenhuber
799a291c70 Select all nedded fields for Title::newFromRow() when fetch a revision from the database.
Otherwise MW will throw an exception with the message "LinkCache doesn't currently know about this title"
when accessing redirect or len items of these Title objects, e.g. in Special:RevisionDelete.

Change-Id: I07978145df78bddac894bdac087c5d62b03759b3
2012-06-02 18:39:20 +02:00
Aaron Schulz
37c2fde15d Merge "Revision::getTitle produce rev_id IS NULL query" 2012-05-31 17:06:50 +00:00
umherirrender
e778bf886c setTitle on a new null revision
Revision::getTitle will make a query against slave to load the title on
demand. But when there is a slave lag, the slave does not know the new 
revision id and the caller gets null back

Change-Id: Ia85866362715ba666d51106037e7771d6bf4a237
2012-05-27 17:47:29 +02:00
umherirrender
4a279515f4 Revision::getTitle produce rev_id IS NULL query
Seen on Special:NewPages: Linker::revComment is calling
Revision::getTitle, but the revision object has no id set.
This is another way to avoid a query per non-empty comment on
Special:NewPages, see gerrit 9003

Change-Id: I1786a4c13000f574c0f34fb59759bb2fc4117bcd
2012-05-27 16:39:04 +02:00
Aaron
9f6afeab0d [FileRepo] Made getDescription() respect *_deleted fields.
Change-Id: I1dd54611501d6747fb4ad6cbe6b58b0010b1d6d4
2012-05-25 16:00:49 -07:00
Alexandre Emsenhuber
d1f8640a3b Added missing GPLv2 headers in some places.
Also made file/class documentation more consistent.

Change-Id: Ia45d0756cd84138da267bf1cbd1a58be7f28c6d1
2012-05-11 10:34:29 +02:00
Sam Reed
2d25a902e3 More of r113580 2012-03-11 22:05:54 +00:00
Jeroen De Dauw
abfdd0b617 fix doc 2012-02-13 19:13:30 +00:00
Sam Reed
09a78c1368 More return documentation 2012-02-09 21:36:14 +00:00
Alexandre Emsenhuber
0effbbca5c Select fields returned by Revision::selectPageFields() and call Title::newFromRow() instead of Title::makeTitle() in Revision::getTitle() so that it doesn't need a separate query to load the page id or the latest revision id. 2012-02-07 19:24:31 +00:00
Alexandre Emsenhuber
3c1fee1a7f Fixed string -> __METHOD__ in calling method parameter 2012-02-05 20:29:53 +00:00
Alexandre Emsenhuber
c6e1f399a5 Added 'page_id' to the fields returned by Revision::selectPageFields() so that the Title object created in Revision::__construct() already knows its id and it doesn't have to issue another DB query to load it (happens e.g. in api.php?action=parse&oldid=... calls) 2012-01-31 10:26:22 +00:00
Alexandre Emsenhuber
b1d0376c1e Fix bug 32948:
* {{REVISIONID}} and related variables are no longer blank after doing a null edit
* {{REVISIONID}} and related variables are no longer blank after calling action=purge&forcelinkupdate
2012-01-21 07:59:25 +00:00
Niklas Laxström
cd12049d41 @since, ping r101030 2012-01-13 21:50:13 +00:00
Alexandre Emsenhuber
a5ae31d045 Use wfTimestampNow() instead of wfTimestamp() without second parameter 2011-12-29 20:45:47 +00:00
Jeroen De Dauw
0b105ebf1d added missing deprecation notices 2011-12-13 19:51:03 +00:00
Sam Reed
d4c27f5c0b Fix:
PHP Notice: Undefined property: stdClass::$ar_sha1 in Revision.php on line 127
2011-12-13 16:57:02 +00:00
Chad Horohoe
08bcda145b Self-revert r105872, there's a deeper issue here 2011-12-12 13:45:33 +00:00
Chad Horohoe
3ce2ffe405 (bug 32984) ar_sha1 might not be set 2011-12-12 13:11:54 +00:00
Aaron Schulz
4b9c7efd8e Fix r101294: newNullRevision isn't using selectField() or the like...it needs to specify sha1 2011-10-30 20:32:11 +00:00
Aaron Schulz
a4c1ae1ba0 FU r101021: made newNullRevision() re-use the sha1 of the reference revision 2011-10-30 00:55:35 +00:00
Aaron Schulz
eac8538cd6 * Added pageJoinCond() and userJoinCond() to Revision and exposed them publicly
* Removed commented-out code
2011-10-27 19:55:00 +00:00
Aaron Schulz
c326cab516 Reinstated r94289 et all - rev_sha1/ar_sha1 field for bug 21860 2011-10-27 18:44:10 +00:00
Aaron Schulz
5dfe3d6444 Revision objects now always use the current name of users, loading it on demand if necessary (e.g. when given a $row with no user_name but rev_user is not 0) 2011-10-21 23:20:52 +00:00
Aaron Schulz
b3e0ca374d * Simplified r100286 by just using the field 'user_name' and removed the COALESCE
* Simplified contribs pager with Revision::selectFields()
2011-10-20 03:03:45 +00:00
Aaron Schulz
981bdc1187 FU r100300, r100286:
* Updated link batch code in MergeHistory
* Marked some Revision functions explicitly public
2011-10-20 00:41:48 +00:00
Aaron Schulz
5db15361bc FU r100286: Added sanity check to fetchFromConds() join conds 2011-10-19 23:56:48 +00:00
Aaron Schulz
bbf11e8cf0 * Tweaked Revision class to handle loading the current user name instead of rev_user_text. It still falls back to rev_user_text when building objects from DB rows for b/c.
* Moved JOIN conds to fetchFromConds() as that's where the tables are specified. This lets us avoid the same page_id=rev_page join conds plastered all over the code. Also, we can't mix WHERE and JOIN style join conds.
* Removed duplication in fetchFromConds() by using selectPageFields().
* Removed duplicate rev_parent_id field from contribs SELECT.

Yo make use of these changes, Pagers and lists still need to be updated to use Revision::selectUserFields() and join on the user table.
2011-10-19 22:25:26 +00:00
Aaron Schulz
59e2f3e091 Code cleanups & fixed strange comma 2011-10-19 21:21:20 +00:00
Alexandre Emsenhuber
0da17a29c3 * Added User paremeter to Revision::userCan(), Revision::userCanBitfield(), LogEventsList::userCan(), LogEventsList::userCanBitfield(), File::userCan() and its subclasses so that they can check against any user instead of always $wgUser.
* Updated callers that have a context or may use another user than $wgUser
* Revision::getUser(), Revision::getUserText(), Revision::getComment() and Revision::getText() also have a User as parameter, but it will be used only when Revision::FOR_THIS_USER is passed in the first parameter
2011-10-12 15:09:04 +00:00
Sam Reed
937fc3bcfd Back out r95396 and friends 2011-09-29 22:08:00 +00:00
Sam Reed
44020e254c Merge the iwtransclusion branch back into trunk
Hexmode fixed broken unit tests in revisions after last time
2011-08-24 13:03:03 +00:00
Brion Vibber
95300b2e55 Followup r94541 (reverts of r94289 undiscussed core schema change and followups), two more that got missed: reverts of r94290, r94364 2011-08-15 18:52:33 +00:00
Aaron Schulz
86c7992100 * Added Revision::getSha1 function
* Try to populate mSha1 when a Revision is made from an array (as rev_len does)
2011-08-12 17:29:57 +00:00
Aaron Schulz
1689b6ec10 Follow-up r94289: code changes to fill the new fields on insertion and select them 2011-08-11 21:54:46 +00:00
Sam Reed
b85469eceb Whitespace and comment updates 2011-08-05 16:05:41 +00:00
Sam Reed
704bcb4781 Add @since to Revision::newFromRow per Nikerabbit
Follows up r93935
2011-08-05 12:29:39 +00:00
Sam Reed
71ce734b14 Adding Revision::newFromRow() function as alias for new Revision()
More consistent with how we do stuff everywhere else
2011-08-04 23:25:34 +00:00
Sam Reed
a2bf7c35f7 Tweak/add to documentation
Remove old compat constants for "1.6 compatibility"
2011-08-03 00:19:27 +00:00
Sam Reed
183d2dab37 Back out r93533, r93531, r93530
Breaks unit tests as below, not going to be able to fix them before I disappear for the evening, so might aswell leave trunk clean

ArticleTablesTest testbug14404

Error:
ArticleTablesTest::testbug14404
Undefined offset: 0

/home/ci/cruisecontrol-bin-2.8.3/projects/mw/source/tests/phpunit/includes/ArticleTablesTest.php:31
/home/ci/cruisecontrol-bin-2.8.3/projects/mw/source/tests/phpunit/MediaWikiTestCase.php:60
/home/ci/cruisecontrol-bin-2.8.3/projects/mw/source/tests/phpunit/MediaWikiPHPUnitCommand.php:20
/home/ci/cruisecontrol-bin-2.8.3/projects/mw/source/tests/phpunit/phpunit.php:60

ParserTests testParserTest #552 - testParserTest with data set #551

Failure:
ParserTests::testParserTest with data set #551 ('RAW magic word', '{{RAW:QUERTY}}', '<p><a href="/index.php?title=Template:QUERTY&amp;action=edit&amp;redlink=1" class="new" title="Template:QUERTY (page does not exist)">Template:QUERTY</a>
</p>', '', '')
RAW magic word
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-<p><a href="/index.php?title=Template:QUERTY&amp;action=edit&amp;redlink=1" class="new" title="Template:QUERTY (page does not exist)">Template:QUERTY</a>
+<p><a href="/index.php?title=Template:RAW:QUERTY&amp;action=edit&amp;redlink=1" class="new" title="Template:RAW:QUERTY (page does not exist)">Template:RAW:QUERTY</a>
 </p>

/home/ci/cruisecontrol-bin-2.8.3/projects/mw/source/tests/phpunit/includes/parser/NewParserTest.php:545
/home/ci/cruisecontrol-bin-2.8.3/projects/mw/source/tests/phpunit/MediaWikiTestCase.php:60
/home/ci/cruisecontrol-bin-2.8.3/projects/mw/source/tests/phpunit/MediaWikiPHPUnitCommand.php:20
/home/ci/cruisecontrol-bin-2.8.3/projects/mw/source/tests/phpunit/phpunit.php:60
2011-07-30 15:56:54 +00:00