Closed (won't fix)
Project:
Plugin Manager
Version:
6.x-1.1
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
3 Sep 2008 at 14:30 UTC
Updated:
4 Sep 2008 at 12:50 UTC
hi!
i like the idea behind your module very much but there is one thing i do not understand: why are you using an ftp and ssh backend but no local file backend? i can't imagine a case where the drupal module path is not accessible by the web server which runs drupal.
i've created a file "local.backend.inc":
// $Id$
/**
* @file
* The local Backend for the plugin manager.
*/
/**
* Implementation of user hook plugin_manager_backend. Checks
* if the requirements for the ssh backend are enabled.
*
* @return
* Return 'local' if the requirements are available.
*/
function local_plugin_manager_backend() {
return 'local';
}
/**
* Install the supplied files to the appropriate locations.
*
* @param $files
* The files to install.
* @param $type
* Either 'module' or 'theme' to indicate where to install to.
* @param $username
* Local Username
* @param $password
* Local Password
* @return
* TRUE if all the files were installed, FALSE otherwise.
*/
function local_plugin_manager_copy($files, $type, $username, $password) {
// Figure out the type of files.
if (!in_array($type, array('modules', 'themes'))) {
return FALSE;
}
$dir = 'sites/all/'. drupal_strtolower($type);
// Prepare the directories to use later.
$extract_dir = file_directory_path() .'/plugin_manager_extraction';
// Try to guess the directory of the drupal install.
// Start by putting the entire address together and replacing \ with /.
$local_path = rtrim(str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT'] . base_path()), '/');
// Process each of the files.
foreach ($files AS $file) {
if (trim($file, "\\/") != $file) {
exec("mkdir " . escapeshellarg("$local_path/$dir/$file"));
}
else {
exec("cp $extract_dir/$file $local_path/$dir/$file");
}
}
return TRUE;
}
other features that come to my mind:
- a quick install form where you can install a module by just pasting its url
- show which modules are already installed
(- dependency checks (i know you don't want to cover it, but it would be cool))
nice work though!
Comments
Comment #1
chx commentedIf your website can write files which are executed by PHP that's a security weakness. This module was created to circumvent this. This issue is totally against the purpose of the module.