Commit graph

83 commits

Author SHA1 Message Date
Chad Horohoe
f94e85e976 wfRunHooks() -> Hooks::run() in maintenance scripts
Change-Id: I6550bca3a6a3a6cd67bb1ed94c09805deed86dbc
2015-04-27 21:42:17 -07:00
Kevin Israel
a1e0051559 refreshLinks.php: Limit rows scanned per query in deleteLinksFromNonexistent()
This also makes the -e and [start] options apply to --dfn-only, making it
possible to restart the script other than at the beginning if necessary.

Bug: T38195
Change-Id: I828b522039290b5700faa89fb8ad4075e50332e7
2015-03-26 16:26:25 -04:00
Kevin Israel
1976b1a6fd refreshLinks.php: Tweak exit condition in deleteLinksFromNonexistent()
Instead of exiting the do...while loop only once a query returns zero
rows, exit whenever fewer rows than the batch size are returned. This
could save quite a bit of time when the highest nonexistent page_id
found is a relatively low one.

Follows-up 40e300b827.

Bug: T44180
Change-Id: I14d2d48c2405fcc0bd05a3181ba6293caef5298c
2015-02-28 04:54:48 -05:00
Kevin Israel
40e300b827 refreshLinks.php: Get IDs in batches in deleteLinksFromNonexistent()
... instead of making an unbuffered query, which is discouraged in the
doc comment for DatabaseBase::bufferResults().

Also used NOT IN for the antijoin instead of LEFT JOIN...IS NULL; when
combined with DISTINCT, the latter causes MySQL to use a temporary
table rather than an appropriate index, according to EXPLAIN. (Using
GROUP BY instead of DISTINCT also avoids this problem. I don't know why.)

Bug: T44180
Change-Id: Idca85fac7dd7879f9fbef2712b6aa83343099e02
2015-02-27 15:16:48 +00:00
Siebrand Mazeland
606c680b21 Update formatting in maintenance/ (4/4)
Change-Id: I6b58d014a4bfd6600e4e6f80188fdcfce18482ca
2014-04-23 20:09:26 +02: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
Brion Vibber
5cd20add48 bug 23839: "Refreshing links table" -> "Refreshing links tables"
There's not a single links table; there are several tables. :)

Change-Id: Ie2a76da3d047a41d102442be1919796bcd7bf2d2
2013-09-25 09:14:27 -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
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
Alexandre Emsenhuber
591a275230 Make redirect update in refreshLinks.php bypass the redirect table
This makes this script actually useful when updating namespaces by
making sure the target registred in the "redirect" is the correct one.

Consider the following example:

- Create a redirect page pointing to a page "Extra:Target"
- Add $wgExtraNamespaces[100] = 'Extra'; in LocalSettings.php
- run refreshLinks.php

Previously the redirect target of that page was not updated and still
pointing to (0, "Extra:Target") which no longer a valid title.
Now it will be updated correctly to point to (100, "Target").

The value of the page_is_redirect field will also be updated to be
sure it has the correct value, which might be wrong when the target
becomes valid or invalid, e.g. by changing $wgInvalidRedirectTargets.

Change-Id: I458ca63550df56ca96b35749daf4e7b866ab9d93
2013-01-17 10:51:35 +01:00
Alexandre Emsenhuber
2b6b4f9a0e Fix erroneous check in refreshLinks.php
Obviously null === false will never return true,
and what we actually want here is to check whether
we have a content or not.

Change-Id: Id78897e80ba2553c925e10d67c0fce2186aa11fd
2013-01-13 22:13:55 +01:00
Alexandre Emsenhuber
d85239a186 Use ResultWrapper::numRows() instead of DatabaseBase::numRows()
Change-Id: I87f059aaff72bf06ebc72ad3a7904cca8e11fab9
2013-01-06 11:52:40 +01:00
Platonides
6882ff0d75 The class is named Revision, no need to shout its name :)
Remove a couple of unused globals.

Change-Id: I750536bc05ed7a5433840b916b17df93d30da5bf
2012-10-26 23:41:24 +02:00
daniel
9994968774 merged master
Change-Id: Ib2b879c4daa17401eeeb50767c0e5a54254855c3
2012-08-29 15:20:15 +02:00
Daniel Kinzler
392af46809 Revert "merged master"
This reverts commit 67bfdc7a68
2012-08-29 13:14:49 +00:00
daniel
67bfdc7a68 merged master
Change-Id: Ib2b879c4daa17401eeeb50767c0e5a54254855c3
2012-08-29 12:06:38 +02:00
daniel
29719f846b merging latest master
Change-Id: I36b7f2f63ab8c08f8412d521dc68ea45c8b67711
2012-08-20 16:55:28 +02:00
daniel
8d280dde9b Moved getParserOutput to Content interface.
On Tim's request, this change moved getParserOutput() and getSecondaryDataUpdates()
from the ContentHandler to the Content interface.

Change-Id: Ia654aa8710a242ba5fe7a4eb528e6a6449035f59
2012-07-23 23:52:34 +02:00
daniel
3d58f903d8 Merge branch 'master' of ssh://gerrit.wikimedia.org:29418/mediawiki/core into Wikidata 2012-06-11 17:45:59 +02:00
Reedy
7492e90cc6 Add a bit more slave waiting...
Change-Id: I329219bfdd56b57609237fc9f907f2b31628d282
2012-06-09 03:37:38 +01:00
daniel
48d0bedd78 cleanup and fixes for secondary data updates 2012-06-07 14:57:43 +02:00
daniel
684178dfb6 Use Title, not IContextSource; remove createArticle, etc.
This merges the latest core patch into the Wikidata branch,
implementing suggestions collected on gerrit. Most importantly:

* Methods in the Content class no longer rely on a IContextSource
* createArticle and createEditPage were removed from Contenthandler
2012-05-23 08:53:01 +02:00
daniel
96b4779ebd introducing Content::getSecondaryDataUpdates() 2012-05-16 20:14:14 +02:00
daniel
87385643c5 fix: SecondaryDataUpdate -> DataUpdate 2012-05-15 15:21:08 +02:00
daniel
af28c6f55a merged from master 2012-04-29 21:41:03 +02:00
Alexandre Emsenhuber
b23194ab0e Use WikiPage::newFromID() instead of Title::newFromID() in refreshLinks.php.
Avoids having to load twice the same row from the database.

Change-Id: I3099dbd290e44f21677990e69200694c70aac63b
2012-04-26 09:54:28 +02:00
daniel
a990fd78ff merged from master 2012-04-25 19:49:09 +02:00
Alexandre Emsenhuber
5208ddbaac Use $wgContLang and an anonymous user in refreshLinks.php to parse pages.
Normally it should already be correct, but just in case it gets broken for some reason.

Change-Id: Ia38df1ba1f4a6224296bfd837a515ce0ccdf55cb
2012-04-23 09:11:24 +02:00
daniel
c536e3db65 use ParserOutput::getSecondaryDataUpdates() as the primary method of getting pending updates 2012-04-17 17:54:00 +02:00
Jens Ohlig
10e91851b2 Merge branch 'master' into Wikidata
Conflicts:
	.gitreview
	includes/Article.php
	includes/AutoLoader.php
	includes/EditPage.php
	includes/LinksUpdate.php
	includes/WikiPage.php
	includes/installer/Ibm_db2Updater.php
	includes/installer/MysqlUpdater.php
	includes/installer/OracleUpdater.php
	includes/installer/SqliteUpdater.php
	maintenance/refreshLinks.php
2012-04-11 14:24:29 +02:00
daniel
e67a39f37f use ParserOutput::getLinksUpdateAndOtherUpdates() in order to get all necessary update objects
Change-Id: I69c50e0bd59371a6a34b04d2762a882c6e7e60cb
2012-04-05 17:35:15 +02:00
Sam Reed
c47f83a4d4 More __METHOD__ in our madness 2012-02-24 18:45:24 +00:00
Sam Reed
f3f180850a Fixing up undefined types in maintenance documentation 2012-02-09 21:08:06 +00:00
Alexandre Emsenhuber
9c0ba20be8 * Use WikiPage instead of Article
* Use getRedirectTarget() instead of followRedirect(); the latter may return a string, which is not wanted here
* No need to call updateRedirectOn(); getRedirectTarget() already populates the redirect table if needed
2012-01-07 15:43:05 +00:00
Sam Reed
00d361886a * (bug 30451) Add page_props to RefreshLinks::deleteLinksFromNonexistent 2011-08-18 23:16:11 +00:00
Sam Reed
66e01d1bb7 Adding __METHOD__ to parameters passed to wfMkdirParents() 2011-07-25 22:01:19 +00:00
Sam Reed
4fc982ebd9 Fix whitespace, documentation 2011-07-09 03:49:25 +00:00
Sam Reed
a65d263fed * (bug 28630) Add iwlinks, langlinks, redirect to RefreshLinks::deleteLinksFromNonexistent 2011-07-09 03:47:43 +00:00
Sam Reed
4e4a717984 Followup r86183 and per bug 28628
Might awell make refreshLinks remove dead iwlinks from the table
2011-07-09 03:43:22 +00:00
Platonides
62053ac8fd Merge r86398 into the old wfWaitForSlaves. Update core calls.
maintenance/waitForSlave.php still calls the old prototype.
Most instances were replaced with 
sed -i 's/wfWaitForSlaves( [0-9]* );/wfWaitForSlaves();/' ./maintenance/initEditCount.php ./maintenance/updateRestrictions.php ./maintenance/updateSpecialPages.php ./maintenance/importDump.php ./maintenance/moveBatch.php ./maintenance/storage/resolveStubs.php ./maintenance/storage/trackBlobs.php ./maintenance/storage/fixBug20757.php ./maintenance/storage/moveToExternal.php ./maintenance/storage/compressOld.inc ./maintenance/populateSha1.php ./maintenance/deleteDefaultMessages.php ./maintenance/migrateUserGroup.php ./maintenance/importImages.php ./maintenance/runJobs.php ./maintenance/archives/upgradeLogging.php ./maintenance/deleteBatch.php ./maintenance/populateLogSearch.php ./maintenance/populateLogUsertext.php ./maintenance/gearman/gearmanWorker.php ./maintenance/populateRevisionLength.php ./maintenance/refreshLinks.php ./maintenance/deleteSelfExternals.php ./maintenance/upgrade1_5.php ./maintenance/rebuildFileCache.php ./includes/job/RefreshLinksJob.php ./includes/installer/MysqlUpdater.php ./maintenance/convertUserOptions.php ./maintenance/populateParentId.php ./maintenance/runBatchedQuery.php ./maintenance/upgrade1_5.php ./maintenance/waitForSlave.php ./maintenance/populateCategory.php ./maintenance/importImages.php
2011-04-20 00:12:06 +00:00
Sam Reed
3112302c73 Remove unused globals 2011-04-11 13:53:57 +00:00
Brion Vibber
8ee5e02054 Followup to r85706 and friends: now that Math messages have been moved to extension, move out the settings list and constants.
* MW_MATH_* constants are now defined in Math extension
* Language::getMathNames() is removed
* mathNames section in message files is removed
* A hardcoded preference override in refreshLinks moved to MaintenanceRefreshLinksInit hook
2011-04-09 19:57:35 +00:00
Sam Reed
993c5d1188 Rebuild raw sql
Remove old method_exists

Add braces
2011-02-09 20:09:22 +00:00
Sam Reed
2526cee7d1 Explicitally define $i = 0; 2011-02-09 19:54:23 +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
Alexandre Emsenhuber
9f5d06527c Part of bug 26280: added license headers to PHP files in maintenance 2010-12-16 19:15:12 +00:00
Alexandre Emsenhuber
29a787739c Changed global variables ($wgTitle and $wgArticle) to local ones 2010-12-13 15:13:06 +00:00
Mark A. Hershberger
617a5b1e15 Whitespace fixup under tha maint directory. 2010-12-04 03:20:14 +00:00
Chad Horohoe
9251469edd Fix undefined $max when doing --dfn-only 2010-11-13 16:32:40 +00:00