Commit graph

14 commits

Author SHA1 Message Date
Matthew Flaschen
2cb0f735e2 Also support skin.json for updating JSON AutoloadClasses
Bug: T88194
Change-Id: Ib56680e6e0e983184e31c336dcac174922a86551
2015-06-25 01:05:16 -04:00
Smriti.Singh
cbcbbf2bf1 AutoloadGenerator.php: Update 'AutoloadClasses' in extension.json
AutoloadGenerator.php until now only updated autoload.php. As we shift
to extension registration, it would be cleaner if AutoloadGenerator.php
directly updates 'AutoloadClasses' in extension.json.

Bug: T88194
Change-Id: Idd601d7897634fae8c69f4d5338d9fc8f8b8f89b
2015-06-05 11:41:59 +03:00
Timo Tijhof
e5f0884ec4 Ignore phpcs in autoload.php
Causes 20 warnings for line length
https://integration.wikimedia.org/ci/job/mediawiki-core-phpcs-HEAD/13849/console

As being autogenerated, migth as well ignore so we can have
mediawiki-core pass.

Change-Id: Iedbe527456144c9b09b7ba93a8ce67edf0b47015
2015-03-16 19:09:28 +01:00
Reedy
4d9143c7f5 Add lots of @throws
Change-Id: I09d0c13070f966fcf23d2638d8fc1328279a5995
2014-12-24 13:49:20 +00:00
Bryan Davis
5e2c34fec3 Fix AutoloadGenerator to work on MediaWiki-Vagrant (again)
The patch set from I5d502b5 re-introduced the use of realpath() within
AutoloadGenerator::readFile() as part of a set of changes to ensure that
path separators are normalized across Unix and Windows systems. As noted
previously in I4623b3d, the use of realpath() in this function will
cause fatal exceptions to be thrown when a file such as
LocalSettings.php is a symlink to a file outside to $IP.

This patch separates the path normalization functionality from
realpath() expansion and uses only the path normalization component
within AutoloadGenerator::readFile(). It also introduces a cautionary
comment in AutoloadGenerator::readFile() that will hopefully keep
realpath() from being reintroduced there.

Change-Id: I4923dfa8370a7bd6077f42ff4c437d7293fdad66
2014-12-20 21:45:43 +00:00
This, that and the other
3e975cfc94 Make the autoload generator use forward slashes on all OSs
It was previously using the platform-specific directory separator, meaning
that we got backslashes on Windows and forward slashes on other OSs.

Bug: T77004
Change-Id: I5d502b54fddd55272e63d4a2a14b6d5de541263a
2014-12-19 16:11:35 +00: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
Bryan Davis
179854c3ce Fix AutoloadGenerator to work on MediaWiki-Vagrant
The use of realpath() in AutoloadGenerator::readFile() causes the
LocalSettings.php symlink to be dereferenced. Since the target file
lives outside of $IP, AutoloadGenerator would fail with an exception.

Change-Id: I4623b3da9b984026999189d70349ffb4754812a5
2014-11-20 16:05:07 -07:00
Erik Bernhardson
24a72730d6 Bug: Append to wgAutoloadClasses
When generating $wgAutoloadClasses for an extension the generator
currently outputs an assignment (=), but it is unlikely this is
the desired result. An extension wants to append to the existing
$wgAutoloadClasses. This bug is an unintended consequence of I75403ace
which changed the generator from assigning one key per line to using
an array literal.

This patch changes the output only when generating $wgAutoloadClasses
to the += operator which adds to the array any value that is not
already in the array.

Change-Id: I7d42ee5dc829991c6562878f0c90a06fadb1b6a6
2014-11-19 06:33:51 +00:00
Erik Bernhardson
5711d81126 Doc: Mention the php command in autoload.php to regenerate it
Adds a comment to the top of the generated autoload.php directing
developers to the command to regenerate the file so they may just
copy and paste the command.

Change-Id: If098a1eb51ed732378677215c0e438c73d506697
2014-11-17 16:35:32 +00:00
Kevin Israel
44ea55c41f AutoloadGenerator: Add newline at end of output file
Change-Id: I2b5a1adc115afd9430c1ea91285516c9c4290875
2014-11-15 21:44:52 +00:00
Kunal Mehta
3d11157294 AutoloadGenerator: Don't throw MWExceptions
The class won't have been autoloaded, so it can't be used.

Change-Id: I54a9be600839c7bffe7debb8ee35ac46694390b4
2014-11-14 11:47:52 -08:00
Erik Bernhardson
5a5d910a35 Performance improvements for autoload generator
Both zend and HHVM run through the autoload file faster when it
is a single array literal rather than individual key assignments.

The __DIR__ string concatenation remains because HHVM and Zend >= 5.5.0
optimize away constant string concatenation.

Change-Id: I75403ace264b09930d5cc545e62b8d7c3f1ad064
2014-11-14 10:18:13 -08:00
Erik Bernhardson
396a76f2ff Generate $wgAutoloadLocalClasses with a maint script
Currently all new classes in core need to be registered
with the autoloader.  This is acceptable but inconvenient.

This patch adds a script to read the output of php's tokenizer
to determine the names of all the classes within mediawiki core.
Patches with new or removed classes will just need to rerun
the maint script rather than manually adjusting the arrays.

A full conversion to psr-0 + composer would solve this as well,
but this is a very non-intrusive patch that can get us some
portion of the benefit(reduced manual maintenance) today rather
than months down the line once we figure out all the intricacies
of mediawiki + composer.

Change-Id: I8b1bdb84a9699de79f8b9951fa61e5437d083c55
2014-11-13 15:41:31 -08:00