Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This issue is about implementing a drupal://[module|theme|...]/[name]/[file]
streamwrapper that is able to load code from PHAR archives.
Comment | File | Size | Author |
---|---|---|---|
#9 | 1185360.patch | 17.84 KB | Damien Tournoud |
#6 | 1185360.patch | 18.4 KB | Damien Tournoud |
#3 | test.phar_.gz | 6.83 KB | Damien Tournoud |
#2 | 1185360.patch | 9.62 KB | Damien Tournoud |
Comments
Comment #1
Damien Tournoud CreditAttribution: Damien Tournoud commentedDevelopment branch: 8.x-1185360 in my sandbox.
Comment #2
Damien Tournoud CreditAttribution: Damien Tournoud commentedWith this, I can install Drupal and load a module from a
.phar
archive in any modules directory.Comment #3
Damien Tournoud CreditAttribution: Damien Tournoud commentedExample of PHAR archive (strip the .gz suffix).
Comment #5
chx CreditAttribution: chx commentedNice. Love it. Note that the stream wrapper does not support directories AFAIK and so you can just drop those. In fact, if all the stream_wrapper is doing is include 'drupal://' then stream_open, stream_read and stream_eof is enough.
Comment #6
Damien Tournoud CreditAttribution: Damien Tournoud commentedThat should fix the tests, hopefully. Also, completely removed drupal_get_filename() now.
Comment #7
chx CreditAttribution: chx commentedOh you are using the phar archives as directories! Very clever. I hope the bot passes. Will review more.
Comment #9
Damien Tournoud CreditAttribution: Damien Tournoud commentedRemoved an unnecessary change in file.inc that prevent http-based file URLs from being rendered properly.
Comment #10
neclimdulsub
Comment #11
cweagansMaybe I'm missing something: why should this be in core?
Comment #12
catchSubscribing.
Comment #13
sunWondering whether it would make sense to keep drupal_get_filename() as simple procedural wrapper?
24 days to next Drupal core point release.
Comment #14
droplet CreditAttribution: droplet commentedlove to see this on drupal +1. Subscribing
Comment #15
Crell CreditAttribution: Crell commentedSubscribing.
While I don't know that modules should ship as phar archives, once we have a lot more namespaced class-per-file code it may be better to use a built phar archive rather than a built mega-file to reduce autoloading. See related discussion here: #1241190: Possible approaches to bootstrap/front loading of classes
Comment #16
RobLoachWe could save ourselves this line of code if we just place the file at core/lib/Drupal/Core/StreamWrapper/ModuleStreamWrapper.php and stick
use Drupal\Core\StreamWrapper\ModuleStreamWrapper;
at the top of each file we use it in.-10 days to next Drupal core point release.
Comment #17
sinasalek CreditAttribution: sinasalek commentedBrilliant idea
Comment #18
shariharan CreditAttribution: shariharan commentedCan D7 work from PHAR archive?
Comment #19
jerry_pham CreditAttribution: jerry_pham commentedDoes this refactor make it possible to run Drupal completely from a PHAR archive?
Comment #20
deviantintegral CreditAttribution: deviantintegral at Lullabot commentedI did a pretty deep dive into PHAR archives a few months back, investigating to see if they were suitable for a D8 deployment. I found several issues including:
Given the lack of updates on this patch, and all the above, I'm closing as wontfix. PHARs are great for CLI tools, but not for for web facing apps.