Commit graph

42 commits

Author SHA1 Message Date
Marius Hoch
a89338ff82 Improve documentation of maintenance/sql.php
I found this to be lacking earlier this week...

Change-Id: I409c7451baa71b88cf554af0d82d1bf5904a2c4c
2015-05-20 21:24:33 +02:00
Aaron Schulz
f4f5f41194 Allow the empty string as the wiki DB
* This is useful when cluster= is set but the DB is not there yet

Change-Id: I1766c564448502c7359c7da964f0becd2e3222c6
2014-11-06 23:40:24 +00:00
Bartosz Dziewoński
9e5443abc3 No space within the ?: operator
This style is a lot more common in our code.

Change-Id: I7f2fb3716c24c4a95a4c6c4a732b0226c315f242
2014-08-25 17:40:51 +02:00
umherirrender
25971af694 Cleanup some docs (maintenance)
- Fixed spacing inside docs
- Makes beginning of @param/@return in capital

Change-Id: I864b8b3f1f67e34e369aba7aadaf87e7752c894d
2014-08-09 22:08:40 +02:00
Siebrand Mazeland
606c680b21 Update formatting in maintenance/ (4/4)
Change-Id: I6b58d014a4bfd6600e4e6f80188fdcfce18482ca
2014-04-23 20:09:26 +02:00
Siebrand Mazeland
a50a5d9da7 Pass phpcs-strict on maintenance/ (1/8)
Change-Id: Ib68a7cf4251e8f4c71233df869673f4c5d3cf84c
2014-04-22 21:25:22 +00:00
umherirrender
e78776373e Fixed some @params documentation (maintenance)
Swapped some "$var type" to "type $var" or added missing types
before the $var. Changed some other types to match the more common
spelling. Makes beginning of some text in captial.
Also added some missing @param.

Change-Id: I727deec35a712de0f0c676cc87dfa661f1ee965b
2014-04-17 22:48:32 +02:00
Aaron Schulz
dd3a475346 Added --wikidb param to sql.php
* This is useful for updating DBs that are not actually a that of a wiki.
  For example a global blocking or central auth DB may not correspond to
  any single wiki. Trying to use --wiki will fail with het deploy

Change-Id: I232182b79c9ca6421789f19771ba427498fff713
2013-12-10 15:03:41 -08:00
Aaron Schulz
d2254ba11c Allow server selection when running sql.php
Change-Id: I2a643eb3a517eba09b80da19158e0957441bcaa5
2013-05-22 23:08:35 -07:00
Timo Tijhof
beb1c4a0ec phpcs: More require/include is not a function
Follows-up I1343872de7, Ia533aedf63 and I2df2f80b81.

Also updated usage in text in documentation and the
installer LocalSettingsGenerator.

Most of them were handled by this regex:
- find: (require|include|require_once|include_once)\s*\(\s*(.+?)\s*\)\s*;$
- replace: $1 $2;

Change-Id: I6b38aad9a5149c9c43ce18bd8edbab14b8ce43fa
2013-05-21 23:26:28 +02:00
Timo Tijhof
50e7985d4d phpcs: Fix WhiteSpace.LanguageConstructSpacing warnings
Squiz.WhiteSpace.LanguageConstructSpacing:
   Language constructs must be followed by a single space;
   expected "require_once expression" but found
   "require_once(expression)"

It is a keyword (e.g. like `new`, `return` and `print`). As
such the parentheses don't make sense.

Per our code conventions, we use a space after keywords like
these. We appeared to have an unwritten exception for `require`
that doesn't make sense. About 60% of require/include usage
was missing the space and/or had superfluous parentheses.

It is as silly as print("foo") or return("foo"), it works
because keywords have no significance for whitespace between
it and the expression that follows, and since experessions can
be wrapped in parentheses for clarity (e.g. when doing string
concatenation or mathematical operations) the parenthesis
before and after basiclaly just ignored.

Change-Id: I2df2f80b8123714bea7e0771bf94b51ad5bb4b87
2013-05-09 05:56:26 +02:00
umherirrender
bfb75bc8e2 Fixed spacing around parenthesis in languages/tests/maintenance
Change-Id: Idd4299d17f1fcf98ab1d635484cb4e880f35ee24
2013-04-28 15:57:34 +00:00
umherirrender
b114f5e1c1 Fixed some spacing in maintenance folder
Added spaces before if, foreach
Added some braces for one line statements

Change-Id: I9657f72996358f8c1c154cea1ea97970d973723c
2013-04-18 20:48:44 +02:00
Reedy
9bdc558bc4 Add a wfWaitForSlaves() call at the end of sql.php
Useful if you're doing queries over many wikis (wmf usage) that might
induce some repllag

Change-Id: I9818f1763d3330d0b96d9bb9c192a957293b6a5b
2013-02-25 23:57:31 +00:00
Aaron Schulz
7d939705ce Made sql.php except a "cluster" option and cleaned up the arguments.
* This lets people choose to run the script on some external cluster
  instead of only the primary cluster for a given wiki ID.

Change-Id: I6e8c10bc772d4a26c38f2ed8ae5787c8d130bd4c
2013-02-21 22:36:09 +01:00
Antoine Musso
bb497c97b6 misc style issues
7zip.inc : $stream is really a private property.

userDupes.inc : still only used by MysqlUpdater, added a comment about
it and made the properties private.

sql.php : make sure we actually do nothing in some method. Previously we
just had an empty IF statement.

purgeList : a private method was named the same as the class, that is
how we declared constructor with PHP4. Renamed it to doPurge() to make
it clear that it is not the constructor.

Rests are whitespaces fixes.

Change-Id: I0b83f83ee3af37c770817ebfce3e804082c2fb41
2013-01-30 16:12:59 +01:00
Demon
63fe60368c Merge "alter sql.php prompt on line continuation" 2012-10-25 13:35:32 +00:00
Demon
c5462bcde0 Merge "(bug 37020) sql.php with readline eats semicolon" 2012-10-25 13:32:38 +00:00
Antoine Musso
0e7d61dd9f sql.php in interactive no more exit on DBerror
This patch make it so that after a DBerror a new prompt is shown to the
user. Save us from having to relaunch sql.php.

Change-Id: Id3df3df87f6fe7b2aea31e0526c5ff697bc5832c
2012-10-25 13:14:24 +02:00
Antoine Musso
b1a524fddc alter sql.php prompt on line continuation
As long as a command is not ended with a database delimiter, sql.php
kept appending the line without noticing the users. That is a bit
confusing since you might not even know what you are going to run when
entering the delimiter.

This patch alter the prompt to '    ->' until the command is finished.
That is more in line with how MySQL cli handles it.

Example:
	$ php sql.php
	> SELECT
		-> *
		-> from
		-> job;
	Query OK, 0 row(s) affected
// repeal command:
	> SELECT * from job

Change-Id: Ic18b39d75d4db48d37d485e66f36d691e95934fb
2012-10-25 13:03:59 +02:00
Antoine Musso
c8e136dbbb (bug 37020) sql.php with readline eats semicolon
The database delimitor is now appended to the command before it is saved
in readline history.

Change-Id: Ie6bbac2d74e2e5df3910c5612adbd373a9c4695b
2012-10-25 13:01:28 +02:00
Alexandre Emsenhuber
dd6613b6bd Added missing GPLv2 headers in maintenance scripts.
- made file/class documentation more consistent
- contains a fix for Id7a04ff8 (2a7478b)

Change-Id: I5264105ce1b6ad86a9840e05be1af99f5d6e252a
2012-09-04 18:48:17 +02:00
Alexandre Emsenhuber
a75b6d53cd Improve documentation of maintenance scripts.
Also contains a fix for Ia5a38311 (fae0550).

Change-Id: I630c83b48b66c5d8c97411082cabd731f316f42d
2012-09-02 20:33:22 +02:00
jeroendedauw
38c7f444e1 Use __DIR__ instead of dirname( __FILE__ )
We can now do this since we finally switched to PHP 5.3 for MW 1.20 and get rid of the silly dirname(__FILE__) stuff :)

Change-Id: Id9b2c9cd2e678197aa81c78adced5d1d31ff57b1
2012-08-27 21:45:00 +02:00
Sam Reed
d4675054cd Fixed reading from file from r108774 2012-01-17 13:29:42 +00:00
Sam Reed
ebf916f3fb Give sql.php eval.php type scrollback 2012-01-12 22:57:51 +00:00
Chad Horohoe
26505b170a Fix concern raised by Brion in r74108 (but has really existed since the maintenance rewrite). Right now, including a maintenance script causes it to execute. This is bad when you want to reuse the particular class but not have it start executing all by itself.
Until now, we relied on setting MW_NO_SETUP which was a) hacky, b) irreversable, and c) likely to be forgotten if you didn't use one of the wrappers like runChild().

Instead, move the freaky magic to doMaintenance and have *it* check if it's in a specific call stack that indicates this is being run from the file scope and should be executed. Rename DO_MAINTENANCE to RUN_MAINTENANCE_IF_MAIN so it's nice and clear what magic happens behind the require_once().
2011-01-13 22:58:55 +00:00
Mark A. Hershberger
617a5b1e15 Whitespace fixup under tha maint directory. 2010-12-04 03:20:14 +00:00
Sam Reed
659778619c Stylize maintenance folder.. 2010-05-22 16:50:39 +00:00
Chad Horohoe
9b5196a68d Fix child class visibility 2010-03-10 12:59:44 +00:00
Brion Vibber
02727d3f79 Fix regression in sql.php: needs to run w/ DB admin privileges in order to do DB updates 2009-09-22 16:41:04 +00:00
Alexandre Emsenhuber
44729064cd * batch change for "while ( $row = $db->fetchObject( $res ) )" and similar to "foreach ( $res as $row )"
* identation fix in nukeNS.php
2009-08-17 21:15:31 +00:00
Chad Horohoe
567f244e36 Revert r54244 which was stupid and fix this properly. Require commandLine.inc/Maintenance.php using the full path every time. 2009-08-03 21:56:41 +00:00
Chad Horohoe
30468dbcf7 Don't put \n on the end of every error() call, just do it in error() itself. Still have to use on output(), because people like "Something...done" stuff. 2009-08-02 21:55:10 +00:00
Chad Horohoe
a1c51e18af Merge maintenance-work branch (now with less errors!):
* Docs have been updated to indicate the standard on how to write maintenance scripts (MW.org docs will follow) Have ported vast majority of maintenance scripts to new format. Remaining ones (mostly FiveUpgrade-related) are a bit more tricky. commandLine.inc is untouched for now. Many have gotten code-style updates as well. Deleted .inc files were only used by their .php counterparts, and have been merged into single files.
* (bug 11867) Lock error on redirect table when running orphans.php
* (bug 16322) Allow maintenance scripts to accept DB user/pass over input or params
* (bug 18566) Maintenance script to un/protect pages
* initStats overhaul, now uses class SiteStatsInit. Also fixes bug 18930
2009-08-02 19:35:17 +00:00
Brion Vibber
1c9773bd01 Revert r52336 "Merge maintenance-work branch:"
Seems to have broken a bunch of stuff. Don't commit giant non-critical changes that break Setup.php and all maint scripts. Thanks!
2009-06-24 02:49:24 +00:00
Chad Horohoe
59b60fc311 Merge maintenance-work branch:
* (bug 16322) Allow maint scripts to accept DB user/pass over input or params if no AdminSettings.php
* (bug 18768) Remove AdminSettings.php from MediaWiki core
* (bug 19157) createAndPromote error on bad password
* (bug 14201) Create AdminSettings.php during wiki installation, in the same way as LocalSettings.php
* Introduce new Maintenance class framework and port a good number of scripts over; the ones that are left are a little more complicated. Read the docs.
* Not deleting "unused" files yet, don't want to break everything at once :)
2009-06-24 02:02:37 +00:00
Brion Vibber
dff6e3ae0b Don't die horribly from sql.php when making INSERT/DELETE/UPDATE/CREATE TABLE/etc calls that return 'true' instead of a result object.
Code was attempting to handle this case by asking the result object for its db so we can ask for the affected row count -- obviously that doesn't do so good when the result is not an object.
Changed Database::sourceStream() to send itself as the second parameter to the result-handling callback, so the callback knows which DB to check.
2008-08-01 21:00:24 +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
Nick Jenkins
d466cf6e86 A few comment tag tweaks. 2007-07-11 08:09:21 +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
Tim Starling
0a93752af6 * Removed mysql5 SQL files, obviously we're collectively incapable of keeping them up to date. They were littered with errors. The only deliberate difference appears to be the table character set, which can be adjusted programatically using a variable.
* Added table option variable to the SQL patch files, so now upgrading a non-standard schema won't leave your database horribly corrupted.
* Added sql.php, for sourcing SQL files with MediaWiki variable substitution.
* Disable MySQL's strict mode at session start for MySQL 4.1+, to avoid the various problems that occur when it is on.
2007-04-22 14:04:06 +00:00