Commit graph

164 commits

Author SHA1 Message Date
Timo Tijhof
fad5b23816 installer: Clear module_deps cache in updater
Unless --nopurge is set in update.php, clear module_deps cache
tables.

We already clear the objectcache via purgeCache(), and
msg_resource and msg_resource_links via MessageBlobStore::clear().

The module_deps table should be included as well.

Bug: T37472
Change-Id: I7cb63bb39a62b7f5be3855d022a8c76e175e95b5
2015-04-11 16:32:57 -07:00
Kunal Mehta
4fb5c877f6 Don't trigger MessageBlobStore during tests
The test for OutputPage::makeResourceLoaderLink was triggering database
queries through MessageBlobStore even though it doesn't use any
messages.

In bb03d1a8e0 I had made MessageBlobStore a singleton instead of static
functions, however there's no need for it to be one since the class is
stateless. Callers can just create a new MessageBlobStore instance and
call functions upon it. Using getInstance() is now deprecated.

ResourceLoader now has a setMessageBlobStore setter to allow overriding
which MessageBlobStore instance will be used. OutputPageTest uses this
to set a NullMessageBlobStore, which makes no database queries.

Change-Id: Ica7436fb6f1ea59bd445b02527829ab0742c0842
2015-03-28 21:25:25 -07:00
Ricordisamoa
12dec5d85d Fix some stuttering in comments and documentation
Change-Id: I9c0088b9aab37335203cad45a1d6fa8ac3f43321
2014-12-17 19:44:10 +00:00
Aaron Schulz
e369f66d00 Replace wfRunHooks calls with direct Hooks::run calls
* This avoids the overhead of an extra function call

Change-Id: I8ee996f237fd111873ab51965bded3d91e61e4dd
2014-12-10 12:26:59 -08:00
umherirrender
489d793882 Fixed spacing
- Added/removed spaces around parenthesis
- Added newline in empty blocks
- Added space after switch/foreach/function
- Use tabs at begin of line
- Add newline at end of file

Change-Id: I244cdb2c333489e1020931bf4ac5266a87439f0d
2014-12-05 22:28:07 +01:00
Chad Horohoe
dbca12bf93 Stop using $wgProfileToDatabase
Was not completely removed and the remaining bits were mostly
broken. $wgProfiler['output'] = 'db' is the proper way.

Fixes T75917
Change-Id: I36565e2372db2ed49b219cf533ec433e8111c52f
2014-12-03 10:37:03 -08:00
Aaron Schulz
4bddc93561 Make sure that the temp zone has an .htaccess file
Change-Id: I357c6f6a60b4eb531636132180a717f4186b1797
2014-11-06 10:58:47 -08:00
physikerwelt (Moritz Schubotz)
ccd051bc44 Add counter to DatabaseUpdater::setAppliedUpdates
The key was constructed depending on the current time only.
This method fails, if multiple updates are performed
within one second.

Bug: 71087
Change-Id: Id7e30298729b3abb1501a34fcc1ba4e45d2172f0
2014-10-09 06:13:54 +00:00
jenkins-bot
26bef0e5bf Merge "Turn MessageBlobStore into a singleton instead of static functions" 2014-08-25 11:39:09 +00:00
Kunal Mehta
bb03d1a8e0 Turn MessageBlobStore into a singleton instead of static functions
For easier testability and other things. There are no uses
of this class in any extensions in gerrit.

Change-Id: I606de4259239e128ed7e0477fc98b84c647430c4
2014-08-25 03:53:39 -07:00
umherirrender
7c6a25856c Add missing @return to function docs
Change-Id: I45b9d02f94ecc58372268ec5e6a0b572a0b7e2a9
2014-08-23 23:14:57 +02:00
umherirrender
21e0c1c533 Correct variable names in @param to match method declarations
Some @param have a typo in the variable name,
some @param's were in wrong order.

Change-Id: Ie25806831027112b398f6f4a909c59147ac3a5fa
2014-08-13 21:48:28 +02:00
Aaron Schulz
b8c038f678 Redo WhatLinksHere query and add a *_from_namespace field to link tables
* Also tweaked the query so MySQL avoids doing a page_name
  index scan when it should start with the link table index
* Added population script (triggered by update.php)
* Also removed uniqueness from some indexes where it is redundant
* Renamed two confusing variables

Bug: 60618
Change-Id: Icca99b6ae0ef76cb77695faf82c615516191da36
2014-07-21 12:04:56 -07:00
Reedy
4b6ebd5c01 Fix file permissions from Ic7fc3bd836241dce8f296237bbd80ed3e4d1ee0d
Change-Id: I5d147c6baa034057f95e69b78811b9011cc4355e
2014-06-30 15:31:47 +01:00
rillke
a3f7117f8d Name implicitly created CHECK constraints
to ease future maintenance work. The pattern for catching the right
CHECK constraint is admittedly vague but the order in which auto-created
CHECK constraints of a table is removed doesn't really matter assuming
the update is always completed before another update is applied. If
updates are run through Update.php, that should be always the case.

Furthermore eliminating a bug causing application of several patches each
time when running Update.php

Bug: 65757
Bug: 65813
Change-Id: Ic7fc3bd836241dce8f296237bbd80ed3e4d1ee0d
2014-06-29 22:05:03 -03:00
umherirrender
f5f1e38b9a Fixed some @params documentation (includes/[db|installer])
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: I3595e9aac69ac42fbb74b0783fae0ad9bcc831aa
2014-04-19 13:55:27 +02:00
Brian Wolff
0bf4b4ec4f Output info in update.php for skipped updates due to shared tables
Can be kind of confusing for people to figure out why certain
updates didn't happen. I just had an irc conversation with
someone who didn't realize why their db wasn't fully updated.

Change-Id: I56223e70bdac8baaf079c28cbb1f0e20ef0336b8
2014-04-16 17:45:26 -03:00
Thiemo Mättig
2aa67db39d Fix "@param null $param" documentations
... and very few other documentation details that are closely connected
to these mistakes.

Change-Id: I5b2691948e196124c77f0cc04d0ed5a7167cac25
2014-04-09 12:33:55 +02:00
umherirrender
f153998317 Fixed spacing
- Removed double spaces
- Added space after if/switch/foreach
- Removed space on elseif
- Added space around parentheses
- Added newline at end of file
- Removed space before semicolon at end of line

Change-Id: Id40b87e04786c6111e6686d7f7eea1e588bdf37d
2013-11-19 19:03:54 +01:00
jenkins-bot
547c7eacde Merge "Update documentation" 2013-11-06 16:20:21 +00:00
Mark A. Hershberger
08d3afc971 Disable $wgContentHandlerUseDB during upgrade where fields don't exist.
They can cause problems if, for example, the installation has hooks
for UserSaveSettings or UserSaveOptions that try to update a user page.

Change-Id: I31078678e8939c897b1357bcb77eb2d26f806f29
Bug: 47271
2013-11-01 18:26:21 +00:00
Siebrand Mazeland
8a7d5c154b Update documentation
Change-Id: Ia8ca4f3ab49e8a437830a9d15d013e9ddb0ea3ab
2013-11-01 12:40:08 +01:00
Siebrand Mazeland
bb0044f638 Address PHP CodeSniffer errors and warnings
One class of errors left unaddressed: Class name "WebInstaller_Language"
is not in camel caps format. I think this can be changed, too, but I
wasn't able to quickly find out where class names are being created.

Change-Id: I920b0231db1b70b68c6c8907257c288a0e112668
2013-10-23 12:42:07 +00:00
Siebrand Mazeland
626addab9e Update formatting
With some manual corrections.

Change-Id: Icd947288c32fdb90a0f35388963ef5a17ffa58e7
2013-10-09 09:35:18 +00:00
umherirrender
037d375e0d update.php clears caches twice
There was a bad rebase on I96b4cfd4c02e9cbf46cc6a0499b87fb3b89020a0,
because it partically reverts Ice42a31dee1e6b41da4aa0a47e8786579382aff1

Bug: 44690
Change-Id: Iff2c8d3cb1a10da7cd0ab18ee189454761d7db6f
2013-09-21 03:37:02 +00: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
dbd0b590e9 else if -> elseif
Also fixed some spacing while at it
Added some braces for one line statements

Change-Id: Iebfa2b17091509daabc76248121c7763e2295d20
2013-04-17 16:52:47 +02:00
Tyler Anthony Romeo
eca5c5007e Cleared ResourceLoader blob store after update.php finishes.
Update.php is supposed to clear all localization caches. This
makes sure to clear the ResourceLoader's own message cache
as well.

Bug: 44524
Change-Id: I15ceb60f5e2e4d3ed9ba818fe6cd619f9adce5b2
2013-04-09 18:14:57 +00:00
umherirrender
6c278b6d7e fix some spacing
* Removed spaces around array index
* Removed double spaces or added spaces to begin or end of function
  calls, method signature, conditions or foreachs
* Added braces to one-line ifs
* Changed multi line conditions to one line conditions
* Realigned some arrays

Change-Id: Ia04d2a99d663b07101013c2d53b3b2e872fd9cc3
2013-03-25 22:22:46 +00:00
umherirrender
926d2ee143 Remove spaces between parentheses in function calls
Change-Id: If8ec665a01b566fa5189dfcc810b2d9a17f371e1
2013-03-17 16:13:22 +01:00
Tyler Anthony Romeo
4dcc7961df Fixed @param tags to conform with Doxygen format.
Doxygen expects parameter types to come before the
parameter name in @param tags. Used a quick regex
to switch everything around where possible. This
only fixes cases where a primitve variable (or a
primitive followed by other types) is the variable
type. Other cases will need to be fixed manually.

Change-Id: Ic59fd20856eb0489d70f3469a56ebce0efb3db13
2013-03-11 13:15:01 -04:00
Reedy
c3e4057e06 Kill off numerous unused variables
Change-Id: I7039f1328f37ee669b694f73ee282602186bffd1
2013-03-08 02:36:24 +00:00
umherirrender
48cd72819e fix some spacing
Change-Id: Ia9650be8b791fd2f0ccbc099436918a9d12d9968
2013-02-04 20:04:26 +00:00
umherirrender
fac189e26a The abstract declaration must precede the visibility declaration
From phpcs

Change-Id: I169c80a911ba75d64ab8a503088903ce3b8a7cca
2013-01-26 20:00:09 +01:00
Reedy
3ae75526ef Add "modifyExtensionField" utility function
As calling $updater->modifyField will do the action immediately (not queued),
this may be undesired.

So this is a shortcut/utility function like addExtensionField/addExtensionTable etc,
instead of the developer calling addExtensionUpdate( array() ) themselves.

Change-Id: Ie94f2b42679062c6e106ae560faab26818a9b15c
2013-01-06 03:03:36 +00:00
Alexandre Emsenhuber
692a5d16f5 Some fixes for Ia2782d64 (2f60cd2)
- Add doTable() check at the top of renameIndex()
- Return true instead of false when aborting an update due to unfulfilled
  condition; false is only to be used for updates that will be written to
  a schema update file to be run later
  Also removed the return false from addIndex() for consistency
- Break long line

Change-Id: I2efb6e3af4703ed8afeb315e8cda774d9a6c4a32
2013-01-05 20:31:35 +01:00
Dereckson
2f60cd20b6 New methods to drop or rename extension index in DatabaseUpdater
- DatabaseUpdater::dropExtensionIndex( $tableName, $indexName, $sqlPath )
- DatabaseUpdater::renameExtensionIndex( $tableName, $oldIndexName, $newIndexName, $sqlPath, $skipBothIndexExistWarning = false )

[ Case use ]

This feature is required to help extensions schema change to ensure
compatibility with SQLite.

First extensions to use it will be Echo and Flagged Revisions.

Change-Id: Ia2782d644593ab6b64b67720ed61b3994db10346
2013-01-05 20:05:41 +01:00
Alexandre Emsenhuber
5622654824 (bug 43116) Don't run database updates for shared tables unless --doshared is provided
Added DatabaseUpdater::doTable() to check whether updates should executed on the given table.

Change-Id: I83fd722b604f9bc8a834681d234a0d80964dedc5
2012-12-27 18:37:40 +01:00
IAlex
3b0f9bfe28 Merge "Tidy up some unbalanced returns in methods" 2012-12-09 09:48:40 +00:00
Reedy
d0a242abb4 Tidy up some unbalanced returns in methods
Leave a TODO

Change-Id: Ic49ac8630650b341aafb3c17abd22f3a07805d27
2012-12-09 02:59:04 +00:00
Reedy
452c73060c Move insertUpdateRow call before return applyPatch to make it reachable
This might not be quite right... We might want to cache the result of apply patch, insert the row and then return the result...

Change-Id: Ie6a1bb16d2912ad43aa8fd45b2bf10a8bf8652ae
2012-12-09 02:33:51 +00:00
Brad Jorsch
331da5d471 (bug 42483) Avoid serializing database object in update.php
Change I96b4cfd4 changed the data being stored in updatelog, trying to
store the mangled parameters (which may included an added copy of the
DatabaseUpdater object itself) instead of the input parameters. This
causes warnings because database objects cannot be effectively
serialized.

Go back to storing the original input parameters instead.

Change-Id: I96e6dffed98772ebb9b812773ff2f608e7e40cb1
2012-12-03 15:27:25 -05:00
MarkAHershberger
34c9bca6a8 (bug 38110) provide a way to separate out schema changes
Allows update.php to be run when $wgAllowSchemaUpdates = false.

This is useful for non-WMF environments where strict DB permissions
allow database updates (which update.php performs), but no schema
changes (such as adding or dropping tables or indices which update.php
also performs).

It does this by adding the --schema and --noschema flags. Without
either of these flags, update.php will perform exactly as before.

With --noschema, all changes to the table structure or table additions
are skipped. Only data changes are made.

With --schema is used, no schema changes are made to the database, but
the schema changes are saved to a separate SQL file that can be run.

Change-Id: I96b4cfd4c02e9cbf46cc6a0499b87fb3b89020a0
2012-11-21 22:53:24 -05:00
Chad Horohoe
ee01bb0d94 Move cache purging out of doUpdates()
It makes a whole lot more sense to run this at the end of the
update process after post update maintenance rather than just
at the end of schema updates.

Run update.php more than once so all the updatelog entries
are populated and you'll see why it makes sense.

Change-Id: Ice42a31dee1e6b41da4aa0a47e8786579382aff1
2012-10-25 14:21:34 -04:00
umherirrender
fb2c1c645b Add separate fa_sha1 field to filearchive table
This allows sha1 searches with the api in miser mode for deleted files

Added script to populate the rows
Adding new field to selects and handle it in all places, where needed

Using a 10 byte index for the new field per
http://lists.wikimedia.org/pipermail/wikitech-l/2012-September/063429.html

Change-Id: Ie54a513fe361202e63df44be44a0fdd91926c974
2012-10-14 20:58:25 +02:00
umherirrender
b887cea9d1 PostDatabaseUpdateMaintenance: childs checks updatelog already
The parent class LoggedUpdateMaintenance of each update script is
checking the updatelog self.

Checking in update.php prevents the script to be run, when using --force
on update.php and updater is not outputting a skipped message

Change-Id: I6cdad807ee4e49983cedef168d4e697a5bd8b7e7
2012-10-12 20:52:29 +02:00
jeroendedauw
430b31415f Replace remaining Array occurences with array
Change-Id: Id7c2fdd6814a8239acbe050d857b56350e691a49
2012-10-05 16:11:54 +02:00
Hoo man
8ffbb077b3 Use __DIR__ instead of dirname( __FILE__ )
Removed left over uses of dirname( __FILE__ ) to __DIR__, even in comments.
Running the PHP version test in maintenance/Maintenance.php earlier, so that
we no longer have to stay PHP < 5.3 compatible in there.

Change-Id: I5a00bd5c6af44b7f826c4e5576a7b3de7b5026d8
2012-08-27 23:58:28 +02:00
jeroendedauw
bdaee6f659 Enable dropping of tables without having to create a file for each if you want correct output in the console
Change-Id: I374885517928430d00446b9711ea5005f58dc2a1
2012-08-23 22:43:20 +02:00
Mark A. Hershberger
1692e46c7c Clean up applyPatch() usage in the installer.
Change-Id: I4b25c16a1cd3813fe216ea8bcf46cca2fc54d943
2012-08-18 14:13:43 -04:00