Commit graph

161 commits

Author SHA1 Message Date
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
daniel
a6c9dcc13e Adding sanity check to the LinksUpdate() constructor.
The check makes sure that the page id is known for the title
passed to the constructor. LinksUpdate needs to know this id in
order to update the various links tables. If the page id is not
known to the title (e.g. because the page doesn't actually exist)
something is wrong, and LinksUpdate can't operate.

Amend: use MWException instead of assert()

Change-Id: I4873211a71099fe3563b52a53532c95b6a2ff30f
2012-05-29 15:44:58 +02:00
Aaron Schulz
060ba3cb68 Merge "Generalizing LinksUpdate to allow extensions to add arbitrary update handlers." 2012-05-14 22:20:04 +00:00
daniel
a12ce17c6e Generalizing LinksUpdate to allow extensions to add arbitrary update handlers.
This supercedes I6d03bf2a, using better names for the new classes and
incorporating the changes requested by Aaron.

This change introduces the base class SecondaryDataUpdate to be used for any
updates that need to be applied when a page is changed or deleted. Until now,
this was done by the LinksUpdate class for updates and WikiPage::doDeletionUpdates
upon deletion. This patch uses a list of SecondaryDataUpdates in both cases.

This allows extensions (e.g. via the ContentHandler facility, once that is in) to
easily specify what needs to be done when a page is updated or deleted in order to
keep any secondary data stores (such as link tables) in sync.

Note that limited transactional logic is also introduced, so SecondaryDataUpdate
can be implemented to only commit their changes if all updates were performed
sucessfully.

Patch Set 2: fixing some coding style issues mentioned by Nikerabbit.

Patch Set 4: some stuff I kept from the old LinksUpdate class needs cleanup,
             but might break extensions when changed. Marking as todo for now.

Patch Set 5: fixed misnamed member in LinksDeletionUpdate (thanks Aaron).

Change-Id: Ibe3e88fadd8c1d4063cf13bb6972f2a23569a73f
2012-05-13 20:53:37 +02:00
Alexandre Emsenhuber
a682b7335a Added missing GPLv2 headers in some places.
Also made file/class documentation more consistent.

Change-Id: I0db3461139284edcb6ac02923eb83d54e6756ffb
2012-05-12 22:33:51 +02:00
Alexandre Emsenhuber
d6b1c9c397 Fix exception's text: use __construct() instead of class name for constructor and WikiPage::doEditUpdates() instead of Article::editUpdates() 2012-02-12 15:37:29 +00:00
Max Semenik
571ae5bdfc Follow-up r108137: @since 2012-01-05 18:05:54 +00:00
Max Semenik
44dc09e35d Accessor for LinksUpdate's parser output 2012-01-05 13:00:37 +00:00
Roan Kattouw
d045b999ec (bug 29854) Store protocol-relative links twice in the externallinks table, one with http: in el_index and once with https: . Modified patch by Brad Jorsch 2011-11-14 09:13:58 +00:00
Alexandre Emsenhuber
7790359031 Use WikiPage instead of Article to call updateCategoryCounts() 2011-11-06 20:39:20 +00:00
Sam Reed
e330563a9f Followup r101241, after removing @private set private modifier as they are indeed private... 2011-11-05 14:20:00 +00:00
Sam Reed
52cd34acf5 More documentation 2011-10-29 01:53:28 +00:00
Sam Reed
82a690a318 Die @private 2011-10-29 01:49:00 +00:00
Sam Reed
937fc3bcfd Back out r95396 and friends 2011-09-29 22:08:00 +00:00
Sam Reed
cab75251da Followup r95396
Fix seemingly merge artefacts to kill $wgWikiID and the undefined $prefix
2011-09-01 15:58:43 +00:00
Sam Reed
7268b417d0 Followup r95396
Swap $wgGlobalDB for $wgGlobalDatabase
2011-08-31 15:00:23 +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
Victor Vasiliev
80a7648a42 Allow extensions to run their own backlink-based updates:
* Introduce new hooks which allow BacklinkCache to handle non-core tables
* Make table name a parameter to RefreshLinks2 job (instead of hardcoded templatelinks)
2011-08-13 22:42:09 +00:00
Mark A. Hershberger
97969f7d99 w/s changes: “svn diff -x-w” is clean 2011-08-01 16:01:13 +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
b00800fa48 Add FIXME on undefined variable 2011-07-30 15:51:58 +00:00
Sam Reed
e253003486 Followup r93530
Fix SqliteUpdater

Fix Undefined index: globaltemplatelinks in LinksUpdate
2011-07-30 15:41:39 +00:00
Sam Reed
dc9d39887e Merge iwtransclusion branch into trunk 2011-07-30 15:30:01 +00:00
Sam Reed
4fc982ebd9 Fix whitespace, documentation 2011-07-09 03:49:25 +00:00
Alexandre Emsenhuber
e7eaf43077 Added some GPL headers 2011-06-28 18:21:59 +00:00
Aaron Schulz
88e0a3b3db Broke some long lines 2011-06-15 17:03:18 +00:00
Sam Reed
1fcb3715cc Revert r85799 2011-04-11 18:37:29 +00:00
Sam Reed
c67bfb7884 commons.wikimedia: (SQL Query hidden) from within function "LinksUpdate::incrTableUpdate". Database returned error "1205: Lock wait timeout exceeded; try restarting transaction (10.0.6.41)".
Per Krinkle on IRC
2011-04-11 16:42:23 +00:00
Sam Reed
2c6e16e5e5 Remove unused variables 2011-02-18 01:10:38 +00:00
Brian Wolff
13bb571b11 (follow up r79706 to address CR comments) Simplify some of the logic in LinksUpdate.php
Make it so that by default, the parser consdiers categories to have a sortkey of "" unless
specified otherwise. Before, the parser said the sortkey was the page name, and then in LinksUpdate
we reset the sortkey (prefix) to "" if it was the same as the page name.

This way, the parser uniformly outputs the sortkey prefix, instead of a mix between prefix or pagename.

It should be noted, this changes the output of api.php?action=parse for categories that do not have
a sortkey.
2011-02-05 02:16:13 +00:00
Tim Starling
eaeea84b44 * Introduced a non-dummy collation for $wgCategoryCollation, namely UCA with default tables.
* Added a maintenance script which generates a list of first letters. Unified Han are omitted for performance, and because they shouldn't be used as headings anyway. A future collation specific to Chinese would provide the KangXi radicals as "first letters".
* Provided a precomputed list of first letters. Used Unicode 6.0.0 data and ICU 4.2. 
* Moved collation functionality from Language to a Collation class hierarchy with factory function. Removed the recently-added methods from Language and updated all callers.
* Changed Title::getCategorySortkey() to separate its parts with a line break instead of a null character. All collations supported by the intl extension ignore the null character, i.e. "ab" == "a\0b". It would have required a lot of hacking to make it work.
* Fixed the uppercase collation to handle non-ASCII characters, redundantly with r80436. I don't think it's necessary to change the collation name as was done there, so I reverted that in the course of my conflict merge. A --force option to updateCollation.php might be nice though.
2011-01-17 14:02:22 +00:00
Brian Wolff
99839bf5f0 (Bug 25254) cl_timestamp gets updated on null edit where it shouldn't.
Caused by two things:
*after the new category collation stuff, the if this category has changed
code was comparing the user supplied sortkey, with the collation sortable
sortkey, which didn't work. (See also CR for r70415) This is new issue in 1.17
*If the sortkey was too long (long enough to get truncated by DB), then the
did this sortkey change code also failed since it was  comparing the 
non-truncated sortkey to the truncated sortkey. This issue is present
in older (all previous?) versions of mediawiki. This issue especially affects
non-latin wikis that use 3-byte characters.

This bug primarily is an issue for people using DPL type extension.

I wasn't sure if i should add RELEASE-NOTES, since i'm tagging this 1.17
2011-01-06 02:42:51 +00:00
Sam Reed
a2589ff8c6 Assignment in loop conditions suck
while ( $row = $dbw->fetchObject( $res ) ) { to foreach ( $res as $row ) in includes

Add some braces
2010-10-13 23:11:40 +00:00
Siebrand Mazeland
d9b6455f71 Remove comments related to no longer existent and relevant compatibility function for array_diff_key(). 2010-10-02 22:42:44 +00:00
Aryeh Gregor
dcd5d260d4 Further categorylinks schema changes
Per review by Tim, I made two changes:

1) Fix cl_sortkey to be varbinary(255).

2) Expand cl_collation to varbinary(32), and change $wgCollationVersion
to $wgCategoryCollation, to account for the variety of collations we
might have.  tinyint is too small.  I could have gone with int, but
that's annoyingly inscrutable in practice, as we all know from namespace
fields.

To make the upgrade easier for non-trunk users, I updated the old patch
file to incorporate the new changes, using the updatelog table so that
people upgrading from 1.16 won't have to do two alters on categorylinks.
I didn't test the upgrade-from-1.16 code path yet, so if anyone tests
that and it seems not to break, commenting to that effect would be
appreciated.

Also removed wfDeprecated() from archive().  Do *not* add this to
functions that are still actively used in core.  If you think this
function is so terrible that it really mustn't be used, remove callers
yourself, don't pester every single developer with messages in the hope
that someone else will do it for you.
2010-09-03 20:52:08 +00:00
Chad Horohoe
9e6c7cc8ef Get rid of PHP4-style constructors 2010-08-30 16:52:51 +00:00
Chad Horohoe
4c74490bb8 Big commit: kill almost every freeResult() call as useless 2010-08-08 12:27:48 +00:00
Aryeh Gregor
7ec501be6a Enable new category sort by default
Patch best viewed with whitespace changes ignored.  This will doubtless
introduce a bunch of bugs.  Please report any so I can fix them.  If
they're big enough and the fix isn't obvious, please revert.
2010-08-03 20:50:01 +00:00
Aryeh Gregor
2ffa5e4876 Fix bug in prefixing scheme
As Bawolff pointed out at [[mw:User talk:Simetrical/Collation]], the
prefixing scheme I was using meant that the page "Z" with sort key of
"F" would sort after a page named "A" with a sort key of "FF", since the
first one's raw sort key would compute to "FZ", and the second's would
compute to "FFA".  I've fixed this by separating the prefix from the
unprefixed part by a null byte (cl_sortkey is eventually going to be
totally binary anyway, may as well start now).
2010-07-26 22:04:19 +00:00
Aryeh Gregor
022b7ba140 Reconcept cl_raw_sortkey as cl_sortkey_prefix
In response to feedback by Phillipe Verdy on bug 164.  Now if a bunch of
pages have [[Category:Foo| ]], they'll sort amongst themselves according
to page name, instead of in basically random order as it is currently.
This also makes storage more elegant and intuitive: instead of giving
NULL a magic meaning when there's no custom sortkey specified, we just
store an empty string, since there's no prefix.

This means {{defaultsort:}} really now means {{defaultsortprefix:}},
which is slightly confusing, and a lot of code is now slightly
misleading or poorly named.  But it should all work fine.

Also, while I was at it, I made updateCollation.php work as a transition
script, so you can apply the SQL patch and then run updateCollation.php
and things will work.  However, with the new schema it's not trivial to
reverse this -- you'd have to recover the raw sort keys with some PHP.
Conversion goes at about a thousand rows a second for me, and seems to
be CPU-bound.  Could probably be optimized.

I also adjusted the transition script so it will fix rows with collation
versions *greater* than the current one, as well as less.  Thus if some
site wants to use their own collation, they can call it 137 or
something, and if they later want to switch back to MediaWiki stock
collation 7, it will work.

Also fixed a silly bug in updateCollation.php where it would say "1000
done" if it did nothing, and changed $res->numRows() >= self::BATCH_SIZE
to == so people don't wonder how it could be bigger (since it can't, I
hope).
2010-07-26 19:27:13 +00:00
Aryeh Gregor
907695c56a Initial commit for category collation framework
Hidden behind $wgExperimentalCategorySort until it's reasonably
complete.  If that's false, no behavior should change (but I didn't test
carefully, so poke me if there's a bug).  See DefaultSettings.php for
documentation on setting it to true.  Currently you should not do this
except if you're working on the feature, since functionality is not
close to reasonable yet and will change rapidly.

Bug 1211 is already fixed with this commit for me.  However, many other
things still need to be done, so this is all very much a
proof-of-concept.
2010-07-23 19:52:02 +00:00
Aaron Schulz
5696248ddc Removed unused mTouchTmplLinks var 2010-06-17 05:59:32 +00:00
Alexandre Emsenhuber
8958a9ce05 Fixed some doxygen warnings 2010-05-26 20:39:43 +00:00
Brion Vibber
8eac509ab5 * (bug 14473) Add iwlinks table to track inline interwiki link usage
Like langlinks, this stores the interwiki prefix (as iwl_prefix) and full page title (as iwl_title), attached to the page doing the liking (as iwl_from -> page_id).
Unlike langlinks, there can be multiple entries stored per interwiki prefix.

Updater to add the table confirmed on MySQL, untested on SQLite but should work.
Someone may still need to add and test a PostgreSQL updater.

Refactored makeWhereFrom2d() out of LinkBatch to Database so it could be re-used for the similar mapping for the interwiki links, which need a string prefix rather than an int namespace key.
Also cleaned it up internally to reuse existing code for building where clauses from arrays. (Tim & Domas -- if the previous more verbose code was there to reduce function call and array processing overhead on very large link lists, feel free to unroll it again if the difference is measurable. Just swap the var names around from the old LinkBatch code and escape the base key value if it's not an integer, it'll be functionally equivalent.)
2010-04-16 01:40:05 +00:00
Bryan Tong Minh
12f4ac9b88 Add accessor to LinksUpdate::mImages 2009-11-06 16:22:56 +00:00
Tim Starling
bb97e2e483 Reverted r46706, misses essential updates, the feature can easily be implemented another way (see CodeReview). For 1.15. 2009-05-19 08:01:36 +00:00
Brion Vibber
c70b23a6bb Revert r47530 "Fix bug 17571, now page1 would add to both cat1 and cat2."
Code is unclear; needs cleanup before adding more instances of this :D
2009-03-25 08:46:22 +00:00
Aaron Schulz
2a4d0dc583 fix profiling 2009-03-06 01:40:56 +00:00
Philip Tzou
50970f4230 Fix bug 17571, now page1 would add to both cat1 and cat2. 2009-02-20 06:47:03 +00:00