Commit graph

292 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
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
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
daniel
250da851d1 merged master 2012-05-29 17:01:13 +02: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
daniel
01f36b721f merged latest master 2012-05-14 23:24:18 +02:00
daniel
cbc2014b2d Use integers for content_model and content_format.
Representing content_model and content_format as integers in the
database was suggested by Asher mainly to save space.

This change entails some refactoring and renaming, but no big
change in logic.
2012-05-14 10:22:52 +02: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
daniel
060b6c74c6 implement feature switch for ContentHandler database integration, to allow for easy deployment 2012-05-02 15:41:47 +02:00
daniel
22103fbd43 spaces -> tabs 2012-04-30 18:23:17 +02:00
daniel
cd5860da57 docu cleanup; marked contenthandler stuff as @since 1.WD 2012-04-26 13:24:13 +02:00
daniel
f99a1f3cb9 make sure revisions are created consistently in case a content object is supplied 2012-04-23 11:30:24 +02:00
daniel
12ac655f8d fix handling of per-revision content model if different from title's default content model 2012-04-23 10:08:59 +02:00
daniel
234059c4a8 fix incomplete rename of unserialize to unserializeContent 2012-04-17 23:29:22 +02:00
Jens Ohlig
10e91851b2 Merge branch 'master' into Wikidata
Conflicts:
	.gitreview
	includes/Article.php
	includes/AutoLoader.php
	includes/EditPage.php
	includes/LinksUpdate.php
	includes/WikiPage.php
	includes/installer/Ibm_db2Updater.php
	includes/installer/MysqlUpdater.php
	includes/installer/OracleUpdater.php
	includes/installer/SqliteUpdater.php
	maintenance/refreshLinks.php
2012-04-11 14:24:29 +02:00
Daniel Kinzler
8b870be6e1 baby steps towards editing structured data 2012-04-04 19:59:09 +02:00
Daniel Kinzler
f037d4deee isCountable() 2012-04-04 19:56:34 +02:00
Daniel Kinzler
d2cd543276 fixed bad calls 2012-04-04 19:55:04 +02:00
Daniel Kinzler
951633e51f fixed several bugs (this is still a mess) 2012-04-04 19:54:50 +02:00
Daniel Kinzler
bdbe861d34 replacing deprecated getText, etc 2012-04-04 19:54:06 +02:00
Daniel Kinzler
efdb25653d adapted WikiPage and Article (work in progress) 2012-04-04 19:44:44 +02:00
Daniel Kinzler
8ede0ad20e integration with Title and Revision (work in progress) 2012-04-04 19:41:52 +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
Sam Reed
dc9d39887e Merge iwtransclusion branch into trunk 2011-07-30 15:30:01 +00:00
Aaron Schulz
e880aed65f Fixed newFromArchiveRow to check for ar_page_id 2011-07-25 18:19:48 +00:00
Alexandre Emsenhuber
419021ebf0 Removed some error suppression operators 2011-07-08 18:17:02 +00:00
Aaron Schulz
cc7eac0320 Fixed bogus $conds in r91327 2011-07-01 23:46:20 +00:00
Aaron Schulz
893d84b6aa * Fixed getLatest() check in Article
* Added Title::loadFromRow() function and made WikiPage::loadPageData() use it; avoids raw Title field accessing
* Added Revision::newFromPageId() function and changed WikiPage::loadLastEdit() to use it. This makes it try a slave first instead of always hitting the master. It also makes it more consistent with getLatest() for sanity.
* Made WikiPage::loadPageData() use accessor for Title::mRestrictionsExpiry
2011-07-01 23:33:34 +00:00
Alexandre Emsenhuber
794dc8dffb Fix for r90429: removed call to protected method 2011-06-20 07:45:19 +00:00
Sam Reed
ba2c3a793d And even more documentation in various files 2011-05-29 14:25:20 +00:00
Sam Reed
b15737fa83 And even more documentation, the last of this batch 2011-05-28 19:00:01 +00:00
Mark A. Hershberger
0a49fd69b0 Misc EOL w/s and spaces-instead-of-tabs fixes. One day I'll get around to nagging people for this stuff, but for now, I'll JFDI myself. 2011-05-25 15:39:47 +00:00
Siebrand Mazeland
75c6696aa8 Use consistent notation for "@todo FIXME". Should update http://svn.wikimedia.org/doc/todo.html nicely. 2011-05-17 22:03:20 +00:00
Sam Reed
15df9a9d5c Kill off the long deprecated $wgInputEncoding and $wgOutputEncoding globals 2011-05-06 22:09:47 +00:00
Sam Reed
21d35067b9 Kill some more long deprecated unused functions
Add more @deprecated since where appropriate
2011-05-06 21:09:34 +00:00
Happy-melon
d40bad43f8 Type hinting and documentation tweaks. This file is actually pretty good... 2011-04-25 17:34:30 +00:00
Aaron Schulz
b7bcf1b498 * Made pageDataFromTitle protected (unused elsewhere)
* Split out selectFields() for easier use of loadPageData()
* Marked Revision::selectFields as public (was used as such)
2011-04-12 20:21:16 +00:00