Hi Guys,

I've been playing with Patterns as a way to simplify my upgrade process from Drupal 5 to Drupal 6. One of things I've been using it for is batch enabling / disabling modules. I realize this is a little bit out of scope compared to the examples you have provided, but nonetheless it seems like a reasonable use case.

This problem manifests itself in both the 5.x and 6.x code releases. I have patched both of them to work, but my code may not be where you want it. Suffice it to say that what is happening right now is that on both d5 and d6 my .xml file is read and ends up as a php array containing an extra level of indirection ($data['modules'][0] instead of $data[0]).

I am guessing that either you guys just don't use module disabling much, or that there is something goofy about my system xml parser. I'm using php 5.2.6 on MacOS 10.5.6.

Here's a trivial case. Note that I've had to use the 'delete=' form instead of 'disable=' form since I was using this in d5:

<?xml version="1.0" encoding="ISO-8859-1"?>
<pattern>
<info>
<title>Simple Disable</title>
<description>Simply disable a mode</description>
<author>Erik LaBianca</author>
<author_email>erik@quonic.com</author_email>
<version>0.1</version>
<author_date>2009-04-24</author_date>
<category>Modules</category>
<core>5.x</core>
</info>
<modules>
<module delete="1">xmlsitemap_engines</module>
<module delete="1">xmlsitemap</module>
</modules>
</pattern>

I've also attached my patches against both the d5 code so you get the gist of it. The d6 code is almost the same, but the patch lives in patterns.module instead. I'm guessing you would prefer to 'flatten' the module elsewhere, but the places I used worked so I stuck with it for now.

CommentFileSizeAuthor
module_disable.patch2.13 KBeasel

Comments

vaish’s picture

Modules section of the patterns file is meant for listing all the modules required by the pattern. Those modules will be enabled before execution of the pattern's actions begins.

If you want to disable group of modules you are supposed to add that within actions section. Your pattern should look something like this:

<?xml version="1.0" encoding="ISO-8859-1"?>
<pattern>
  <info>
    <title>Simple Disable</title>
    <description>Simply disable a mode</description>
    <author>Erik LaBianca</author>
    <author_email>erik@quonic.com</author_email>
    <version>0.1</version>
    <author_date>2009-04-24</author_date>
    <category>Modules</category>
    <core>5.x</core>
  </info>
  <actions>
    <modules>
      <module delete="1">xmlsitemap_engines</module>
      <module delete="1">xmlsitemap</module>
    </modules>  
  </actions>
</pattern>

Please try this and let us know if you still have any issues.

Vaish

ChrisBryant’s picture

Status: Active » Closed (fixed)

Closing this as resolved since it should work as Vaish described.

Easel, please reopen if you still have any issues/questions.