When the "libraries" folder does not exists, libraries installation fails.

This is caused by the FileTansfer::copyDirectoryJailed() method:

  protected function copyDirectoryJailed($source, $destination) {
    if ($this->isDirectory($destination)) {
      $destination = $destination . '/' . drupal_basename($source);
    }
    $this->createDirectory($destination);

When the libraries folder does not exist, the first test fails, so the library basename is not added the the destination, which is then sites/all/libraries instead of the expected sites/all/libraries/mylibrary. That makes the files to be copied directly in the libraries directories, and the Updater::makeWorldReadable() method throws an exception when trying to chmod a directory that does not exist (the famous sites/all/libraries/mylibrary that was not created).

Not sure it is a bug of FileTranfer, whiwh has its own purpose, or a check that should be performed by Apps...

Hope the following issue will be resolved soon, so the libraries directory could exist by default: https://www.drupal.org/node/667058

So please let me know you thoughts, I would be glad to provide a patch according to your answer.

Comments

hefox’s picture

Title: Apps containing libraries and Filetransfer » Apps containing libraries copied to wrong location when libraries folder doesn't exist

trying to clearify title

at this time in life cycle of d7, patch to apps is likely warrented

  • hefox committed 102adda on 7.x-1.x
    Issue #2312627: add a quickie that tries to create libraries path if...
hefox’s picture

Status: Active » Postponed

I've modified apps_installer_has_write_access to create the directory if doesn't exist, not sure if this will "fix" it in time as haven't tested it thoroughly

B-Prod’s picture

Thanks, I will take some time in the following weeks to test the latest DEV version and check if the issue is fixed.