hi

first of all: this is a very helpfull module. thanks!.

i have got a lot of modules which are not in use anymore.

somewhere i read that its much better for performance if unused modules are deleted (removed ) from the modules folder. do unused modules affect performance???

ok, my idea is to create a link in the view which links to a script which moves the wohle module directory (with subfolders) to another location (/unused_modules).

maybe that helps:
http://php.net/manual/en/function.rename.php
http://www.php.net/manual/en/function.rename.php#97262
http://www.php.net/manual/en/function.rename.php#90535

thanks

Comments

akaserer’s picture

i changed the view and inserted a link to call remove.php with some parameters.

view is on: admin/reports/enabled_modules/not-installed2

$view = new view;
$view->name = 'enabled_modules_admin_not_inst';
$view->description = 'A view designed for site administrators, listing the modules in this Drupal installation that are not installed.';
$view->tag = 'enabled_modules';
$view->view_php = '';
$view->base_table = 'system';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('fields', array(
  'package' => array(
    'label' => 'Package',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'html' => 0,
      'strip_tags' => 0,
    ),
    'empty' => 'Other',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'exclude' => 1,
    'id' => 'package',
    'table' => 'enabled_modules_system',
    'field' => 'package',
    'relationship' => 'none',
  ),
  'filename' => array(
    'label' => 'Filename',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'html' => 0,
      'strip_tags' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'exclude' => 1,
    'id' => 'filename',
    'table' => 'system',
    'field' => 'filename',
    'relationship' => 'none',
  ),
  'name' => array(
    'label' => 'Name',
    'alter' => array(
      'alter_text' => 1,
      'text' => '<strong>[name]</strong><br />([filename])',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'html' => 0,
      'strip_tags' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'exclude' => 0,
    'id' => 'name',
    'table' => 'enabled_modules_system',
    'field' => 'name',
    'relationship' => 'none',
    'override' => array(
      'button' => 'Override',
    ),
  ),
  'description' => array(
    'label' => 'Description',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'html' => 0,
      'strip_tags' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'exclude' => 0,
    'id' => 'description',
    'table' => 'enabled_modules_system',
    'field' => 'description',
    'relationship' => 'none',
  ),
  'code' => array(
    'label' => 'Code',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'html' => 0,
      'strip_tags' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'exclude' => 0,
    'id' => 'code',
    'table' => 'enabled_modules_system',
    'field' => 'code',
    'relationship' => 'none',
  ),
));
$handler->override_option('sorts', array(
  'name' => array(
    'order' => 'ASC',
    'id' => 'name',
    'table' => 'system',
    'field' => 'name',
    'override' => array(
      'button' => 'Übersteuern',
    ),
    'relationship' => 'none',
  ),
));
$handler->override_option('filters', array(
  'type' => array(
    'operator' => '=',
    'value' => 'module',
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'case' => 0,
    'id' => 'type',
    'table' => 'system',
    'field' => 'type',
    'relationship' => 'none',
  ),
  'status' => array(
    'operator' => '=',
    'value' => '0',
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'status',
    'table' => 'system',
    'field' => 'status',
    'relationship' => 'none',
  ),
  'schema_version' => array(
    'operator' => '=',
    'value' => '-1',
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'case' => 1,
    'id' => 'schema_version',
    'table' => 'system',
    'field' => 'schema_version',
    'relationship' => 'none',
    'override' => array(
      'button' => 'Override',
    ),
  ),
));
$handler->override_option('access', array(
  'type' => 'perm',
  'perm' => 'access site reports',
));
$handler->override_option('cache', array(
  'type' => 'none',
));
$handler->override_option('title', 'Not Installed Modules');
$handler->override_option('header', '<p><strong>All not installed modules are listed here. If a module\'s codebase is not found, the module is marked missing.</strong></p>

  <p>Your overall Drupal site is presently installed in this directory: <code><?php print getcwd() ?>

');
$handler->override_option('header_format', '3');
$handler->override_option('header_empty', 1);
$handler->override_option('empty', '

All modules in the system are installed.

');
$handler->override_option('empty_format', '1');
$handler->override_option('items_per_page', 0);
$handler->override_option('style_plugin', 'table');
$handler->override_option('style_options', array(
'grouping' => '',
'override' => 1,
'sticky' => 1,
'order' => 'asc',
'columns' => array(
'package' => 'package',
'filename' => 'filename',
'name' => 'name',
'description' => 'description',
'code' => 'code',
),
'info' => array(
'package' => array(
'sortable' => 1,
'separator' => '',
),
'filename' => array(
'sortable' => 1,
'separator' => '',
),
'name' => array(
'sortable' => 0,
'separator' => '',
),
'description' => array(
'sortable' => 0,
'separator' => '',
),
'code' => array(
'separator' => '',
),
),
'default' => 'package',
));
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('path', 'admin/reports/enabled_modules/not-installed');
$handler->override_option('menu', array(
'type' => 'tab',
'title' => 'Not Installed',
'description' => '',
'weight' => '1',
'name' => 'navigation',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
'name' => 'navigation',
));
$handler = $view->new_display('page', 'Seite', 'page_2');
$handler->override_option('fields', array(
'name_1' => array(
'label' => 'Name',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'exclude' => 0,
'id' => 'name_1',
'table' => 'system',
'field' => 'name',
'override' => array(
'button' => 'Standard verwenden',
),
'relationship' => 'none',
),
'filename' => array(
'label' => 'Filename',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
'strip_tags' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'exclude' => 1,
'id' => 'filename',
'table' => 'system',
'field' => 'filename',
'relationship' => 'none',
),
'name' => array(
'label' => 'Name',
'alter' => array(
'alter_text' => 1,
'text' => '[name]
([filename])',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
'strip_tags' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'exclude' => 0,
'id' => 'name',
'table' => 'enabled_modules_system',
'field' => 'name',
'relationship' => 'none',
'override' => array(
'button' => 'Override',
),
),
'nothing' => array(
'label' => 'Link',
'alter' => array(
'text' => 'remove ',
'make_link' => 1,
'path' => 'remove.php?p=[filename]',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '_blank',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 0,
'ellipsis' => 0,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'exclude' => 0,
'id' => 'nothing',
'table' => 'views',
'field' => 'nothing',
'override' => array(
'button' => 'Standard verwenden',
),
'relationship' => 'none',
),
));
$handler->override_option('style_options', array(
'grouping' => '',
'override' => 1,
'sticky' => 1,
'order' => 'asc',
'columns' => array(
'filename' => 'filename',
'name' => 'name',
),
'info' => array(
'filename' => array(
'sortable' => 1,
'separator' => '',
),
'name' => array(
'sortable' => 0,
'separator' => '',
),
),
'default' => 'name',
));
$handler->override_option('path', 'admin/reports/enabled_modules/not-installed2');
$handler->override_option('menu', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
'name' => 'navigation',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
));

juliangb’s picture

Modules degrade performance if they are present - but only for the loading of the admin/build/modules page where Drupal recursively searches folders in the /modules, /profiles and sites/all/modules folders for valid .info files.

Firstly, please post code such as above in text attachments / patches rather than directly onto the page. It takes up a lot of space!

Secondly, what is this remove.php file you talk about?

Thirdly, I'd ask Benjamin to put a word in on this issue to say whether this feature is suitable for enabled_modules.

mlncn’s picture

I don't think it should be part of Enabled Modules itself, this is more Drupal core's Update Manager. We could consider it as, ironically, a separate module that i would recommend stay disabled... but i think overall enabled modules should look, not touch.

@juliangb - are you at DrupalCon? I owe you a cooler of drinks!

juliangb’s picture

Status: Active » Closed (won't fix)

I think I agree.

OK - @akaserer - this is won't fix for this module, meaning that we don't think it quite fits in with the aims of this module. Feel free to move this issue for core, or for a separate contrib module if you wish to see it go further.

Benjamin - Sorry, not at DCSF. Probably wouldn't have made it there this week if I'd tried anyway (thanks, Iceland). Just the live streaming for me.

akaserer’s picture

hi all

i agree that this feature should not be part of enabled-modules.

i just created my own view which links to a php file. then the directory is renamed with a '_' in front.

after that i can manually remove my folders.

anyway, thanks for your info and thumbs up for this module.

juliangb’s picture

Just a quick note...

Think about what would happen if a certain contrib project gave you two modules in one folder. Imagine that you have enabled one, and not installed the other... The folder would be renamed, meaning that Drupal would lose the link to the enabled module until all the caches etc were cleared. Think WSOD on any page that the module defines. If you did then delete the folder... it would be permanent.

I think you might be able to use enabled_modules for a better approach - use the not installed view to see what the filenames are of your not installed modules, and then look in the filesystem manually.