Commit graph

278 commits

Author SHA1 Message Date
Tim Starling
467e217e6a Capture PHP errors from mysql_connect(). Apparently this is the only place connection errors are available in PHP 5.2.6. 2008-06-04 01:44:36 +00:00
Nick Jenkins
03cd4ad942 Prevent two E_STRICT warnings when running "php maintenance/update.php" to update from 1.12 alpha to 1.13 alpha.
--------------------------------------------------
# php maintenance/update.php

MediaWiki 1.13alpha Updater

Going to run database updates for wikidb
Depending on the size of your database this may take a while!
Abort with control-c in the next five seconds...0

Strict Standards: Type: 8:  Undefined offset:  1 in wiki/includes/Database.php on line 1420
    Database.tableName("ipblocks") # line 1164, file: wiki/includes/Database.php
   Database.tableExists("ipblocks") # line 203, file: wiki/maintenance/updaters.inc
  add_field("ipblocks", "ipb_id", "patch-ipblocks.sql") # line unknown, file: unknown
 call_user_func_array("add_field", Array[3]) # line 1051, file: wiki/maintenance/updaters.inc
do_all_updates(false, true) # line 60, file: wiki/maintenance/update.php

[ ... snip same warning repeated thousands of times ... ]
--------------------------------------------------

... also ... :

--------------------------------------------------
Strict Standards: Type: 8:  Undefined index:  USE INDEX in wiki/includes/Database.php on line 977
   Database.selectSQLText(Array[2], Array[2], Array[3], "Database::select", Array[0], Array[0]) # line 952, file: wiki/includes/Database.php
  Database.select(Array[2], Array[2], Array[3]) # line 32, file: wiki/maintenance/deleteDefaultMessages.php
 deleteDefaultMessages() # line 1077, file: wiki/maintenance/updaters.inc
do_all_updates(false, true) # line 60, file: wiki/maintenance/update.php
--------------------------------------------------
2008-05-21 04:59:21 +00:00
Alexandre Emsenhuber
087a9f70c5 WARNING: HUGE COMMIT
Doxygen documentation update:
* Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group.
* Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file.
* Removed some empty comments
* Removed some ?>

Added following groups:
* ExternalStorage
* JobQueue
* MaintenanceLanguage

One more thing: there are still a lot of warnings when generating the doc.
2008-05-20 17:13:28 +00:00
Aaron Schulz
973713b2e9 $join_conds 2008-05-19 17:02:58 +00:00
Aaron Schulz
dbfd693607 Split of query from query text generation. This makes creating sql statements for UNIONs much easier. 2008-05-13 04:56:14 +00:00
Victor Vasiliev
50a581996a * Fix image redirect caching so it doesn't break image redirects on shared repositories 2008-05-10 19:22:14 +00:00
Aaron Schulz
077e144c05 Just use @ here too 2008-05-10 13:42:07 +00:00
Roan Kattouw
b47979916c Allow an array as ON clause. There are quite a few queries out there that JOIN on title and namespace. 2008-05-10 10:31:57 +00:00
Roan Kattouw
2dc88c0602 E_NOTICE: $options['USE_INDEX'] might not be set 2008-05-10 09:49:21 +00:00
Aaron Schulz
2705364478 Add a way to do different JOINs with $tables 2008-05-10 00:48:07 +00:00
Roan Kattouw
44564b01d0 (bug 14042) Calling Database::limitResult() misplaced the comment in the log file 2008-05-08 15:50:53 +00:00
Daniel Friesen
57607dbd23 SMW also sends horrid statements containing DISTINCT and AS which suffer the same issue as the ugly API queries. Guess we have to secure against this use to. 2008-05-08 11:03:03 +00:00
Daniel Friesen
14939d9853 Ahh great. I mixed up my definition of preg_match's output and thought it was the one to return an offset, and false on failure. 2008-05-08 09:29:48 +00:00
Daniel Friesen
007ea4364b Make tableName test for words like JOIN or ON which signal that we are actually looking at a SQL query thrown into the tableName because someone used the simple handlers in ways they really should not be. 2008-05-08 09:24:24 +00:00
Aran Dunkley
921fb9eb40 Add SQLite database class 2008-05-07 23:38:37 +00:00
Daniel Friesen
2c397295dc New config variables. $wgSharedPrefix and $wgSharedTables.
This is a complete rewrite of Database::tableName.
The new tableName also has no PHP errors, and outputs a cleanly quoted table name 100% of the time.
This should solve bug 2396
2008-05-07 04:44:04 +00:00
Brion Vibber
50e1d7fdf0 Revert r34199, r34205 for now.
I don't really like the var name $wgSharedDBtables (inconsistent caps).

Compare with Gregory's patch on bug 2396:
https://bugzilla.wikimedia.org/show_bug.cgi?id=2396
https://bugzilla.wikimedia.org/attachment.cgi?id=3610

That uses a var named $wgSharedTables, but makes it more flexible (allowing arbitrary DB and prefix per table), which may or may not be a super idea.
2008-05-05 22:21:01 +00:00
Daniel Friesen
ce334f9732 New variable $wgSharedDBtables. This allows altering of the list of tables which enabling $wgSharedDB affects. For backwards compatibility this is set to an array containing the user table. 2008-05-04 09:00:17 +00:00
Victor Vasiliev
8d85629c58 * (bug 709) Cannot rename/move images and other media files.
Currently in experimental mode, use $wgAllowImageMoving to enable it.
Known issues:
* Doesn't work with rev_deleted
* May also have some security and caching issues.
2008-05-03 13:09:34 +00:00
Aryeh Gregor
b3230dfe27 It would have been fun if this went live. :D 2008-04-15 14:17:10 +00:00
Aryeh Gregor
fd0cb785a8 Add RELEASE-NOTES for 33269, fix another one. 2008-04-15 13:14:44 +00:00
Alexandre Emsenhuber
2f41e3c98b Removed usage of deprecated settings 2008-04-06 16:14:04 +00:00
Tim Starling
54e2b71bd1 * Generalised FileRepoStatus, providing a very similar general Status object.
* Fixed external storage in LBFactory_Multi, was broken
* Useful debugging hack $wgAllDBsAreLocalhost
2008-04-05 18:11:23 +00:00
Tim Starling
4d7cb64dd6 mmm... 2008-03-30 09:51:15 +00:00
Tim Starling
fbfb509df5 * Introduced LBFactory -- an abstract class for configuring database load balancers and connecting to foreign DBs.
* Wrote two concrete implementations. LBFactory_Simple is for general installations. LBFactory_Multi will replace the runtime configuration used on Wikimedia and allow load-balanced connections to any DB. 
* Ported Special:Userrights, CentralAuth and OAI audit to the LBFactory system. 
* Added ForeignDBViaLBRepo, a file repository which uses LBFactory.
* Removed $wgLoadBalancer and $wgAlternateMaster
* Improved the query group concept to allow failover and lag control
* Improved getReaderIndex(), it will now try all servers before waiting, instead of waiting after each.
* Removed the $fail parameter to getConnection(), obsolete. 
* Removed the useless force() function. 
* Abstracted the replication position interface to allow for future non-MySQL support.
* Rearranged Database.php. Added a few debugging features. 
* Removed ancient benet-specific hack from waitForSlave.php
2008-03-30 09:48:15 +00:00
Brion Vibber
899f644016 * Don't die when single-element arrays are passed to SQL query constructors
that have an array index other than 0

Since we don't enforce linear ordering of array keys on longer arrays, we
may as well not enforce it on single-element arrays either.
The freaky little Categoryfinder class was using different keys for its
arrays, which could cause a PHP notice and silent lookup failure when
only one ID was looked up.
2008-03-25 23:08:19 +00:00
Tim Starling
9e82828825 Fixed no-op update query in common code path 2008-03-19 11:19:00 +00:00
Tim Starling
45a998174a Fixed Database::ping() for MySQL client 5.0.13+. 2008-03-10 04:08:44 +00:00
Tim Starling
3d17f9896a Bug 11980: don't complain on rollback of non-transactional tables. Not sure how to reproduce it, but this should fix it in any case. 2008-02-27 06:09:51 +00:00
Greg Sabino Mullane
157fd5bd94 When putting usernames in SQL comments, truncate using mb_ functions for utf usernames. Bug 12735. 2008-02-04 17:33:49 +00:00
Domas Mituzas
d7f225d419 don't open transactions for SHOW and SET statements - reduces some redundancy of transaction startup 2008-01-13 13:34:45 +00:00
Brion Vibber
7700199c34 Special-case empty arrays and single-element arrays in database wrappers.
* single-element arrays were inefficient ("field IN (42)"), now using straight matches ("field=42")
* empty arrays caused an error ("IN ()" is invalid syntax), now will evaluate to 0 (false)
2007-11-15 18:35:58 +00:00
Nick Jenkins
a46194b809 Tweak variable name 2007-09-28 00:42:22 +00:00
Greg Sabino Mullane
546dc86714 Use "private", thanks Nick. 2007-09-27 13:23:10 +00:00
Greg Sabino Mullane
0ab8c7e910 Make CONCAT calls database portable, change IF() to standard CASE-WHEN calls.
Postgres: replace CHAR(64) with TEXT for fa_storage_key of filearchive
Postgres: Add hasConstraint to allow replacing of oldimage fk constraint
Postgres: make oldimage cascade delete on image deletion
2007-09-23 22:23:01 +00:00
Greg Sabino Mullane
7b9616a21c Fix bug 11292, unserialize errors with Postgres, by changing from array to object when slinging around blobs. 2007-09-23 19:54:56 +00:00
Greg Sabino Mullane
8eb82ee407 Add implicitOrderby() to make sure that SpecialAllpages uses an ORDER BY when needed.
Made this an option rather than forcing the ORDER BY as testing show MySQL is 
faster without it for large tables.
2007-09-02 18:03:10 +00:00
Brion Vibber
e2a069fd89 * (bug 11082) Fix check for fully-specced table names in Database::tableName
strpos() was in wrong order since added in 2004 :D
2007-08-27 18:56:31 +00:00
Nick Jenkins
786e93fb37 Static code analysis housekeeping time... things that could be double-checked are marked with "[Note: some-comment]" :
if-if-else without curly braces [api/ApiQuerySiteinfo.php] --> adding
Unused global declaration:  $wgGroupPermissions --> removing 
Unused global declaration:  $wgEmailConfirmToEdit (line 301) --> removing 
Variable $id appears only once (line 1021)  --> removing 
Variable $m was used before it was defined (line 805) --> defining.
Variable $retval was used before it was defined (line 2346) --> renaming to $result
Variable $rcid appears only once (line 244 of RecentChange.php)  --> using this instead of $change [Note: was left over from r24607 refactoring, revert if wrong please]
Unused global declaration:  $wgCommandLineMode (line 11) --> removing
Variable $k appears only once (line 132 of ImagePage.php) --> removing.
Variable $info appears only once (line 311 of ImagePage.php)  --> removing.
Unused global declaration:  $wgTitle (line 569 of ImagePage.php) -> removing.
Variable $handlerParams was used before it was defined (line 616 of Linker.php) --> resolved by Raymond in r24966
Variable $match was used before it was defined (line 1031 of Linker.php) --> defining.
Unused global declaration:  $wgEnotifWatchlist (line 253 of UserMailer.php) --> removing 
Unused global declaration:  $wgShowUpdatedMarker (line 253 of UserMailer.php) --> removing 
Variable $img appears only once (line 446 of SpecialUpload.php) --> added definition, defined as null, flagged with @todo  [Note: should $img be defined in this context, or is it intended to be null? And should the return value after the hook be checked in some way?]
Unused global declaration:  $wgEnableAPI (line 739 of SpecialUpload.php) --> removing.
Unused global declaration:  $wgNamespaceProtection (line 1030 of OutputPage.php) --> removing.
Unused global declaration:  $wgContLang (line 18 of SpecialWatchlist.php) --> removing.
Unused global declaration:  $wgRawHtml (line 269 of SpecialMovepage.php) --> removing.
The value of variable $page was never used (line 331 of SpecialUndelete.php) --> removing line, as $page gets redefined a few lines down.
Variable $synIndex appears only once (line 521 of MagicWord.php) --> commenting out.
Variable $case appears only once (line 539 of MagicWord.php) --> removing from foreach index key usage.
Variable $wgUser appears only once (line 1039 of Title.php) --> adding line to declare as a global, would be null otherwise.
Variable $m was used before it was defined (line 285 of Title.php) --> defining.
Variable $id appears only once (line 1150 of Title.php) --> removing from foreach index key usage.
Variable $subpage appears only once (line 1297 of Title.php) --> commenting out.
Variable $restrictions appears only once (line 1399 of Title.php) --> commenting out.
Variable $mime appears only once (line 210 of filerepo/OldLocalFile.php) --> removing.
Variable $deprefixedName appears only once (line 213 of filerepo/LocalFile.php) --> removing.
Variable $m appears only once (line 541 of filerepo/LocalFile.php) --> removing.
Variable $where appears only once (line 1245 of filerepo/LocalFile.php) --> removing.
Variable $info appears only once (line 1427 of filerepo/LocalFile.php) --> removing.
Variable $rel appears only once (line 138 of filerepo/RepoGroup.php) --> commenting out.
Variable $zone appears only once (line 138 of filerepo/RepoGroup.php) --> commenting out.
Variable $nbytes appears only once (line 208 of media/Generic.php) --> added a return line that uses $nbytes. [Note: I'm assuming that this was the intent]
Variable $offset appears only once (line 201 of SpecialListusers.php) --> removing.
Variable $limit appears only once (line 201 of SpecialListusers.php) --> removing.
Variable $groupTarget appears only once (line 203 of SpecialListusers.php) --> removing.
Unused global declaration:  $wgLang (line 74 of SpecialWantedpages.php) --> removing.
Variable $block appears only once (line 244 of SpecialProtectedpages.php) --> removing.
Variable $offset appears only once (line 281 of SpecialProtectedpages.php) --> removing.
Variable $limit appears only once (line 281 of SpecialProtectedpages.php) --> removing.
Unused global declaration:  $wgLang (line 30 of FileDeleteForm.php) --> removing.
Unused global declaration:  $wgServer (line 30 of FileDeleteForm.php) --> removing.
2007-08-21 03:57:54 +00:00
Rob Church
12f3e5d28a (bug 10769) Database::update() should return boolean result 2007-08-01 21:42:59 +00:00
Greg Sabino Mullane
4fffb261dd Add function to check if function-based indexes are supported by the backend DB. 2007-07-30 14:10:42 +00:00
Aaron Schulz
358b187c5c *Still use = for LIST_SET so as not no kill non-where queries 2007-07-11 20:26:33 +00:00
Aaron Schulz
d20bf39150 *Make null values of arrays use NULL(for lists) or IS NULL, rather than x = NULL, which doesn't work 2007-07-11 20:07:25 +00:00
Nick Jenkins
d466cf6e86 A few comment tag tweaks. 2007-07-11 08:09:21 +00:00
Tim Starling
8c3b4616cd Added iterator interface to ResultWrapper. No support in Oracle yet. Updated documentation for Database::getLag(). 2007-07-09 00:48:40 +00:00
Yuri Astrakhan
5a0bbe0a1a bug 10496 DISTINCT option logic incorrect in Database::makeSelectOptions 2007-07-07 21:51:06 +00:00
Tim Starling
9382bc7a85 Return a ResultWrapper from Database::query() and query builder functions, instead of a raw DB result resource. Backwards compatibility is maintained, except with naughty code that was calling database driver functions directly on result objects. 2007-07-05 19:42:18 +00:00
Aryeh Gregor
a15c419b3d Remove ?>'s from files. They're pointless, and just asking for people to mess with the files and add trailing whitespace. (Yes, I looked over every one and reverted those that were bogus. Slash-enter a million times in less worked well enough, although it was a bit mind-numbing.) 2007-06-29 01:19:14 +00:00
Nick Jenkins
b4d37577b9 Removing or commenting out unused variables or globals, and adding declarations for two arrays. 2007-05-08 09:09:46 +00:00
Aaron Schulz
ccb7b43392 *Support for HAVING clause 2007-05-04 22:54:13 +00:00