Commit graph

32 commits

Author SHA1 Message Date
umherirrender
7a5f4b431d Allow array condition for Database::conditional
Change the one use of that method to use the new syntax.
Add some tests.

Change-Id: I9ad4e5b5e97d1d13cfd858105167ca5d20ffaf83
2012-08-25 20:24:59 +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
Alexandre Emsenhuber
1082c71e9b Added missing GPLv2 headers in some places.
Also made file/class documentation more consistent.

Change-Id: Ibe7815124d6915792dcbb150d01df21d9b22b0b0
2012-05-21 21:56:39 +02:00
Sam Reed
60081e9852 More __METHOD__ into db related methods 2012-02-24 17:00:52 +00:00
Sam Reed
76246b9bf5 More return documentation 2012-02-09 21:33:27 +00:00
Sam Reed
138ddc452f Fixing some of the "@return true" or "@return false", need to be "@return bool" and then the metadata can say true if foo, false if bar
Other documentation improvements
2012-02-09 17:42:35 +00:00
Sam Reed
6d81d042f5 More documentation and class definitions
Few tweaks to braces
2011-03-08 20:17:48 +00:00
Aryeh Gregor
27d1e4ae23 Update comment in Category.php
Per code review I gave on r72547.  I'm actually not sure how to rewrite
this so it works with all DBs -- a replace() variant that called
nextSequenceValue() if the row didn't already exist, and reused the
existing id otherwise, would perhaps be ideal.  (Speaking of which,
replace() needs to be properly factored out, with the DBMS-independent
version in DatabaseBase and the MySQL one in DatabaseMysql.)
2010-09-08 18:11:28 +00:00
Platonides
118da6b4ef Follow-up r32085. Delay the transaction begin until after the object is initialized.
We would get some queries into the transaction ''sometimes'', depending if it was already initialised or not, and one code path left the transaction open.
2010-09-07 20:11:53 +00:00
Aryeh Gregor
9d7af3a00d Remove dead code added in r36814
None of the constructors will set $this->mTitle but not $this->mName,
and those are both private member variables.  r69813 demonstrates that
no one had ever hit this code since it was first added in June 2008,
because it would have resulted in a fatal.
2010-07-27 19:55:47 +00:00
Sam Reed
3455bbaec8 $title undefined in initialize
Guessing it's supposed to be $this->mTitle
2010-07-23 20:35:44 +00:00
Siebrand Mazeland
f8b1c4cfb7 Random indentation and code formatting updates. No functional changes. 2010-02-14 22:07:30 +00:00
Jure Kajzer
785ad24aa7 Changed sequence names to a standard <table>_<field>_seq form.
Updated all nextSequenceValue calls with new sequence names.
OverlordQ stated he'll handle changes to Postgres scripts.
Need someone to change DB2 scripts.
2009-10-28 16:17:16 +00:00
OverlordQ
9f5b309aaa Followup to r57102, use already existing sequence name so as to not break DB2 and PostgreSQL 2009-10-14 04:28:22 +00:00
Jure Kajzer
5c339ed928 logging table added columns, fixed cat_id sequence generation in Article and Category 2009-09-30 13:38:07 +00:00
Siebrand Mazeland
8e23949bee Proper casing for getDBkey() 2009-05-24 08:29:10 +00:00
Aaron Schulz
3638367344 Whitespace :) 2009-02-25 00:48:07 +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
Alexandre Emsenhuber
bd5c60e0a7 More doxygen fixes 2008-11-29 19:23:42 +00:00
Aaron Schulz
a6c6f7361d * Remove incomplete isFileCacheable(), the parent one is fine
* Break long line
2008-11-19 00:02:23 +00:00
Robert Leverington
7ff30fcab3 * (bug 14923) Add method for getting a TitleArray for a particular category. 2008-07-28 19:02:40 +00:00
Nicolas Dumazet
579bfd985b moving $cat = new self() before $cat->mTitle = $title ; PHP was unhappy. 2008-07-05 13:13:29 +00:00
Daniel Kinzler
c9f49d8476 allow Category objects for empty categories 2008-07-01 20:49:23 +00:00
Daniel Kinzler
417f9de04e Make member counts from the new category table available for subcategories, beef up Category object a bit. This is mainly for use by the CategoryTree extension. NOTE: this changes the query used to fetch category listings! 2008-06-30 14:06:36 +00:00
Aryeh Gregor
5090acabd9 -136 lines of worthless code. Even if the idea was hypothetically good, which I'm not sure of, nobody is using CategoryList anywhere and I don't foresee any use for it. Also makes what remains considerably easier to read (no looping, etc.). This seems to work correctly, but I might have missed something somewhere, so be on the lookout. 2008-05-22 17:24:46 +00:00
Aryeh Gregor
38ce75b481 (bug 13693) Categories sometimes claim to have a negative number of members. Just recount them in this case; they *should* have relatively few members, so it should be fast. Note that even a worst-case scenario (recount of enwiki Living people) takes only a few seconds on the cluster, and it seems incredibly unlikely that that would occur. 2008-05-15 17:04:34 +00:00
Aryeh Gregor
95682c75b8 Wait, never mind, revert that. This is supposed to be DB keys . . . 2008-03-20 17:07:07 +00:00
Aryeh Gregor
6a300fabcf I knew there was a better way. Use makeTitleSafe for this too. 2008-03-20 17:04:32 +00:00
Victor Vasiliev
dfae566d0b Use Title::makeTitleSafe 2008-03-20 16:39:02 +00:00
Aryeh Gregor
8fc8c4530d Fix an error for categories named literally "Project:" or some similarly weird thing. I thought that's not a legal title, but I'm told otherwise. Is there a better way to do this than manually prefixing "Category:"? The second parameter to newFromText is ignored if there are any prefixes, according to the docs. 2008-03-19 15:53:48 +00:00
Greg Sabino Mullane
d3a1c5c739 Use $db->conditional() instead of non-standard IF(). Fixes bug 13430. 2008-03-19 13:15:09 +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