Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kalatheme_lib_dir() rage! #73

Closed
labboy0276 opened this issue Jun 27, 2014 · 13 comments
Closed

kalatheme_lib_dir() rage! #73

labboy0276 opened this issue Jun 27, 2014 · 13 comments
Assignees
Milestone

Comments

@labboy0276
Copy link

So this is happening now on Pantheon only

Warning: mkdir(): Permission denied in kalatheme_lib_dir() (line 345 of /srv/bindings/88bc69aeba2d4570a5229486c6e0d244/code/profiles/hotsauce/themes/kalatheme/includes/utils.inc)

On Install, also it gives a chmod error from the code I wrote before.

We will need to see what the right syntax is or how to make the directory and change the perms in something like pantheon

@katypool-zz
Copy link

Getting the same errors on pantheon:

Warning: mkdir(): Permission denied in kalatheme_lib_dir() (line 345 of /srv/bindings/98feb60b74854cf88cd32ef8b6cc8fb3/code/sites/all/themes/kalatheme/includes/utils.inc).
Warning: chmod(): No such file or directory in kalatheme_lib_dir() (line 346 of /srv/bindings/98feb60b74854cf88cd32ef8b6cc8fb3/code/sites/all/themes/kalatheme/includes/utils.inc).

@pirog
Copy link
Contributor

pirog commented Jun 28, 2014

If you switch to SFTP mode on pantheon do these go away?

On Fri, Jun 27, 2014 at 5:19 PM, katypool notifications@github.com wrote:

Getting the same errors on pantheon:

Warning: mkdir(): Permission denied in kalatheme_lib_dir() (line 345 of
/srv/bindings/98feb60b74854cf88cd32ef8b6cc8fb3/code/sites/all/themes/kalatheme/includes/utils.inc).
Warning: chmod(): No such file or directory in kalatheme_lib_dir() (line
346 of
/srv/bindings/98feb60b74854cf88cd32ef8b6cc8fb3/code/sites/all/themes/kalatheme/includes/utils.inc).


Reply to this email directly or view it on GitHub
#73 (comment)
.

Cheers,

Mike Pirog
Kalamuna
www.kalamuna.com

@katypool-zz
Copy link

Yes they do

@labboy0276
Copy link
Author

@pirog @katypool it seems that we be using not the latest version of kalatheme, the code that was there (that this error generates) is now gone. As seen here:

https://github.com/drupalprojects/kalatheme/blob/7.x-3.x/includes/utils.inc

Even if we dont win with this codez, we can look into http://drupalcontrib.org/api/drupal/drupal%21includes%21file.inc/function/file_prepare_directory/7

@pirog
Copy link
Contributor

pirog commented Jun 28, 2014

pretty sure file_prepare_directory is what the libraries module uses so
that might be the ticket

On Sat, Jun 28, 2014 at 10:59 AM, John Ouellet notifications@github.com
wrote:

@pirog https://github.com/pirog @katypool https://github.com/katypool
it seems that we be using not the latest version of kalatheme, the code
that was there (that this error generates) is now gone. As seen here:

https://github.com/drupalprojects/kalatheme/blob/7.x-3.x/includes/utils.inc

Even if we dont win with this codez, we can look into
http://drupalcontrib.org/api/drupal/drupal%21includes%21file.inc/function/file_prepare_directory/7


Reply to this email directly or view it on GitHub
#73 (comment)
.

Cheers,

Mike Pirog
Kalamuna
www.kalamuna.com

@pirog
Copy link
Contributor

pirog commented Jun 28, 2014

we could also check if libraries is installed and just use the directory
create function they use

On Sat, Jun 28, 2014 at 11:51 AM, Mike Pirog mike@kalamuna.com wrote:

pretty sure file_prepare_directory is what the libraries module uses so
that might be the ticket

On Sat, Jun 28, 2014 at 10:59 AM, John Ouellet notifications@github.com
wrote:

@pirog https://github.com/pirog @katypool https://github.com/katypool
it seems that we be using not the latest version of kalatheme, the code
that was there (that this error generates) is now gone. As seen here:

https://github.com/drupalprojects/kalatheme/blob/7.x-3.x/includes/utils.inc

Even if we dont win with this codez, we can look into
http://drupalcontrib.org/api/drupal/drupal%21includes%21file.inc/function/file_prepare_directory/7


Reply to this email directly or view it on GitHub
#73 (comment)
.

Cheers,

Mike Pirog
Kalamuna
www.kalamuna.com

Cheers,

Mike Pirog
Kalamuna
www.kalamuna.com

@labboy0276
Copy link
Author

you are correct, i looked at most contrib modules and that api function is used a few places.

@pirog
Copy link
Contributor

pirog commented Jun 28, 2014

@labboy0276 if GIT mode is enabled on pantheon you are just not going to have permission to create this dir on pantheon (and likely other things as well)... there may be an authorize.php implementation that solves the problem.

I noticed that panopoly spins up with SFTP mode on by default instead of git, probably so it can install apps, so that is worth looking into also.

@pirog pirog changed the title Permissions Errors on Pantheon kalatheme_lib_dir() rage! Jun 28, 2014
@pirog
Copy link
Contributor

pirog commented Jun 29, 2014

@labboy0276 there is an implementation in Kalatheme that uses the local file transfer protocol similar to teh apps module implementation that is probably your ticket to ride.

@pirog pirog added this to the 7.x-3.0 Release milestone Jun 29, 2014
@pirog pirog added the 7.x-3.x label Jun 29, 2014
@pirog
Copy link
Contributor

pirog commented Jun 29, 2014

Ok. So

/**
 * Return the libraries dir to check
 */
function kalatheme_lib_dir() {
  if (!is_dir('sites/all/libraries')) {
    mkdir(DRUPAL_ROOT . '/sites/all/libraries');
    chmod(DRUPAL_ROOT . '/sites/all/libraries', 0755);
  } else {
    chmod(DRUPAL_ROOT . '/sites/all/libraries', 0755);
  }
  return is_dir('sites/all/libraries') ? 'sites/all/libraries' : 'sites/all';
}

The only point of this function is return the "location" of the libraries directory. Which may not exist yet if the user hasn't installed the libraries dir yet. It shouldn't try to create or change permissions on that dir at this point. It just wants to know where it is so another function can check if it is writable as part of a larger check to determine whether a user can upload a bootstrap library for their theme/subtheme or not.

/**
 * We want to check if the webserver can write our stuff to the right places.
 * If it can't then we are going to tell the user what's up.
 *
 * @return
 *   True if all good, message if no good
 */
function kalatheme_backend_check() {
  // Verify FTP support
  $ftp_installed = extension_loaded('ftp');
  // Verify SSH support
  $ssh_installed = extension_loaded('ssh2');
  // Verify web server write permissions
  $install_permissions = kalatheme_has_write_access();
  // Verify update module is enabled
  $updates_module = module_exists('update');

  return (($ftp_installed || $ssh_installed || $install_permissions) && $updates_module);
}

/**
 * Check whether Kalatheme has write access to libraries and modules directories.
 *
 * @return boolean
 */
function kalatheme_has_write_access() {
  return is_writable(drupal_realpath(kalatheme_lib_dir())) && is_writable(drupal_realpath('sites/all/modules'));
}

All this stuff is just to determine whether the user can actually write to that dir using one of many methods. It does not seek to actually try to write to it at this point. That stuff should happen when the user actually tries to upload a custom library or build a subtheme.

@pirog
Copy link
Contributor

pirog commented Jun 29, 2014

Aka this really should be something like this

/**
 * Return the libraries dir to check
 */
function kalatheme_lib_dir() {
  return is_dir('sites/all/libraries') ? 'sites/all/libraries' : 'sites/all';
}

@pirog pirog self-assigned this Jun 29, 2014
pirog added a commit that referenced this issue Jun 29, 2014
#73: Fix kalatheme_lib_dir(), pantheon warning, create lib dir first
pirog added a commit that referenced this issue Jun 29, 2014
#73: Limit verbosity of bootstrap library warning on batch finish
@pirog
Copy link
Contributor

pirog commented Jun 29, 2014

OK. So, i've added a check to see if you are pantheon so the user is prompted to switch their connection mode to SFTP.

As far as i understand things GIT mode will not currently allow us to create subthemes or install libraries on pantheon because drupal does not support a SFTP filetransfer protocol. this is the same result when you try to install a module or theme. @joshkoenig may have more insight here.

I'm going to close this issue but if @katypool @labboy0276 and others can test on pantheon and reopen if applicable that would be great.

@MetaBureau
Copy link

I'm using Barracuda and had that issue but it now seems resolved.

pirog added a commit to pirog/kalatheme that referenced this issue Jul 1, 2014
pirog added a commit to pirog/kalatheme that referenced this issue Jul 1, 2014
bassettsj added a commit that referenced this issue Jul 1, 2014
#73: Limit verbosity of bootstrap library warning on batch finish
bassettsj added a commit that referenced this issue Jul 1, 2014
#85 #73: Fix kalatheme_lib_dir(), pantheon warning, create lib dir first
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants