Commit graph

77 commits

Author SHA1 Message Date
WMDE-Fisch
6df9ed1ad6 update mediawiki-codesniffer to 0.11.0 and fix issues
- mostly auto fixes
- some too long lines fixed
- ignore amp space in one case  passing by reference

Change-Id: I6472f83bc3cbf4bd629d83050cc3319b19ec465c
2017-08-11 22:27:51 +02:00
Umherirrender
b5cddfb27b Remove empty lines at begin of function, if, foreach, switch
Organize phpcs.xml a bit

Change-Id: Ifb767729b481b4b686e6d6444cf48b1f580cc478
2017-07-01 11:34:16 +00:00
Antoine Musso
1819a85bed Check for string initialization in lcfirst() for HHVM 3.18
HHVM 3.18 emits a notice when attempting to access the first offset of
an empty string.  We had that fixed for ucfirst() in 3605066c96. This is
the same for lcfirst().

Bug: T161095
Change-Id: I1456611222c24290f259298e883ca89dd830c74b
2017-03-24 15:19:36 +01:00
Andre Klapper
3605066c96 Check for string initialization in ucfirst() to make HHVM 3.18 happy
Bug: T161095
Change-Id: I45b5d9e819061f443d4342c004bad80bd87c2a17
2017-03-22 13:17:11 +01:00
Leszek Manicki
cb4bb23df6 Remove unused static methods in LanguageConverter subclasses
It seems LanguageConverter::parseManualRule was removed by
69dbeb97f1 (2008),
and LanguageConverter::parserConvert by
c568220e61 (2010),
so it seems safe and reasonable to remove their implementations
from few remaining language-specific Converter classes.

Change-Id: I7092f5c8856723fabd2b1f99944451344feb5711
2017-01-03 15:13:51 +01:00
Ricordisamoa
cd7da66fb5 Add missing 'public' keywords to some more Language methods
All of them are already being used outside the class:
* getMonthAbbreviation
* getMonthAbbreviationsArray
* getWeekdayName
* sprintfDate
* userAdjust
* date
* time
* timeanddate
* getMessage
* iconv
* ucfirst
* uc

Change-Id: I63ec93858cebc02cdf3b9b042eddf4ef620cc110
2016-05-04 16:02:39 +02:00
Kunal Mehta
6e9b4f0e9c Convert all array() syntax to []
Per wikitech-l consensus:
 https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html

Notes:
* Disabled CallTimePassByReference due to false positives (T127163)

Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
2016-02-17 01:33:00 -08:00
jenkins-bot
d4ecfc1a5c Merge "Don't modify $wgHooks on language object construction" 2016-02-11 04:05:56 +00:00
Tim Starling
059fd9a2ae Don't modify $wgHooks on language object construction
Previously various language objects would install a hook to update the
shared conversion table cache when the object was constructed. This is
not a good idea since language objects may be constructed even when they
are not the content language, but only the content language is
associated with variant conversion and the conversion cache.

Instead, have WikiPage call a method on $wgContLang directly. I put this
with message cache update since the logic is almost identical.

Change-Id: Ief9c0ef993e39645e74a6e158cb4e6e2139ce91d
2016-01-29 15:03:56 +11:00
Tim Starling
e0a74a848c Remove require_once for language classes
Remove require_once for LanguageConverter and base classes. These
are in the autoloader now, so an explicit require is no longer
necessary.

Change-Id: Ie34ffc58fd9ec89fb57cf077dd5ac1746c35c48e
2016-01-29 10:05:25 +11:00
Timo Tijhof
86b4704d09 languages: Avoid getPreferredVariant() in ucfirst/lcfirst unless needed
This method calls out to LanguageConverter which involve the User,
Request, and additional validation.

Change-Id: I3edae1244073767a8d8888708024bb5498c70dc9
2015-11-10 00:47:18 +00:00
Chad Horohoe
aa21e125a3 Remove obvious function-level profiling
Xhprof generates this data now. Custom profiling of various
sub-function units are kept.

Calls to profiler represented about 3% of page execution
time on Special:BlankPage (1.5% in/out); after this change
it's down to about 0.98% of page execution time.

Change-Id: Id9a1dc9d8f80bbd52e42226b724a1e1213d07af7
2015-01-07 11:14:24 -08:00
This, that and the other
4fe902a715 Don't fiddle with $wgLanguageCode in KkConverter
This was causing problems with the setlang= and uselang= parameters in the
URL being ignored on kkwiki.

Bug: 64440
Change-Id: I4e2a20c707fd4b9b8a581a9d14e04b6cfc8b4b5c
2014-11-11 08:17:04 +01:00
umherirrender
ae3c883150 Cleanup some docs (languages)
- Makes beginning of @param in capital
- Removed return void

Change-Id: Ie05436c1ef886cb23c62ccde95384f253f83694c
2014-08-09 22:20:15 +02:00
withoutaname
69db8dc867 Remove $wgTitle from LanguageConverter subclasses
$wgTitle was simply used in these classes to prevent conversion
of prefixed names for files. Now that we have $wgNamespaceAliases
that is rendered moot, so this will instead return just the parent
class call for autoconvert().

Bug: 57562
Change-Id: I26f8a8aa0be3822056f286f2e15201cbe4d592bf
2014-07-23 03:52:54 +00:00
Siebrand Mazeland
03b2b42084 Make languages/classes pass phpcs-strict
Change-Id: I0985f3c7e4b36338c68a4a63cfba4eaa4af567c0
2014-04-22 14:13:02 +02:00
umherirrender
55e8a9abfd Fixed some @params documentation (languages)
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.

Change-Id: I7a4dec6a8de96ee21ef34e52bb755f723aa3b0e6
2014-04-17 13:32:54 +00: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
umherirrender
9f14ecf829 Added space after switch/Removed spaces after unset
While at it, added/removed some other spaces in the same files

Change-Id: I84d8001aa123a008807ad5eb76f396aed7c899a4
2013-04-26 16:42:31 +02:00
umherirrender
3c7bcf4658 Fixed spacing in languages folder
Added spaces before if
Added some braces for one line statements

Change-Id: I980771894369499646532b13b801db6447381773
2013-04-17 21:10:02 +02:00
Alexandre Emsenhuber
15833dafdf Fix case of some Title methods
Change-Id: I1a37ffb0e8cde4deac027721b0e463585b58d634
2013-03-26 10:54:15 +01:00
umherirrender
8764b3aa7c Remove spaces in function signature
Change-Id: I45aea7a7af88cd913b2f485913620a8af0ab2fed
2013-03-18 20:44:43 +01:00
Liangent
e01adbfc0b Clean up Language::markNoConversion().
* IRIs are getting more and more widely used these days so Chinese
  characters are also needed to be prevented from being converted
  in text of external links.
* So now all markNoConversion() functions in languages with variants
  do the same thing. Merge them into a single function in the
  Language class and drop implementations in individual languages.
* By the way rephrase phpdoc of that function, and (bug 24798) fix
  the link detection regex to use wfUrlProtocolsWithoutProtRel().
  Protocol-relative regex is excluded to avoid false positives.
* Add parser test for it.

Change-Id: I2ec0ac2b9b11221584adb72555168498de209d57
2012-11-18 03:46:53 +08:00
Siebrand Mazeland
4b62b0339c Prefix new ContentHandler hooks in WikiPage with Page instead of Article
Covers 3 hooks:
* ArticleContentInsertComplete -> PageContentInsertComplete
* ArticleContentSave -> PageContentSave
* ArticleContentSaveComplete -> PageContentSaveComplete

Change-Id: I186669a5941d8982725ed364b481215d291b2043
2012-10-11 18:22:52 +02:00
daniel
a138706729 Fix usage of deprecated ArticleSaveComplete hook in core
Change-Id: Ic01fd95d50a909470d6f0ffd93c972322789d49a
2012-10-08 14:13:59 +02:00
daniel
b6fe213226 merge latest master.
some tests fail due to logical changes, will fix that in a follow-up

Change-Id: I8a5e4087ecf674fbcf6327c5d168cd401be12400
2012-09-05 17:50:13 +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
Alexandre Emsenhuber
5b760e4233 Added missing GPLv2 headers in some places.
Also made file/class documentation more consistent.

Change-Id: Ia79634e62a7aee293d4e8534082f503bbc2b614f
2012-06-07 13:06:19 +02:00
Reedy
90db885789 '/Şçʹ/u' => 'Щь'
^ Duplicate array key listed twice

Change-Id: Id24beb982662a5e6c9e1d2b1f1e1ff637e50f2dd
2012-04-07 21:13:12 +01:00
Sam Reed
b6b807b2bc More documentation! 2011-05-29 16:32:05 +00:00
Sam Reed
6869bd5893 More documentation! 2011-05-29 15:59:47 +00:00
Sam Reed
f54cfa1001 More documentation! 2011-05-29 15:53:18 +00:00
Platonides
82fb370dfc Changes to doc-comments. /* to /** in language folder. 2011-05-22 22:05:18 +00:00
Sam Reed
15f4f6f360 Explicitally define some variables
Function documentation
2011-02-18 23:21:48 +00:00
Sam Reed
6b3b915353 Big attack on unused variables... 2010-10-14 20:53:04 +00:00
Sam Reed
22764a53f8 Braces, spaces, and a few unused arrays 2010-09-21 06:55:49 +00:00
Platonides
d3e1536f46 Follow-up r72561. Missed language folder. 2010-09-07 22:39:05 +00:00
Sam Reed
e476b51e3a Stylize languages/*, languages/classes/*, but not languages/messages/* 2010-07-29 09:43:18 +00:00
Tim Starling
750b8f7c04 In LanguageConverter:
* Rewrote convertArray() as an RD parser (with inline tokenizer) as suggested on CR r60986. Fixes unclosed rule issue (with parser test). Fixes O(N^2) timing.
* Removed $this->mMarkup abstraction. Life is complicated enough as it is.
* Replaced a couple of instances of explode() with StringUtils::explode(), limited element count in a couple more.

In ConverterRule:
* Removed mConvTable initialisation from the constructor, unnecessary
* Optimised the "-{xxx}-" tight loop by replacing function calls such as count() and in_array() with language constructs such as isset(). Reduced execution time from 356us to 275us.
* Cached $varsep_pattern for further reduction to 243us.
* A couple more parseFlags() hacks brings it back to 230us.
* Split out $this->mVariantFlags from $this->mFlags. Rearranged flag detection into a foreach/switch to avoid unnecessary isset() calls. 189us.
* Added a special-case optimisation to generateConvTable() for the case where there are no tables defined inline in the article. 116us.
* Fixed bug from r37499: "!R || !N" is always true since they are mutually exclusive, "!R && !N" was intended (with parser test).
* Fixed E_NOTICE from "-{N|foo}-"
2010-01-19 02:36:33 +00:00
Mark A. Hershberger
c568220e61 Refactor LanguageConversion so that title conversion isn't so flimsy. Pull MagicWord detection into Parser->doDoubleUnderscore() && remove ParserConvert. 2010-01-07 04:13:14 +00:00
Philip Tzou
205ef1ba8b 1. Use param $ignoreOtherCond instead of $forTemplate and $ignoreSubmitCond in findVariantLink().
2. Drop some duplicate categories produced by findVariantLink().
2009-02-02 07:54:43 +00:00
Philip Tzou
a31dceccc9 To find an available category name during update table 'categorylinks'. Just act on the language which enabled LanguageConverter. 2009-02-02 06:53:49 +00:00
Ilmari Karonen
34fb6297cd Step 2 in NS_IMAGE -> NS_FILE transition (bug 44) (WARNING: huge commit).
This is a global search and replace of NS_IMAGE and NS_IMAGE_TALK with NS_FILE and NS_FILE_TALK respectively in all core files, excluding those already updated in step 1 (r44004).
2008-12-01 17:14:30 +00:00
Andrew Garrett
c06afd56b3 Revert "Follow up on r43982. Reduce dirname(__FILE__) calls in core and extensions."
Uses $dir in extension files, and assumes that it remains unchanged in require_once( 'maintenance/commandLine.inc' ).
In fact, it is likely that '$dir' will be set when setting up command-line, as some extensions will use the same var.

Recommended fix: Use $CentralAuth_dir, $EmailPage_dir, etc.
2008-11-30 03:15:22 +00:00
Siebrand Mazeland
daaa7f37a1 Follow up on r43982. Reduce dirname(__FILE__) calls in core and extensions. 2008-11-26 23:17:15 +00:00
Alexandre Emsenhuber
05b0fbd558 (bug 15303) Title conversion for templates wasn't working in some cases 2008-08-25 18:06:54 +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
Siebrand Mazeland
555019a2c6 remove EOL whitespace, and excess empty lines 2008-05-17 17:10:18 +00:00