Score:0

Migrate webform directory with Composer from manual installation

in flag

I'm started drupal project (core 9.5.2) installing modules manually (it is not good, i know). After the website is deployed in production, I made changes for configuring composer and all worked well.

As new versions of modules come out, I install them through composer. I use composer require (and the module is installed in /modules/contrib) and then I remove the module folder in /modules, clear the cache and everything works fine. I did this with several modules, such as: ctools, icme, panels, slick, symfony_mailer and others. However, when trying to perform this procedure with the webform, things do not go well (error below). I know that correct way would be to uninstall the module and reinstall it with composer, however, I would lose all the forms created, and all submissions already made. Is there a workaround for this problem?

The website encountered an unexpected error. Please try again later.
Error: Class "Drupal\webform_ui\PathProcessor\WebformUiPathProcessor" not found in Drupal\Component\DependencyInjection\Container->createService() (line 259 of core/lib/Drupal/Component/DependencyInjection/Container.php).

Drupal\Component\DependencyInjection\Container->createService() (Line: 177)
Drupal\Component\DependencyInjection\Container->get() (Line: 434)
Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters() (Line: 273)
Drupal\Component\DependencyInjection\Container->createService() (Line: 177)
Drupal\Component\DependencyInjection\Container->get() (Line: 434)
Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters() (Line: 237)
Drupal\Component\DependencyInjection\Container->createService() (Line: 177)
Drupal\Component\DependencyInjection\Container->get() (Line: 434)
Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters() (Line: 237)
Drupal\Component\DependencyInjection\Container->createService() (Line: 177)
Drupal\Component\DependencyInjection\Container->get() (Line: 136)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() (Line: 145)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 81)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 58)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 23)
Stack\StackedHttpKernel->handle() (Line: 713)
Drupal\Core\DrupalKernel->handle() (Line: 19)

I tried clear cache with "drush cc" but have same error.

Jaypan avatar
de flag
Sometimes I've had to restart the webserver after moving modules, as the filepaths get caught up in the serve cache.
Kevin avatar
in flag
Yes, if you are using any memory based cache, restart the instance.
vctlzac avatar
in flag
@Jaypan Thanks for help but, I'm using shared hosting in hostgator, so, I don't know if is possible restart instance. Testing locally, I reboot apache in ubuntu using /etc/init.d/apache2 restart and no success.
in flag
If your cache lives in the DB (e.g. `cache_*` tables exist in the DB), backup your DB then truncate those tables (i.e. empty their contents, keep the table). Then try refreshing your page. If your cache is on Redis (I dunno if shared hosting uses Redis but who knows?), flush Redis and refresh the page.
id flag
What is the precise PHP version? There are some issues with autoloading in some version ranges.
vctlzac avatar
in flag
@cilefen 8.1.14
id flag
That is not one of the problematic versions.
Score:0
in flag

After install module via composer (/modules/contrib/webform) and remove manually /modules/webform, execute:

TRUNCATE TABLE cache_bootstrap;
TRUNCATE TABLE cache_config;
TRUNCATE TABLE cache_container;
TRUNCATE TABLE cache_data;
TRUNCATE TABLE cache_default;
TRUNCATE TABLE cache_discovery;
TRUNCATE TABLE cache_dynamic_page_cache;
TRUNCATE TABLE cache_entity;
TRUNCATE TABLE cache_library;
TRUNCATE TABLE cache_menu;
TRUNCATE TABLE cache_page;
TRUNCATE TABLE cache_render;
TRUNCATE TABLE cache_toolbar;

If you use drush, u can use: drush cache-rebuild

id flag
It would be nice to know the precise table to truncate. It can't really require all of them.
vctlzac avatar
in flag
@cilefen I not see a problem do truncate all cache tables.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.