Skip to content
Snippets Groups Projects
Commit 03c0816d authored by Jeremy Epstein's avatar Jeremy Epstein
Browse files

- Change wrapper modules to be disabled by default, and to be required to be

  manually installed after installing category. This is due to difficulties
  with having the wrapper files present when installing Drupal.
- Include .install files in wrapper install / uninstall script.
- Make the 'category' and 'container' node types get their default status /
  commenting / theme settings configured properly at install time.
parent 02e6f639
No related branches found
No related tags found
No related merge requests found
......@@ -14,8 +14,24 @@
function category_install() {
drupal_install_schema('category');
$info = _category_default_node_types();
node_type_save($info['category']);
node_type_save($info['container']);
// Default category and container nodes to not be promoted and have comments
// disabled.
variable_set('node_options_category', array('status'));
variable_set('comment_category', COMMENT_NODE_DISABLED);
variable_set('node_options_container', array('status'));
variable_set('comment_container', COMMENT_NODE_DISABLED);
// Don't display date and author information for category and container nodes
// by default.
$theme_settings = variable_get('theme_settings', array());
$theme_settings['toggle_node_info_category'] = FALSE;
$theme_settings['toggle_node_info_container'] = FALSE;
variable_set('theme_settings', $theme_settings);
variable_set('category_behavior_category', 'category');
variable_set('category_behavior_container', 'container');
}
......@@ -25,10 +41,12 @@ function category_install() {
*/
function category_uninstall() {
drupal_uninstall_schema('category');
foreach (node_get_types() as $type) {
variable_del('category_behavior_'. $type->type);
variable_del('category_allowed_containers_'. $type->type);
}
node_type_delete($info['category']);
node_type_delete($info['container']);
}
......
......@@ -1722,7 +1722,7 @@ function category_help($path, $arg) {
return $output;
case 'admin/content/category/wrappers':
$output = '<p>'. t('You can install and uninstall the taxonomy, book, and menu wrapper modules using the links below. It is very important that you have taxonomy, book, or menu (original or wrapper, whichever is installed) <strong>enabled</strong> on the <a href="@module-admin-page">module administration page</a> before performing an install or uninstall. Additionally, you should make sure that your web server has write permission on the file system, or the scripts may be denied access to rename the necessary files.', array('@module-admin-page' => url('admin/build/modules'))) .'</p>';
$output .= '<p>'. t('When performing an install, the scripts will look for the <code>modulename.module.php</code> and <code>modulename.info.php</code> files in the <code>wrappers/modulename</code> directory (in your category package), and it will rename them respectively to <code>modulename.module</code> and <code>modulename.info</code>. It will then update Drupal\'s module registry so that the new files are discovered. The reverse will happen when performing an uninstall. The script will determine the correct location of all necessary files automatically, based on where you have installed the category module.') .'</p>';
$output .= '<p>'. t('When performing an install, the scripts will look for the <code>modulename.module.php</code>, <code>modulename.info.php</code> and <code>modulename.install.php</code> files in the <code>wrappers/modulename</code> directory (in your category package), and it will rename them respectively to <code>modulename.module</code>, <code>modulename.info</code> and <code>modulename.install</code>. It will then update Drupal\'s module registry so that the new files are discovered. The reverse will happen when performing an uninstall. The script will determine the correct location of all necessary files automatically, based on where you have installed the category module.') .'</p>';
$output .= '<p>'. t('After the operation that you invoke is completed, you will be returned to this page.') .'</p>';
return $output;
case 'admin/content/category/%':
......
......@@ -206,12 +206,22 @@ function category_wrapper($type, $op, $goto = NULL, $rebuild = TRUE) {
drupal_set_message(t('The file %filename could not be found.', array('%filename' => $info_file_old)) . $generic_error, 'error');
drupal_goto($goto);
}
$install_file_old = $type .'.install'. ($op == 'install' ? '.php' : '');
$install_file_old_path = $module_path .'/'. $install_file_old;
if (!file_exists($install_file_old_path)) {
drupal_set_message(t('The file %filename could not be found.', array('%filename' => $install_file_old)) . $generic_error, 'error');
drupal_goto($goto);
}
$module_file_new = $type .'.module'. ($op == 'install' ? '' : '.php');
$module_file_new_path = $module_path .'/'. $module_file_new;
$info_file_new = $type .'.info'. ($op == 'install' ? '' : '.php');
$info_file_new_path = $module_path .'/'. $info_file_new;
$install_file_new = $type .'.install'. ($op == 'install' ? '' : '.php');
$install_file_new_path = $module_path .'/'. $install_file_new;
if (!@rename($module_file_old_path, $module_file_new_path)) {
drupal_set_message(t('The file %filename could not be renamed.', array('%filename' => $module_file_old)) . $generic_error, 'error');
......@@ -222,6 +232,11 @@ function category_wrapper($type, $op, $goto = NULL, $rebuild = TRUE) {
drupal_set_message(t('The file %filename could not be renamed.', array('%filename' => $info_file_old)) . $generic_error, 'error');
drupal_goto($goto);
}
if (!@rename($install_file_old_path, $install_file_new_path)) {
drupal_set_message(t('The file %filename could not be renamed.', array('%filename' => $install_file_old)) . $generic_error, 'error');
drupal_goto($goto);
}
if ($type == 'taxonomy' || $type == 'book') {
if ($op == 'install') {
......
File moved
File moved
File moved
File moved
File moved
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment