This forum is for module development and code related questions, not general module support. For general support, use the Post installation forum.

Shell Script to Install Modules

Here's the beginings of a shell script that will install modules from shell. Currently it only installs the ones without the need for DB, but it should only take a few lines to do that, if someone else has time they are welcome to. I just thought i'd present the idea with some work done. Any improvements, suggestions, and code is welcome.

-------------------------------------------------------------------------

#!/usr/local/bin/php -q

#$dbusername = "";
#$dbpasswd = "";
#$dbname = "";

#absolute path to drupal with a trailing /
$abspath = "";

// YOU DO NOT NEED TO EDIT BELOW HERE

$modulepath = $abspath."modules/";
$filename = $argv[1];
if(isset($filename) && file_exists($filename) && (count(explode('.',$filename)) > 1)){
        $temp = explode('-', $filename);
        $modulename = $temp[0];
        //delete module directory
        //shell_exec("rm -rf $modulename");
        shell_exec("tar -xzf $filename");
        if(file_exists("$modulename/INSTALL"))
        	echo shell_exec("more $modulename/INSTALL"); 
        else if(file_exists("$modulename/README"))
        	echo shell_exec("more $modulename/README");
        else if(file_exists("$modulename/README.txt"))
        	echo shell_exec("more $modulename/README.txt"); 
        	 
        WHILE($bool == false){
          echo "\n\nDo you want (o)nly module file, (e)ntire directory, (a)ll files? (o/e/a)?";
          $input = trim(read());
          if($input == 'o' || $input == 'e' || $input == 'a'){
            $bool = true;
          }else
            $bool = false;
        }
        if($input == 'o'){
      		shell_exec("mv $modulename/*.module $modulepath");
      	}else if($input == 'e'){
                delcruft();
      		shell_exec("mv $modulename $modulepath");
      	}else if($input == 'a'){
                delcruft();
      		shell_exec("mv $modulename/* $modulepath");
      	}

        //find sql file, run mysql command to pipe the sql file to the db
        
}else{
        echo "File doesn't exist or not defined properly!";
}

function read() {
  $fp=fopen("/dev/stdin", "r");
  $input=fgets($fp, 4);
	fclose($fp);
	return str_replace("\n", "", $input);
}

function delcruft(){
	shell_exec("rm -rf $modulename/CHANGELOG");
	shell_exec("rm -rf $modulename/README*");
	shell_exec("rm -rf $modulename/TODO");
	shell_exec("rm -rf $modulename/CREDITS");
	shell_exec("rm -rf $modulename/INSTALL");
	shell_exec("rm -rf $modulename/LICENSE*");
}

simple up/down moderation per content type per role

The first time I went to ?q=admin/node/configure/defaults (administer > content > configure > default workflow) and checked moderate for stories, I then expected to be able to go to administer > users > configure > permissions and see a new row in the table for the story module that said "Moderate."

In other words, I thought I would be able to assign moderation privileges to select roles for select content types. Instead, it appears that the queue module allows me to specify roles that can moderate ALL content types that are not, by default, promoted to the homepage. But if I want role #1 to moderate only content type #1, and role #2 to moderate only content type #2, that's not possible -- if I understand correctly.

I don't know how difficult what I want would be to implement from the programming/db standpoint, but from the user interface standpoint, it would be quite easy... in fact, the UI, as it currently exists, is practically begging for this to be added.

The current system is excellent if you want the community to moderate a particular set of content types, and no other type of moderation is needed on the site (excepting comments). It's not so good, though, if what you really want is to give certain people simple up/down authority to publish or promote certain content types, and certain other people the same ability for other content types. This might at first seem inconsistent with the spirit of empowering the whole community to moderate content, but since Drupal aims to be a "content management platform" for a wide set of uses, this seems like appropriate (and needed) flexibility to grant to admins. And one could certainly imagine a community site where community moderation AND moderation per-role-per-content-type is needed... or where a wide portion of the community is called upon to moderate one set of content, and another wide portion of the community moderates a different set of content.

Image module changes help

I want to make a minor change in image module. I want that when an image is previewed or viewed the first links below should show Copyright information instead of current "By ".

I have gone through image module but cannot find the code that needs to be changed for achieving this. Where should i hack image.module/Drupal to achieve this.

Thanks
EM

Search improvements for drupal-4.5.2

I have created a patch to bring the search improvements from HEAD to drupal-4.5.2. Thanks to pyromanfo who has done all the work and created the patch for drupal-4.5.1.

See this thread on search improvements and the patch file.

search.module and stripping bbcode

Greetings,

I noticed that the search.module does not parse out the bbcode from bbcode module. I was able to easily fix this in the search.module, but was unsure for which module to file the bug? Obviously, you don't want contributed modules changing core modules, yet core modules may not be aware of all contributed modules. Anyway, let me know which module to file the bug for and I will submit my most likely overly simple regexp patch.

mitomac

Event notification

I am currently creating a simple module to notify me about upcoming events.
I would however like some feedback to whether I should make it really small and simple, or if I should enable a lot of settings and options.

Pages

Subscribe with RSS Subscribe to RSS - Module development and code questions