Comments

amateescu’s picture

Assigned: amateescu » Unassigned
StatusFileSize
new13.44 KB

Let's see if we can get some green with the first one :)

amateescu’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, archiver-psr0.patch, failed testing.

cweagans’s picture

The classloader can't find the PEAR Archive class. I'm not sure how that works though, so I wasn't able to dig much further than that. I tried to manually manually run the test case that was failing. This is the PHP error that I got:

"PHP Fatal error: Class 'PEAR\\Archive_Tar\\Archive_Tar' not found in /Users/cweagans/Sites/d8.dev/core/lib/Drupal/Component/Archiver/Tar.php on line 28, referer: http://d8.dev/admin/reports/updates/install"

amateescu’s picture

Status: Needs work » Needs review
StatusFileSize
new1.34 KB
new13.71 KB

Hm, seems that our class loader only likes Symfony code.

I tried adding:

'PEAR' => DRUPAL_ROOT . '/core/vendor',

to $loader->registerNamespaces in _drupal_bootstrap_configuration() without any luck, so I'm moving the Archive_Tar class under the Drupal\Component\Archiver umbrella because it's already altered and doesn't really belong to vendor anyway.

Status: Needs review » Needs work
Issue tags: -PSR-0

The last submitted patch, archiver-psr0-5.patch, failed testing.

cweagans’s picture

Status: Needs work » Needs review
Issue tags: +PSR-0

#5: archiver-psr0-5.patch queued for re-testing.

Crell’s picture

The Archive_Tar class is 3rd party code, not Drupal code. Also, it is not PSR-0, because it's not PHP 5.3. So...

I'm thinking that file should get moved to /core/vendor/PEAR/Archive_Tar.php, and referenced as a Prefix with the class loader, not as a namespace.

catch’s picture

That sounds right, the Symfony autoloader supports PEAR classes, so we can still use it, just not the same as everything else.

amateescu’s picture

Assigned: Unassigned » amateescu

Ah, so I was trying one level too deep in #1 (/core/vendor/PEAR/Archive_Tar/Archive_Tar.php instead of /core/vendor/PEAR/Archive_Tar.php). I'll take another crack at it then.

amateescu’s picture

Assigned: amateescu » Unassigned
StatusFileSize
new1.12 KB
new13.86 KB

Much better now.

Crell’s picture

Status: Needs review » Needs work

Minor nit:

+++ b/core/lib/Drupal/Component/Archiver/Tar.php
@@ -0,0 +1,90 @@
+  public function extract($path, Array $files = array()) {

array is a base datatype, so should be lower-cased, I think. There was some issue about it somewhere... :-)

Also, it's awesome to see that this code can end up in Component. However, Components are not supposed to have any external dependencies. This code has a dependency on the PEAR Archive_Tar class. :-( Not sure what we want to do there, as I'd hate to move it to Drupal\Core but...

berdir’s picture

Status: Needs work » Needs review
StatusFileSize
new13.87 KB

Components can depend on other components, right? So why not on a 3rd party component?

Anyway, here is a quick re-roll with the Array fixed and also fixed conflicts in system.info.

catch’s picture

Yeah I agree with Berdir, the idea of a Component is it's something that could be used independently of core, so having dependencies isn't the issue, it's having dependencies on application-level Drupal code that would be.

Crell’s picture

OK, if we include a README.txt file in the Component/Archiver directory stating the dependency with a link to where to get the file, that's good enough for me.

The current Component readme file says that there can be no external dependencies other than other Components, but I'm willing to be a little bit flexible with that on things like this.

catch’s picture

I had a feeling that system.tar.inc might be forked, and it is: #486558: Add Archive Tar to Drupal.

amateescu’s picture

Yes it is. And there's even an issue to upgrade it: #1414508: update system.tar.inc to latest Archive_Tar (Pear).

catch’s picture

So if it's forked, can we legitimately put it in a PEAR directory? Seems more like it should go in Drupal\Component with the rest of the code (and we could possibly look to see if the updated version might be possible un-forkable again).

amateescu’s picture

@catch, placing it in Drupal\Component was my initial thought as well in #5 but Crell disagreed in #8.

As for un-forking it, I don't think it's possible because the latest version of that class still extends PEAR.

Crell’s picture

I hadn't realized that it was forked. Given that, yes, just put it in the Component and document that it's forked. If we are able to convert it to the unforked version later, that can go back in the PEAR directory.

amateescu’s picture

StatusFileSize
new13.69 KB

Here we go :)

amateescu’s picture

StatusFileSize
new13.67 KB

Rerolled because the mail conversion patch got in first. This is the last one from system.module!

Crell’s picture

Status: Needs review » Reviewed & tested by the community

I think that was the only issue, so going out on a limb...

cweagans’s picture

Seconded.

dries’s picture

Status: Reviewed & tested by the community » Fixed

I agree with our view on dependencies. Sounds like everyone is on board, including catch. Reviewed the patch and committed it to 8.x. Thanks all!

Automatically closed -- issue fixed for 2 weeks with no activity.