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.
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 ;) )
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/...)
The Drupal admin menu (http://drupal.org/project/admin_menu) along with devel comes in very handy if you have to flush caches.
Just drop cache on each time when you edit your code
Administer->Site perfomance
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
Related
First, I am a newbie in drupal, and I still haven't managed this framework.
I am running Drupal 8 in localhost, and I can edit my pages. But, constantly I need to restart Drupal because if suddenly hangs. I tried to look at the logs, but I can't find any information about this behavior. It seems that the server has stopped responding. Any suggestions on how to solve this problem?
Also, I am trying to install the plugin ds-8.x-3.5.tar.gz in Drupal, and I get this error.
I know this is not a useful debug information, but this is what I have. I can't understand why this plugin is not installed. Any suggestion?
Looks like you have some dependency issues.
As you state in your question that you would like to install ds-8.x-3.5.tar.gz I deduce that you are the dependencies manager. Since it looks like you're trying to install the module manually. You can install the module and manage the dependencies manually but it can be a pain.
Better to leave that to a piece of software designed to manage all the complex dependencies Drupal has and use composer as a dependency manager.
To install composer follow this link: https://getcomposer.org/doc/00-intro.md
If you can, start a new Drupal install and read the docs about installing Drupal with composer: https://www.drupal.org/docs/develop/using-composer/using-composer-to-install-drupal-and-manage-dependencies
follow the section under heading: Using drupal/recommended-project
That is much easier than converting your existing install to composer.
But if you need to convert your existing install follow the section under heading: Managing existing sites using Composer
Once you have composer running and have installed Drupal with it. You can simply run: composer require drupal/ds and your module is installed with all the needed dependencies .
Any time I select an admin option i get the below error.
Error: Class 'Drupal\Core\Form\FormErrorHandler' not found in Drupal\Component\DependencyInjection\Container->createService() (line 258 of core\lib\Drupal\Component\DependencyInjection\Container.php).
I have cleared my cache and restarted wamp, not sure what the next step is.
If I get an error that is in a core or contributed module and clearing cache and and server restart doesn't help, I usually try running database updates next to see if any where missed.
Have you run the update.php? if that fails you could try using drush to run the update.php using drush updb
If that doesn't work I would run a backup of the codebase and db then try updating the modules, then update core using drush drush up
Restarted my PC and that seemed to work. I have no idea what the error is linked to, but that seems to work if anyone is having the same issue.
I am new to nopcommerce and I am developing a plug-in in it.
I have partially created my plug-in and meanwhile i have found that if i change anything in plug-in's code (View, model, controller, services, etc.) then i have to UNINSTALL my plug-in and then INSTALL to see the changes.
It is really tedious task to do.
Is there any other alternative way to see changes especially for designing view where we just need to set our designing.
If it is possible to see changes by just reloading it in browser then it will be great for all.
Please reply if anyone has any idea about that.
All answers are accepted.
Thanks in advance.
As far as I know all installed plugins are cached into memory so just overwrite .dll in Plugins folder and you can either
Restart your application with IIS/WebMatrix
Go to Admin > Configuration > Plugins and in top-right corner of the plugins view hit "Reload list of plugins"
"Restart application" or maybe even "Clear cache" in top-right corner of the admin page may work too. Try it out.
You should clean the solution and then build plugins after making changes to the code of the your plugin.
I have a batch-file that I run each time I want to deploy changes to my plugin on my local IIS. It may be overkill, but it works. I keep it on my desktop. When I want to test changes, I right-click and "Run as Administrator".
#ECHO OFF
ECHO Stopping IIS
iisreset /stop
ECHO Clearing Temporary ASP.Net Files (Server cache)
for /d %%i in ("%systemroot%\Microsoft.Net\Framework\*") do for /d %%j in ("%%i\Temporary ASP.Net Files\*") do RD /q/s "%%j"
for /d %%i in ("%systemroot%\Microsoft.Net\Framework64\*") do for /d %%j in ("%%i\Temporary ASP.Net Files\*") do RD /q/s "%%j"
ECHO Building MyPlugin
"C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe" /build Debug "C:\Path_to_Nop_Source\Plugins\MyPlugin\MyPlugin.csproj"
ECHO Deploying MyPlugin
xcopy "C:\Path_to_Nop_Source\Presentation\Nop.Web\Plugins\MyPlugin" "C:\Path_To_WebRoot\Plugins\MyPlugin" /D /Y
ECHO Restarting IIS
iisreset /start
ECHO Done
pause
When I ran into this problem I tried restarting everything starting with the app, then the app pool and even iis. Unfortunately it didn't work. What did work however was rebuilding the site again and copying it over again (mainly all the nop.core.dll, nop.web.dll etc.). I did copy the core dlls of the site the first time around too, but I guess the plugin was copied after those. I think the important part is that the core dlls need to be recompiled so they appear different to iis and cause the already loaded plugins to get unloaded from memory.
I'm quite sure that restarting the whole server would work too, but who would want to do that?
P.S. I was about to ask the same question, because I couldn't find this one while googling (probably because the title is a little too specific). I intended to name mine Plugin not updating after copying a newer version. What lead me to this question was the similar question block that appears when you write a question.
Update: So I discovered that sometimes rebuilding and replacing nop core libraries isn't enough. However in that situation using the "Reload list of plugins" option in admin panel did the trick. Another time I was trying to just use that option and it didn't work until I replaced the core libraries. So to reload a plugin one or both of those steps might be required.
I have created a local version of my Drupal website to do dev work on. But when I add new modules to the local version they do install but they do not enable correctly. For example I added the legal module, enabled it, but when I go to site configuration to edit it, the legal section does not appear. Any help please?
The problem is that not enough memory will be allocated to the service to allow for new modules which require more memory to be ran, try putting
ini_set('memory_limit', '256M');
in the sites/default/settings.php file.
This is a really old thread but thought it was worth adding the following.
I had this problem recently on a local dev install (using Acquia Dev Desktop, by the way). Turning off the Memcache module resolved my issue.
I am trying to keep a couple of Drupal sites updated and I tired of the whole process. I recently find out about Drush and I was wondering if there is a module or a CRON command I can setup to keep the sites updated for me.
Thank you.
I can see why you would want to automatically update your site, but doing so with or without drush is not advisable.
Not all module updates are backwards compatible (eg. ctools) and not all combinations of modules work together - drush does not take this into account - it just updates regardless. Add to this the possibility that the developer of a module accidentally adds another error as he or she fixed an exiting one.
Therefore you really need to test your site everytime you update a module to verify that everything works as intended. The convenience of autoupdates via cron doesn't really outweigh the troubles if clients call you up because the site crashed.
Add this to your crontab to get Drush to update your Drupal copy everyday at 12:01 PM:
1 12 * * * drush -y up