Drupal 9 giving error after php change, please give a lead on where to start - drupal

drupal admin suggested php upgrade, so I did. 7.4>8 and now its throwing this error at me. where do I start please ? can you give a lead.
Additional uncaught exception thrown while handling exception.
Original
ReflectionException: Class "Drupal\Core\EventSubscriber\ExceptionTestSiteSubscriber" does not exist in ReflectionClass->__construct() (line 30 of /home/sailbudd/core/lib/Drupal/Core/DependencyInjection/Compiler/RegisterEventSubscribersPass.php).
ReflectionClass->__construct() (Line: 30)
Drupal\Core\DependencyInjection\Compiler\RegisterEventSubscribersPass->process() (Line: 94)
Symfony\Component\DependencyInjection\Compiler\Compiler->compile() (Line: 762)
Symfony\Component\DependencyInjection\ContainerBuilder->compile() (Line: 1322)
Drupal\Core\DrupalKernel->compileContainer() (Line: 926)
Drupal\Core\DrupalKernel->initializeContainer() (Line: 20)
Drupal\Core\Installer\InstallerKernel->initializeContainer() (Line: 476)
Drupal\Core\DrupalKernel->boot() (Line: 426)
install_begin_request() (Line: 116)
install_drupal() (Line: 48)
Additional
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "theme.manager". in Symfony\Component\DependencyInjection\ContainerBuilder->getDefinition() (line 1030 of /home/sailbudd/vendor/symfony/dependency-injection/ContainerBuilder.php).
Symfony\Component\DependencyInjection\ContainerBuilder->getDefinition() (Line: 600)
Symfony\Component\DependencyInjection\ContainerBuilder->doGet() (Line: 558)
Symfony\Component\DependencyInjection\ContainerBuilder->get() (Line: 649)
Drupal::theme() (Line: 22)
_drupal_maintenance_theme() (Line: 506)
drupal_maintenance_theme() (Line: 1025)
install_display_output() (Line: 271)
_drupal_log_error() (Line: 365)
_drupal_exception_handler()
changed from php 7.4 to 8

Somehow the 'theme.manager' sevice is no longer available.
Strangely, this service exist and is a part of drupal core since the early versions of drupal 8 and is not deprecated.
You can check it here:
https://api.drupal.org/api/drupal/services/9.4.x
You should start by clearing the cache, since services/routes needs cache clean to work on most cases.
If that do not works for you, check the drupal version and update it to the lastest (and more compatible with PHP8) version.
https://www.drupal.org/docs/upgrading-drupal
If the error persist, check your custom module directory and search for any EventSubscriber on it. You can also check the custom module .services.yml files where the services are injected.

Our problem was related to the fact, that composer update -W removed the composer/installers package.
So doing this resolved our issue
composer require composer/installers
drush cr

Related

WordPress Colibri Plugin Stuck at 50% upload/the backup phase

I was trying to import a theme using Colibri Importer on version 6.0, but it kept getting stuck at 50%. When looking in the network tab, I saw that I was getting a 500 error back from the server, with a body of
<p>There has been a critical error on this website.</p><p>Learn more about troubleshooting WordPress.</p>
How do I fix this error? See below :D
I looked into the server-side logs (I'm using a DigitalOcean WordPress droplet on Apache) in /var/log/apache2/error.log and found further details on what was going wrong. In those logs, near the bottom was the following:
[Fri Jun 10 00:38:59.943725 2022] [php:error] [pid 195718] [client 73.188.75.186:58428] PHP Fatal error:
Uncaught TypeError: trim(): Argument #1 ($string) must be of type string, array given in /var/www/html/wp-content/plugins/colibri-sync/src/Colibri/Sync/Endpoints/Importer.php:181
Stack trace:
#0 (181): trim()
#1 /var/www/html/wp-content/plugins/colibri-sync/src/Colibri/Sync/Endpoints/Importer.php(275): Colibri\\Sync\\Endpoints\\Importer->getColibriUploadPath()
#2 /var/www/html/wp-content/plugins/colibri-sync/src/Colibri/Sync/Endpoints/Importer.php(332): Colibri\\Sync\\Endpoints\\Importer->rename()
#3 [internal function]: Colibri\\Sync\\Endpoints\\Importer->execute_backup_content()
#4 /var/www/html/wp-content/plugins/colibri-sync/src/Colibri/Sync/Endpoints/Importer.php(52): call_user_func()
#5 /var/www/html/wp-content/plugins/colibri-sync/src/Colibri/Sync/Core/Endpoint.php(76): Colibri\\Sync\\Endpoints\\Importer->runStep()
#6 /var/www/html/wp-content/plugins/colibri-sync/src/Colibri/Sync/ColibriSync.php(186): Colibri\\Sync\\Core\\Endpoint->verifyAndExecute()
#7 /var/www/html/wp-content/plugins/colibri-sync/src/Colibri/Sync/ColibriSync.php(151): Colibri\\Sync\\ColibriSync->import()
#8 /var/www/html/wp-includes/class-wp-hook.php(307): Colibri\\Sync\\ColibriSync->execute()
#9 /var/www/html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters()
#10 /var/www/html/wp-includes/plugin.php(476): WP_Hook->do_action()
#11 /var/www/html/wp-admin/admin-ajax.php(187): do_action()
#12 {main}\n thrown in /var/www/html/wp-content/plugins/colibri-sync/src/Colibri/Sync/Endpoints/Importer.php on line 181, referer: https://blog.tripbee.com/wp-admin/tools.php?page=colibri_sync_tools
I went to the mentioned file /var/www/html/wp-content/plugins/colibri-sync/src/Colibri/Sync/Endpoints/Importer.php on my server, and looked at the function getColibriUploadPath on line 181, where the issue was stemming from. It appeared that the trim function was expecting a string, but instead was being given an array. To fix it, I replaced
$rel = trim($rel);
with
if (is_array($rel)) {
$rel = trim(implode($rel));
}
elseif (is_string($rel)) {
$rel = trim($rel);
}
and saved the file. Without restarting the server or anything else, I reattempted the import and it succeeded! Hopefully this helps anyone who just updated to WP 6.0 and are struggling to get the Colibri Importer working on that version :)

Drupal site issue

I have setup a Drupal 9 site on CentOS Linux Server, All permissions are on place, even i have tried 777 Permissions as well but no luck with it.
I am getting the following errors on loading the site.
Drupal\Component\PhpStorage\FileStorage->createDirectory('sites/default/files/php/twig', 511) (Line: 73)
Drupal\Component\PhpStorage\FileStorage->ensureDirectory('sites/default/files/php/twig') (Line: 66)
Drupal\Component\PhpStorage\MTimeProtectedFastFileStorage->save('60a33rwes432_views-view.html.twig_nvxJimhcnulevdX8J3BYUfwescwe4XBK', '<?php

Cannot install Drupal 8 on Linux, php 5.6

I cannot install Drupal 8 on my linux server runing php5.6
My steps
1)Downloaded and extract drupal-8.2.1.tar.gz
2)rename drupal-8.2.1/ to drupal2
3) cd drupal2
4)composer update
when I go the web interface and try to install it gives so many
like Symfony errors
User deprecated function: The Symfony\Component\DependencyInjection\Definition::getScope method is deprecated since version 2.8 and will be removed in 3.0. in Symfony\Component\DependencyInjection\Definition->getScope() (line 603 of /home/tofa/www/drupal2/vendor/symfony/dependency-injection/Definition.php).
then it gives
Warning: stat(): stat failed for /home/username/www/drupal2/sites/default/files/css in Drupal\Core\StreamWrapper\LocalStream->url_stat() (line 501 of core/lib/Drupal/Core/StreamWrapper/LocalStream.php).
Drupal\Core\StreamWrapper\LocalStream->url_stat('public://css', 2)
is_dir('public://css') (Line: 1032)
file_scan_directory('public://css', '/.*/', Array) (Line: 184)
Drupal\Core\Asset\CssCollectionOptimizer->deleteAll() (Line: 202)
Drupal\Core\Extension\ThemeInstaller->install(Array, 1) (Line: 164)
Drupal\Core\Extension\ThemeHandler->install(Array) (Line: 1541)
install_profile_themes(Array) (Line: 660)
install_run_task(Array, Array) (Line: 538)
install_run_tasks(Array) (Line: 115)
install_drupal(Object) (Line: 44)
Not sure how to fix this?
Please look at the official installation instructions located in the drupal folder (INSTALL.txt) or on drupal.org: https://api.drupal.org/api/drupal/core!INSTALL.txt/8.2.x
Disabled xdebug and it fixed the issue :)
I think Drupal 8 only works with PHP7 (and above)

Using zopyx.smartprintng.plone receive "[Errno 111] Connection refused" when trying to generate PDF

Overview
A client contacted us requesting that when they fill in a form on their site (created with PloneFormGen), they want the input of the form sent to the customer in PDF format (the converted form must be then printed, signed and posted back to the customer).
I jumped on the Plone.org IRC room and asked the guys there, they suggested I use the zopyx.smartprintng.plone add-on. This seemed perfect because they have a script adapter example for PloneFormGen that I can use to convert the form input into a PDF file.
The docs for the add-on are on this page:
http://docs.produce-and-publish.com/#produce-publish-client-connector
Going on that I was told I only needed to install the "Produce and Publish Client Connector" I proceeded to follow the installation instructions on the documentation.
The Installation
The buildout installation went fine, it reported no errors at all and my buildout reflects exactly what they state it must on that installation documentation page.
However I noticed that under "Add/Remove Add-ons" in the Plone Control Panel, I could see no reference to this add-on, thus preventing me from actually enabling it on the particular site I am working on. (I have a feeling this may be the cause of the problem I am experiencing, but I have no idea how to resolve it). - I have checked portal_quickinstaller and it's not there either.
The Problem
According to the documentation appending ##asPlainPDF to the URL of the page you want to render will then render the PDF for you.
So I enter mysite.com/front-page/##asPlainPDF in my browser.
Upon doing this I receive this traceback:
Traceback (innermost last):
Module ZPublisher.Publish, line 126, in publish
Module ZPublisher.mapply, line 77, in mapply
Module ZPublisher.Publish, line 46, in call_object
Module zopyx.smartprintng.plone.browser.pdf, line 249, in __call__
Module zopyx.smartprintng.plone.browser.pdf, line 85, in __call__
Module zopyx.smartprintng.plone.browser.pdf, line 232, in __call2__
Module zopyx.smartprintng.client.zip_client, line 192, in convertZIP2
Module xmlrpclib, line 1224, in __call__
Module xmlrpclib, line 1578, in __request
Module xmlrpclib, line 1264, in request
Module xmlrpclib, line 1292, in single_request
Module xmlrpclib, line 1439, in send_content
Module httplib, line 954, in endheaders
Module httplib, line 814, in _send_output
Module httplib, line 776, in send
Module httplib, line 757, in connect
Module socket, line 571, in create_connection
error: [Errno 111] Connection refused
If you need more information than this please tell me where to get it and I shall provide it to you.
I have Google'd the error: [Errno 111] Connection refused message but it is either people experiencing issues with a Python program they are writing or a different add-on named zopyx.smartprintng.lite
I did find this thread however: https://groups.google.com/forum/#!msg/plone-users/wCuO4RCUIQk/VslwOXvs4XwJ
So as one user suggested I tried installing zopyx.smartprintng.server however that started complaining that I had the wrong version of zope.configuration, and wants >=3.8.0dev upon pinning that to 4.0.2 as it was the latest I could find, it then started complaining about another add-on and I got some buildout errors, which then bricked my Plone server (stopped the clients from coming up) and I had to re-run buildout from a backup buildout.cfg I made so it would make the necessary zope.conf files.
Server information
Plone 4.2.1.1 (4207)
CMF 2.2.6
Zope 2.13.16
Python 2.7.3 (default, Oct 18 2012, 15:13:00) [GCC 4.6.3]
Summary
Followed these installation instructions:
http://docs.produce-and-publish.com/#produce-publish-client-connector
Received the above traceback trying to convert PDF when appending ##asPlainPDF to URL
Attempts to install zopyx.smartprintng.server have failed.
The Produce-and-publish set of components does indeed require the server to be set up. The Plone product you installed is merely the integration point between Plone and that server.
Please to follow the instructions on http://docs.produce-and-publish.com/server/installation.html to install that separate server (it can have it's own buildout).
(If you run into problems with that installation, feel free to ask a new question here on Stack Overflow, or ask on the Plone Users mailinglist, or contact the author (which may require you to pay Zopyx for such support)).

How to clean unused add-ons from a Plone site?

This is a general question but motivated by an example. The general question is: How to clean Plone sites from unused add-ons? You can generate an unused add-on in several ways, for example if you use one add-one for one thing and later you prefer another.
I'm starting learning about Plone and maybe I'm making some mistakes. But I think that some add-ons can make problems because they left some things that are not automatically uninstalled. Then my question is also about how to isolate the data from the possible add-ons footprints.
So, this is the example:
When I started with Plone I installed an add-on named zettwerk.ui. But later I uninstalled it. I removed the add-on using the Plone web interface and the buildout configuration. Then I got the problem: every time that I try to install another add-on an error message appears:
2012-04-28 00:21:54 INFO GenericSetup.rolemap Role / permission map imported.
2012-04-28 00:21:54 INFO GenericSetup.archetypetool Archetype tool imported.
2012-04-28 00:21:54 INFO GenericSetup.browserlayer Browser layers imported
2012-04-28 00:21:54 INFO GenericSetup.resourceregistry KSS registry imported.
2012-04-28 00:21:54 ERROR GenericSetup Step zettwerk.ui.disable_sunburst_patch has an invalid import handler
2012-04-28 00:21:54 INFO GenericSetup.rolemap Role / permission map imported.
2012-04-28 00:21:54 INFO GenericSetup.toolset Class zettwerk.ui.tool.tool.UITool not found for tool portal_ui_tool
2012-04-28 00:21:54 ERROR Zope.SiteErrorLog 1335586914.990.0334188015457 http://localhost:8080/Plone/portal_quickinstaller/installProducts
Traceback (innermost last):
Module ZPublisher.Publish, line 126, in publish
Module ZPublisher.mapply, line 77, in mapply
Module Products.PDBDebugMode.runcall, line 70, in pdb_runcall
Module ZPublisher.Publish, line 46, in call_object
Module Products.CMFQuickInstallerTool.QuickInstallerTool, line 575, in installProducts
Module Products.CMFQuickInstallerTool.QuickInstallerTool, line 512, in installProduct
- __traceback_info__: ('plone.app.theming',)
Module Products.GenericSetup.tool, line 323, in runAllImportStepsFromProfile
- __traceback_info__: profile-plone.app.theming:default
Module Products.GenericSetup.tool, line 1080, in _runImportStepsFromContext
Module Products.GenericSetup.tool, line 994, in _doRunImportStep
- __traceback_info__: toolset
Module Products.GenericSetup.tool, line 123, in importToolset
TypeError: 'NoneType' object is not callable
> /home/daniel/.buildout/eggs/Products.GenericSetup-1.6.3-py2.6.egg/Products/GenericSetup/tool.py(123)importToolset()
-> new_tool = tool_class(tool_id)
I put zettwerk.ui back in buildout.conf and then the error disappears. But I think that the solution is not clean. So, how can I remove zettwerk.ui from buildout without making problems?
This has been fixed in GenericSetup 1.6.5:
http://pypi.python.org/pypi/Products.GenericSetup/1.6.5
Updating to that version (included in Plone 4.1.4) should do the trick.
(Latest stable release currently is Plone 4.1.5 with GenericSetup 1.6.6, so I would say go for that one.)
Explanation: during install, zettwerk.ui has told GenericSetup that it requires a tool. This tool is then created. During uninstall, the tool is removed, but it is still in the list of required tools. If zettwerk.ui is uninstalled but the package is still in your buildout and you install another add-on, then GenericSetup looks at the list of required tools and creates this tool again. When zettwerk.ui is not available, this will fail with the above error. GenericSetup 1.6.5 simply prints a warning in this case and happily continues.
I don't think wildcard.fixpersistentutilities works in this case, but I may be mistaken. For some reason I have so far managed to avoid needing that package.
There are two possibilities.
First, do a backup :-)
Simplest, if the zettwerk.ui product you reinstalled is not the same version as the one you originally added, try reinstalling it. Product removal has been much improved over the years, and fewer products now exhibit this behavior.
If you still have the problem, add the product wildcard.fixpersistentutilities to your buildout, rerun the buildout, and navigate to /##fix-persistent-utilities on your site, looking for anything on that page that references zettwerk.ui. Remove it. Once you have no more references there, remove the zettwerk.ui product.
Actually, there's a third possibility: add a patch to zettwerk.ui to fix its uninstall!

Resources