Commit graph

134 commits

Author SHA1 Message Date
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
Tim Starling
4f3efbf406 Don't do any backlink batches if there are no backlinks. 2009-02-19 02:10:55 +00:00
Tim Starling
4b66381cbf * Mostly reverted r41081 and related. Although the motivation (to save a query) is noble, it's a complex special case relying on subtle inter-module effects, making the code quite unclear and the performance advantage hard to reproduce in new code.
* r41081 was causing the job queue to be flooded with tiny htmlCacheUpdate jobs which were less than the batch size and so, according to the original logic, should have been done immediately. This was causing template updates to be delayed even when the template has few backlinks. This is fixed.
* Introduced a shared cache called BacklinkCache with the main purpose of sharing data from these backlink queries, thus recovering the performance of r41081.
* Refactored backlink partitioning code, which in r40741 was copied from HTMLCacheUpdate to LinksUpdate with a bug intact. The bug caused every htmlCacheUpdate or refreshLinks2 job to be split into at least two pieces even when number of rows is less than the batch size.
* Fixed a bug from r40741 causing refreshLinks2 jobs with end=false to be ignored.
* Made SquidUpdate::newFromTitles() accept a TitleArray
2009-02-16 14:26:34 +00:00
Philip Tzou
c3152e2636 (bug 3311) Automatic category redirects 2009-02-02 14:15:21 +00:00
Philip Tzou
205ef1ba8b 1. Use param $ignoreOtherCond instead of $forTemplate and $ignoreSubmitCond in findVariantLink().
2. Drop some duplicate categories produced by findVariantLink().
2009-02-02 07:54:43 +00:00
Philip Tzou
a31dceccc9 To find an available category name during update table 'categorylinks'. Just act on the language which enabled LanguageConverter. 2009-02-02 06:53:49 +00:00
Ilmari Karonen
34fb6297cd Step 2 in NS_IMAGE -> NS_FILE transition (bug 44) (WARNING: huge commit).
This is a global search and replace of NS_IMAGE and NS_IMAGE_TALK with NS_FILE and NS_FILE_TALK respectively in all core files, excluding those already updated in step 1 (r44004).
2008-12-01 17:14:30 +00:00
Aaron Schulz
27980cd92b * Avoid doing templatelinks query (which can get huge) twice by adding cachupdate jobs using the same query as refreshlinks jobs do
* Don't trigger recursive jobs for nulls edits
* Some whitespace tweaks
2008-09-20 22:48:55 +00:00
Aaron Schulz
5b307763e3 Add missing wfProfileOut( __METHOD__ ); 2008-09-20 07:31:44 +00:00
Aaron Schulz
2f4c8be5db Redo RefreshLinksJob2 commit with trivial notice fix. 2008-09-12 09:37:31 +00:00
Siebrand Mazeland
a3b1485c47 Revert 40741. Causes "Division by zero in includes/LinksUpdate.php on line 210" 2008-09-12 08:06:00 +00:00
Aaron Schulz
892a21961d job-queue insert should no longer fail for highly used templates (bug 5527) 2008-09-12 04:26:33 +00:00
Aaron Schulz
788571dae6 flag as protected 2008-08-17 21:58:17 +00:00
Brion Vibber
a7af6c3b72 Hold back $wgTrackLinkChanges for a little bit; reverting r37322, 37430, 37432, 37435.
Even disabled, it's started interfering with regular tasks like running the parser tests.
2008-07-10 22:11:11 +00:00
Bryan Tong Minh
fe2e53ca93 (bug 13588) Experimentally track link changes if $wgTrackLinkChanges is set to true. Requires schema change. 2008-07-08 15:02:07 +00:00
Nicolas Dumazet
56a36cff30 mCategoties -> mCategories
Oops, that typo was surviving here since March :p
2008-07-04 11:01:02 +00:00
Nicolas Dumazet
bd2ab6be1a Correcting commit 37038 : only getXXXDeletions were simple array_diff_assoc. Sorry 2008-07-04 10:51:04 +00:00
Nicolas Dumazet
ae5d81b425 syntax fix 2008-07-04 10:30:48 +00:00
Nicolas Dumazet
da8cfb32cf 6 array_diff_* were computed twice. Compute once, and remember them instead. 2008-07-04 10:24:20 +00:00
Andrew Garrett
3e14f2b679 Save the parser output to a member variable of LinksUpdate, so that hooks can access it. 2008-04-28 12:48:41 +00:00
Siebrand Mazeland
79d5225c0e * remove end of line whitespace
* remove empty lines at end of file
* remove "?>" where still present
2008-04-14 07:45:50 +00:00
Aryeh Gregor
23552223bf Remove apparently pointless $dbw parameter to Article::updateCategoryCounts. 2008-03-19 13:36:33 +00:00
Aryeh Gregor
80a5874828 This is a schema change. It's only a table creation, but the table must be created on Wikimedia servers before this revision goes live. The maintenance script populateCategory.php should be run when convenient. If it's not run, there's only one substantial case where display will be harmed: the page of a category with more than 200 net pages added since the patch goes live will give an erroneously low count. In other cases category pages will just be better-worded, and it will recognize the count in the table is bogus.
* Adds Category and CategoryList classes to represent categories themselves.
* Adds a category table, giving each category a name, ID, and counts of all members, subcats only, and files.
* Adds a maintenance script to populate the category table efficiently.  This script is careful to wait for slaves and should be safe to run on a live database.  The maintenance script's includes file is called by update.php.
* Until the category table is populated, the patch handles weird category table rows gracefully.  It detects whether they're obviously impossible, and if so, it outputs appropriate messages.
2008-03-18 00:17:28 +00:00
Greg Sabino Mullane
6288ee6c0f Continue the pretty lining up from above. 2008-02-21 20:05:52 +00:00
Tim Starling
269a91037b * Added __HIDDENCAT__ feature, to hide categories from the box at the bottom of the member pages depending on special text on the category page.
* Added page_props backend, generic parser-driven page properties which, when changed, invalidate the cache of backlinked pages on any links table. Could be used to add overlays to images depending on their deletion status, or to add icons to articles based on category membership. 
* Refactored double-underscore handling in the parser. 
* Moved CoreParserFunctions registration to CoreParserFunctions.
2008-02-20 08:53:12 +00:00
Bryan Tong Minh
8599bbee84 New hooks: LinksUpdate, LinksUpdateComplete. Add function getTitle to LinksUpdate. 2008-02-09 12:32:32 +00:00
Brion Vibber
0baa4a7f0c Revert r25768, r25771
I really don't like inserting bogus entries into the link tables, that looks fragile and generally horrifying.
2007-09-11 15:03:54 +00:00
Andrew Garrett
11de3cf8b4 * Speed up Special:UncategorizedPages and Special:Deadendpages (no longer marked as slow queries). They now add blank ('','') entries for pages without ANY links or categories. Note that these entries are now what is checked by Special:Uncategorizedpages and Special:Deadendpages. Thus, refreshLinks.php needs to be run before either of these pages will work correctly. An update script will be forthcoming.
* RELEASE-NOTES comments forgotten in a previous commit.
2007-09-11 08:10:28 +00:00