Commit graph

62 commits

Author SHA1 Message Date
Umherirrender 832d0ff745 Remove use of deprecated UsageException
Deprecated since 1.29, extension required 1.29

Change-Id: I2f550f0b94571afc289af616645b822d63fea4d3
2018-08-21 22:23:49 +02:00
Umherirrender add3e27461 User constructor does not take an argument
User object without argument is the anon default

Change-Id: I2c47c4865386d59f14eb6390b3e12fb9c5198ccd
2018-08-06 23:12:26 +02:00
Thiemo Kreuz 60cd40b975 Remove not needed count() and "return true" from hook handlers
This patch fixes two styls issues I could not separate:

* Hook handler functions do not need to return true. This is the default
anyway, and meaningless.

* Counting is possibly expensive and not needed when all we need to know
is if an array is empty or not.

Change-Id: I460776c981638806a606d9bf88fc8579d6da8c0e
2018-06-28 20:45:20 +02:00
Umherirrender 618aef40a0 Remove @return from __construct
Change-Id: I2000dc076c869620533368431f6c55241fbc92e8
2018-04-05 12:18:59 +02:00
jdlrobson d69b35f4bc Adjust expectations for API consumers when using the TextExtracts API
Bug: T170617
Change-Id: I53e08db40e5319019c842869f992bac32b1dac97
2018-03-20 09:42:10 -07:00
Gergő Tisza be8a5d6ea3
Bump cache version due to 'unwrap' ParserOutput option
Bug: T186927
Change-Id: I078f71d99f3179af5f4f85892472932eb5635fe1
2018-02-09 14:15:30 -08:00
Brad Jorsch 63a1d82b4e Use 'unwrap' post-cache transform instead of setWrapOutputClass( false ), when available
To reduce parser cache fragmentation, core is deprecating
$parserOptions->setWrapOutputClass( false ) in favor of
$parserOutput->getText( [ 'unwrap' => true ] );

Change-Id: Ibc013a41f4a463f4014fbbce7ce27f8690161728
2017-12-22 13:43:44 -05:00
Pppery f6fd9273c5 Re-enable MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic sniff
Bug: T170580
Change-Id: I0a0055f1de57f15a45c21e2f51ed275a2b249440
2017-11-30 15:31:55 -05:00
jenkins-bot 95dc34e4c7 Merge "Re-enable MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment sniff" 2017-11-30 19:11:09 +00:00
Pppery d05f289032 Re-enable MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment sniff
Bug: T170580
Change-Id: Ib5bcab3414f44013cf57c0d006b212dea175473a
2017-11-29 23:07:30 -05:00
Pppery 009765a04c Re-enable MediaWiki.Commenting.FunctionComment.MissingParamComment sniff
Also renames $action to $name in APIQueryExtracts.php, because trying to
document the parameter revealed that "action" doesn't match the use of
the parameter.

Bug: T170580
Change-Id: I1b7f3f0e17b118ea9bcfd28c69321aa692aad4e3
2017-11-29 21:56:29 -05:00
Pppery 624da67ec6 Re-enable MediaWiki.NamingConventions.LowerCamelFunctionsName.FunctionName sniff
Change-Id: I420fd3640772f4127ca15603af00fd30aecc28c0
2017-11-29 20:27:15 -05:00
Umherirrender 01376c8e05 Improve some parameter docs
Change-Id: Ie4326ecb517e5c7381b946b45bc108f8889fd4b2
2017-10-07 11:24:02 +02:00
libraryupgrader 7e548ce1b4 build: Updating mediawiki/mediawiki-codesniffer to 0.12.0
Change-Id: I3e1260e19de4a12c995b51a1a4416dbdf87829cf
2017-09-01 04:58:00 +00:00
jenkins-bot 237ac977f7 Merge "Hygiene: Remove deprecation and unused import" 2017-08-03 21:36:11 +00:00
Piotr Miazga 91bbe7b10a Hygiene: Remove deprecation and unused import
Changes:
 - ApiBase::setWarning() is deprecated, use addWarning() instead
 - ParserCache::singleton() is deprecated, use MediaWikiServices instead
 - Exception import is not used, drop it
 - added MediaWiki 1.29 as a requirement

Bug: T166714
Change-Id: Ib81e5acbb28e1f803c7a792b9f990f2aa6d57521
2017-08-02 16:32:13 +02:00
Piotr Miazga fcda3b365b When APIParse fails log the warning and return null
API Parse request fails from time to time which causes PHP notice
error. In order to understand whats going on lets introduce error
logging as temporary solution. This will give us possibility to
find the error instead of silently returning null. For now we will
keep old behaviour and return null in that case explictly. This will
avoid future php notice errors.

Changes:
 - when API parse request fails log the error and return null

Bug: T169017
Change-Id: Ib908821b76a1e8b59235643854752c4f5910a274
2017-08-02 15:12:20 +02:00
Max Semenik 753fc03c10 Don't call ParserOuptut::setTOCEnabled()
It's not really needed. Add tests verifying that.

Bug: T168040
Change-Id: I49cf58d92620ad53dd833bc8ce0d2443a00b48e4
2017-07-24 17:55:06 -07:00
jenkins-bot d72b09724e Merge "Remove deprecated $wgUseTidy in favour of $wgTidyConfig" 2017-07-07 22:49:21 +00:00
Baha 97a25e2183 Return empty extract for articles in File namespace
Bug: T114418
Change-Id: I2dfccbcf27284ecfdd0669b004151824ece79b73
2017-07-07 15:32:27 -07:00
Piotr Miazga c13dae2788 Remove deprecated $wgUseTidy in favour of $wgTidyConfig
Bug: T168671
Change-Id: I27f5bee2448797c3a5a8cb886cee0e518b199ebe
2017-07-07 21:39:30 +00:00
jenkins-bot 698a8a8066 Merge "Send sectionpreview parameter on TextExtract parse" 2017-06-29 00:25:10 +00:00
jdlrobson 27baa2d0d9 Send sectionpreview parameter on TextExtract parse
This will invoke special handling for unbalanced templates

Bug: T168743
Change-Id: I3fe1bd5b56a049f57fad478f1358dd8496503b41
2017-06-28 08:55:00 -07:00
Kunal Mehta 43f3539a7c Set an expiry for memcache entries
Use the same expiry as the parser cache since this is a derivative of
the parser cache.

And avoid wfMemcKey while we're at it.

Change-Id: Ieba084aff4b8beb180da01d9cc4b8a2857569171
2017-06-11 20:12:55 +00:00
Brad Jorsch 1f1c7e639d Chunk page ids in internal API call to avoid too-many-pageids-for-query
One of many reasons that internal API calls are bad.

Bug: T41936
Change-Id: I3d2cf2b4f619f590e74a88fa4a78832b8be8495e
2017-05-26 17:17:21 -04:00
Baha 182304dc6d API: Limit maximum number of characters when exchars is passed.
Set the limit to 1200 characters.

Bug: T156467
Change-Id: I4e53b26a3f57f5f5cf7acbd3702c8bc4541a5eb5
2017-05-24 18:04:20 -04:00
jenkins-bot a803755b3e Merge "Add phpcs and make pass" 2017-05-24 13:17:49 +00:00
Umherirrender 93be5e75f6 Add phpcs and make pass
Change-Id: I2f95b3dfa260d955a5a420d0bf3c914382c09746
2017-05-19 18:39:27 +02:00
Baha 6bfe60508a Increase default API limit from 1 to 20
Bug: T153707
Change-Id: I6ba3adb7c680e1a60461cd3903cbf8640721ea02
2017-05-19 09:39:13 -04:00
jenkins-bot 7c81c6ec9f Merge "Suppress parser output wrapper div" 2017-05-16 14:49:40 +00:00
Brad Jorsch 42e87ac3b6 Suppress parser output wrapper div
It confuses the code that munges the HTML to produce an extract.

By itself this won't fix the bug, but together with a core change to
avoid polluting the parser cache such as I5be25c6d it should work.

Bug: T165161
Change-Id: Ia1b654bf659958c04d7e370d4686cf17f615b591
2017-05-16 14:47:49 +00:00
Kunal Mehta aef292b82b API: Change memcache key to clear cache
And add a CACHE_VERSION constant to make this easy in the future.

Bug: T165161
Change-Id: I362f44cf3d680d073e7e6dc6eec95ec5eec15684
2017-05-12 11:19:51 -07:00
Max Semenik 21ef48483f getFirstSentences(): don't use crazy regexes
Bug: T145231
Change-Id: I820fb152e86b273ddeba1617658a13e3a3f0bae3
2017-01-20 10:13:46 -08:00
Max Semenik fb2c163345 Uncomment and fix a test
Change-Id: I57facf073dd688f57f35a18015a0aa14b7b7f4c4
2017-01-19 16:16:35 -08:00
Max Semenik abb0f4df96 getFirstChars(): don't use quantifiers with user-supplied count
Bug: T143178
Change-Id: Iba6d929156040f5388461aaf075644d8fbf647be
2017-01-10 17:42:14 -08:00
Brad Jorsch 739e02f2d2 Update for API error i18n
See Iae0e2ce3.

Change-Id: Ibe7cb02d551ac2f85ee01edbf2b40a966ed42b74
2016-12-08 10:08:25 -05:00
Max Semenik ec44826b7a Remove use of a removed function
Change-Id: Iac8bec0a0a2625e40c5c70a715ffb4784224f164
2016-09-22 18:58:55 -07:00
Max Semenik 264f65215b Minor fixes
* Annotations
* Deprecated functions
* Namespace tests

Change-Id: I521f6af6074a454cec5322ab4cd46db08350c2c3
2016-09-22 18:51:12 -07:00
Max Semenik 754c9e4f19 CodeSniffer fixes
Change-Id: I8bdcd2250bd3163fe40ce4685eb04bffe53afdca
2016-09-22 18:38:27 -07:00
Brad Jorsch 90a025b839 Remove pre-1.25 API compatibility code
Since this extension uses extension.json, it already requires 1.25+ so
no need to keep the old code around.

Change-Id: Id9e8fb026b26bb4db34fb22bd631205ce6f7072b
2016-09-20 15:23:35 -04:00
Fomafix 579fae4c38 API: Remove unused parameter exvariant
All API calls supports the generic parameter variant.
With I8a31dfd3cf2a3e8f768907084d26a77f198ccbe3 in core this parameter
is documented and generates no warning anymore.

Bug: T117529
Change-Id: Ic7e6f1df99c67ad4132c22503d99345611af271a
2016-09-19 18:00:19 +00:00
Reedy ad435fb4e1 Remove 'UnitTestList' hook
No longer needed now that extension unittests are autodiscovered.

Bug: T142120
Bug: T142121
Change-Id: Iaff2e40a8bddfd5d45170b49641b8afa15987527
2016-08-23 14:54:47 +01:00
jenkins-bot fbe7379738 Merge "The last sentence of the paragraph was lost." 2016-04-14 00:00:21 +00:00
Max Semenik 9bc33683a0 Switch to librarized HtmlFormatter
Bug: T125001
Change-Id: Iac73553ac4b03e75ef321c6a659ece1ac155260b
2016-04-12 21:23:01 -07:00
Sergey Leschina ae7fe951f1 The last sentence of the paragraph was lost.
Change-Id: I963ca71b73dc7396156e8b5fcf5d2952e4abbc05
2016-04-11 02:08:14 +03:00
Sergey Leschina 472d84c9de Fix separation of text into sentences.
Some space characters like   or $thinsp; usually is not indicate to the end of sentence, so shouldn't be used as separators.

Bug: T115817
Change-Id: Ieb56b0ef723dd299f848ea88b66613d92977bef0
2016-04-01 10:49:17 +03:00
Kunal Mehta 0664ddbf94 Add missing use statement
Removed another unused one, and cleaned up the doc block.

Bug: T121283
Change-Id: I1a8b9920152e6d52ffb59de385fcc29c92f33c92
2015-12-11 15:11:43 -08:00
mhutti1 80703452ed Converted TextExtracts to new extension registration system
Moved most of TextExtracts.php to the new extension.json
and added method for backward compatable implementation
of the extension if still called though the php file. Moved
unit test hook to Hooks.php and deleted old il8n.php.

Bug: T87979
Change-Id: I3d26bd931ad2941268b94474f3e6327282da24ec
2015-12-10 22:59:49 +01:00
Sumit Asthana 13d6592978 TextExtracts do not crop after initials
Disables sentence termination at a full stop preceeded by a capital
alphabet which is likely to be an initial.

Bug: T115795
Change-Id: Ibf38e87823155c704ffb106642944cbd05e3f632
2015-12-03 07:11:36 +05:30
Sumit Asthana d83ac976e3 TextExtracts allow sentence end with numbers
Allows sentences to end with numbers before a full stop in query
extractsentences.

Also added some more unit tests.

Bug: T118621
Change-Id: I9cbf487601d4165b490696d38d5fcbcf6d8f4637
2015-11-18 20:11:20 -06:00