Drupal Module Development : Uninstall/Reinstall/Repeat?
Asked Answered
S

5

6

I'm developing a custom module for Drupal on my local machine.

When I edit my code, the changes are never applied right away. So, I go to Administer Modules, and uninstall, and then reinstall my module. This is cycle of uninstall-install-develop-repeat is slow and tedious.

Is there a better way to do it?

My module makes extensive use of Drupal framework so I'm not sure developing it exclusively in PHP first is an option.

Slusher answered 24/3, 2011 at 16:47 Comment(0)
H
7

I would highly recommend installing the Devel module. It is very useful while developing for Drupal. Once installed, you can enable the Devel block which is extremely useful. It has a list of links to perform somewhat tedious tasks faster, such as emptying the cache, reinstalling modules, rebuilding the menus, etc.

Many of the changes to your module should not require visiting the modules page. You mostly see the need to do this when you are changing the menu with hook_menu() in your module, as the menus are only rebuilt when visiting that page (or using Devel block "Rebuild Menus" link ;) )

Halakah answered 24/3, 2011 at 16:57 Comment(2)
In addition, I can strongly suggest Drush, which leverages these devel commands to the commandline. $ drush cc all to flush all cache.Starkey
Using the devel module with Drush gives you drush devel-reinstall myModule which effectively disables, uninstalls, re-installs, enables, and clears the cache (I think) for the modules that you specify.Larynx
F
3

When uninstall/install, the only things that is executed is what is in .install file.

If you don't change this file, you don't have to uninstall/install the module.

Maybe your problem is just a cache issue. Drupal strongly cache a lot a things. And when you enable a module, the cache is cleared. You can clear you cache manually.

On an other hand, I recommand to look on Drush that allow you to do those things faster. (clear cache, enable/disable a module/...)

Future answered 24/3, 2011 at 17:0 Comment(1)
Note that during disabling the uninstall intructions in .install are not ran. Only during uninstallation. Disabling is when you uncheck a module on its module page and press save. uninstalling is then possible trough the "uninstall" tab on that same module page.Starkey
H
1

The Drupal admin menu (http://drupal.org/project/admin_menu) along with devel comes in very handy if you have to flush caches.

Handmaiden answered 25/3, 2011 at 11:47 Comment(0)
B
0

Just drop cache on each time when you edit your code

Administer->Site perfomance

Backstop answered 25/3, 2011 at 1:28 Comment(1)
What the poster is asking about is not the same as clearing cache.Larynx
C
0

How can re-install module using Drush commands ?
Run command
drush dre cars_api
For details visit
https://drushcommands.com/drush-9x/devel/devel:reinstall/

======================== Drush For Drupal ========================

What is Drush ?
Ans : Drush is a command line shell and scripting interface for Drupal,
and it is work like Laravel-Artisan, and Angular CLi etc.
It is very Help-full for fast development on Drupal.
Official Website -> http://www.drush.org/
Official composer repository -> https://packagist.org/packages/drush/drush#dev-master
Official Drupal Repository -> https://www.drupal.org/project/drush

What is the Installation Process ?
Ans : There is following steps.
1.Step
Install new and latest version of composer
2. Step
Run in vscode Terminal
composer global require drush/drush:9.x-dev
check the installation in terminal via following command
drush version
For more details visit
https://packagist.org/packages/drush/drush#dev-master
And also helpful
http://docs.drush.org/en/master/
3. Step
Visite following link and see Drush All conads details and documentation
https://drushcommands.com/drush-9x/
https://www.drupal.org/docs/user_guide/en/prevent-cache-clear.html

How can resolve Drush Errors ?
Run command in vscode terminal
Composer require drush/drush

How can see drush commands list in terminal ?
Just type in vscode terminal in project dir
Drush

and enter
So all commands will be listed with summary

Uninstallation process for Drush ?
Just change in command ‘require’ to ‘remove’
composer global remove drush/drush:9.x-dev

Cribbage answered 24/7, 2019 at 9:49 Comment(2)
(Review) Thanks for this answer, but please do not simply copy external documentation snippets into your answer. Especially not items that are not directly relevant to the question. And in general: please have a look at the formatting help near the input box to make your answer more readable ;)Telegu
Thanks for appreciate ! i will try my best in next contribution to the community.Cribbage

© 2022 - 2024 — McMap. All rights reserved.