Permalink
Browse files

module_weight_fix

take two - should be based on upstream master now
  • Loading branch information...
letapjar committed Nov 20, 2010
1 parent c80ddf4 commit 42fc497181b4a1b58d49f35c0c59a902a29125ea
Showing with 31 additions and 0 deletions.
  1. +31 −0 og_mailinglist.install
View
@@ -1,5 +1,7 @@
<?php
// $Id$
include_once 'og_mailinglist_utilities.inc'; //needed to the hook_requirements to work right
/**
* Implementation of hook_install().
*/
@@ -15,6 +17,11 @@ function og_mailinglist_install() {
else {
drupal_set_message(st('The installation of the OG Mailinglist tables failed.'), 'error');
}
//set OGM's module_weight to be after pathauto so our email footers always use the correct path
$weight = db_result(db_query("SELECT weight FROM {system} WHERE type = 'module' AND name = 'pathauto'"));
db_query("UPDATE {system} SET weight = %d WHERE type = 'module' AND name = 'og_mailinglist'", $weight + 1);
}
/**
@@ -48,6 +55,18 @@ function og_mailinglist_requirements($phase) {
$requirements['og_mailinglist_phpmailer']['description'] = t('The <a href="@phpmailer">PHPMailer</a> library is missing or not installed correctly. <a href="@download">Download</a> and extract it to your <em>og_mailinglist</em> module directory. See the INSTALL.txt file for more information at path/to/drupal@install.', array('@phpmailer' => 'http://phpmailer.worxware.com/index.php?pg=phpmailer', '@download' => 'http://sourceforge.net/projects/phpmailer/files/phpmailer%20for%20php5_6/', '@install' => url(drupal_get_path('module', 'og_mailinglist') . '/INSTALL.txt')));
$requirements['og_mailinglist_phpmailer']['severity'] = REQUIREMENT_ERROR;
}
og_mailinglist_mimeDecode_load_library();
$requirements['og_mailinglist_mimeDecode']['title'] = t('Mail_mimeDecode PEAR extension');
if (class_exists('Mail_mimeDecode')) {
$requirements['og_mailinglist_mimeDecode']['value'] = 'Mail_mimeDecode PEAR Extension found';
$requirements['og_mailinglist_mimeDecode']['severity'] = REQUIREMENT_OK;
}
else {
// Required library wasn't found.
$requirements['og_mailinglist_mimeDecode']['value'] = t('Not found');
$requirements['og_mailinglist_mimeDecode']['description'] = t('The Mail_mimeDecode PEAR extension is missing or not installed correctly. Check that the extension is installed and that your PHP include_path is correct. See the INSTALL.txt file for more information at path/to/drupal@install.', array('@install' => url(drupal_get_path('module', 'og_mailinglist') . '/INSTALL.txt')));
$requirements['og_mailinglist_mimeDecode']['severity'] = REQUIREMENT_ERROR;
}
}
return $requirements;
@@ -296,6 +315,18 @@ function og_mailinglist_update_6004() {
return $ret;
}
/**
* Change module weight to ensure we fire after pathauto if its present.
*/
function og_mailinglist_update_6005() {
$ret = array();
$weight = db_result(db_query("SELECT weight FROM {system} WHERE type = 'module' AND name = 'pathauto'"));
db_query("UPDATE {system} SET weight = %d WHERE type = 'module' AND name = 'og_mailinglist'", $weight + 1);
return $ret;
}
function add_groups_to_og_mailinglist() {
if (!module_exists('purl') && !module_exists('spaces_og')) {
$results = db_query("SELECT nid, title FROM {node} WHERE type = 'group'");

0 comments on commit 42fc497

Please sign in to comment.