Posted by oriol_e9g on January 31, 2012 at 10:42pm
4 followers
| Project: | Drupal core |
| Version: | 8.x-dev |
| Component: | update.module |
| Category: | bug report |
| Priority: | minor |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
| Issue tags: | needs backport to D7, Novice, Quick fix |
Issue Summary
We use the $install_location var to throw a message exception when the directory is really defined in $directory:
/**
* Make sure the installation parent directory exists and is writable.
*
* @param FileTransfer $filetransfer
* Object which is a child of FileTransfer.
* @param string $directory
* The installation directory to prepare.
*/
public function prepareInstallDirectory(&$filetransfer, $directory) {
// Make the parent dir writable if need be and create the dir.
if (!is_dir($directory)) {
$parent_dir = dirname($directory);
if (!is_writable($parent_dir)) {
@chmod($parent_dir, 0755);
// It is expected that this will fail if the directory is owned by the
// FTP user. If the FTP user == web server, it will succeed.
try {
$filetransfer->createDirectory($directory);
$this->makeWorldReadable($filetransfer, $directory);
}
catch (FileTransferException $e) {
// Probably still not writable. Try to chmod and do it again.
// @todo: Make a new exception class so we can catch it differently.
try {
$old_perms = substr(sprintf('%o', fileperms($parent_dir)), -4);
$filetransfer->chmod($parent_dir, 0755);
$filetransfer->createDirectory($directory);
$this->makeWorldReadable($filetransfer, $directory);
// Put the permissions back.
$filetransfer->chmod($parent_dir, intval($old_perms, 8));
}
catch (FileTransferException $e) {
$message = t($e->getMessage(), $e->arguments);
$throw_message = t('Unable to create %directory due to the following: %reason', array('%directory' => $install_location, '%reason' => $message));
throw new UpdaterException($throw_message);
}
}
// Put the parent directory back.
@chmod($parent_dir, 0555);
}
}
Comments
#1
#2
#3
Suppose this kind of issues should be marked as Novice and Quick fix
also should be checked as backportable prepareInstallDirectory/7
#4
Looks good and confirmed that this is a minor bug in both 7.x and 8.x.
Committed to 8.x and back-ported to 7.x. Thanks!
#5
Automatically closed -- issue fixed for 2 weeks with no activity.