Comments

bojanz created an issue. See original summary.

devad’s picture

Title: PackageDownloader uses deprecated file functions » [D9] PackageController and PackageDownloader use deprecated file functions
Issue summary: View changes

After applying automated Rector patch #2 from #3130934: Drupal 9 Compatibility here is the rest of Upgrade Status module report for Ludwig 8.x-1.0

Ludwig 8.x-1.0
Scanned on Thu, 09/17/2020 - 08:55.

2 errors found.

D:\wamp\www\dadhicheck\web\modules\ludwig\src\Controller\PackageController.php:
┌─────────┬──────┬──────────────────────────────────────────────────────────────┐
│ STATUS  │ LINE │                           MESSAGE                            │
├─────────┼──────┼──────────────────────────────────────────────────────────────┤
│ Fix now │ 65   │ Call to deprecated function system_get_info(). Deprecated in │
│         │      │ drupal:8.8.0 and is removed from drupal:9.0.0. Use           │
│         │      │ \Drupal::service('extension.list.$type')->getExtensionInfo() │
│         │      │ or                                                           │
│         │      │ \Drupal::service('extension.list.$type')->getAllInstalledInf │
│         │      │ o() instead.                                                 │
│         │      │                                                              │
└─────────┴──────┴──────────────────────────────────────────────────────────────┘

D:\wamp\www\dadhicheck\web\modules\ludwig\src\PackageDownloader.php:
┌─────────┬──────┬──────────────────────────────────────────────────────────┐
│ STATUS  │ LINE │                         MESSAGE                          │
├─────────┼──────┼──────────────────────────────────────────────────────────┤
│ Fix now │ 175  │ Call to deprecated function                              │
│         │      │ file_unmanaged_delete_recursive(). Deprecated in         │
│         │      │ drupal:8.7.0 and is removed from drupal:9.0.0. Use       │
│         │      │ Drupal\Core\File\FileSystemInterface::deleteRecursive(). │
│         │      │                                                          │
└─────────┴──────┴──────────────────────────────────────────────────────────┘
devad’s picture

Status: Active » Needs review
StatusFileSize
new3.91 KB

This patch includes automated Rector patch #2 from #3130934: Drupal 9 Compatibility and core_version_requirement for D9.

It fixes two Upgrade Status errors listed at comment #2 also.

devad’s picture

StatusFileSize
new3.91 KB

Failing again with d9.1.

bojanz’s picture

protected $extensionListModule;

Let's call this $moduleExtensionList (and $module_extension_list in __construct()), it reads better. Core uses both, no clue why.

The Drupal 9.1 failure looks unrelated to the module. If it doesn't pass on its own, you might need to ping someone on Slack.

devad’s picture

StatusFileSize
new5.85 KB

Implemented suggestion #5.

Plus trying to code-copy similar core patches.

And at the end fixing 4 coding standards messages from test #4 results.

devad’s picture

StatusFileSize
new4.23 KB

Interdiff almost as big as patch itself. :)

Regarding D9 tests failure I have created a core issue:

#3171932: Ludwig module Tests issue: Conclusion: don't install drupal/core 9.1.x-dev

Maybe somebody will reply what's wrong with D9 tests.

spokje’s picture

@devad: In reply to your question here:

  1. You need to remove the line core: 8.x from ludwig.info.yml
  2. IIRC you can apply this patch before TestBot starts using its containers by using the container_command in drupalci.yaml as in the example here: https://www.drupal.org/drupalorg/docs/drupal-ci/customizing-drupalci-tes...
devad’s picture

Thank you @Spokje.

@bojanz
Since D8 tests are fine, and D9 tests fail because of current ludwig.info.yml file content... I suggest that we continue with "Needs review" here... if you agree of course.

I have tested patch #6 manually and it works fine for me both in D8 and D9 environments.

More manual tests are welcome...

bojanz’s picture

@devad
Okay. Waiting on RTBC to commit. I'd also happily give you co-maintainership if you want to continue driving this forward.

devad’s picture

RE: I'd also happily give you co-maintainership if you want to continue driving this forward.

OK. I can try.

It will be my first module to co-maintain though, so I will need some help probably.

I hope there are some handy tutorials around to help new Drupal co-maintainers. :)

devad’s picture

Fixing the unintentional character-delete change and adding one-line patch from (#3003869) to avoid git merging during commit.

devad’s picture

StatusFileSize
new671 bytes

interdiff

bojanz’s picture

@devad
You have access now.

devad’s picture

Thanks @bojanz.

cjsmith87’s picture

I am trying to apply #12 patch to ludwig-8.x-1.x-dev. I have downloaded ludwig-8.x-1.x-dev and unzipped, Downloaded the patch and put it in the root of the module and ran "git apply 3093483-6.patch" but i get the following error:

error: patch failed: ludwig.info.yml:1
error: ludwig.info.yml: patch does not apply

cjsmith87’s picture

Ok so I edited the info.yml file manually and then the other changes applied correctly but now I get this error message on my site when going to update.php:

[01-Oct-2020 12:14:57 Europe/London] Error: Call to a member function getParameter() on null in /home/mywebsite.com/core/lib/Drupal/Core/AppRootFactory.php on line 34 #0 /home/mywebsite.com/vendor/symfony/dependency-injection/ContainerBuilder.php(1132): Drupal\Core\AppRootFactory->get()
#1 /home/mywebsite.com/vendor/symfony/dependency-injection/ContainerBuilder.php(618): Symfony\Component\DependencyInjection\ContainerBuilder->createService(Object(Symfony\Component\DependencyInjection\Definition), Array, true, 'app.root')
#2 /home/mywebsite.com/vendor/symfony/dependency-injection/ContainerBuilder.php(558): Symfony\Component\DependencyInjection\ContainerBuilder->doGet('app.root', 1)
#3 /home/mywebsite.com/modules/ludwig/src/LudwigServiceProvider.php(20): Symfony\Component\DependencyInjection\ContainerBuilder->get('app.root')
#4 /home/mywebsite.com/core/lib/Drupal/Core/DrupalKernel.php(1266): Drupal\ludwig\LudwigServiceProvider->register(Object(Drupal\Core\DependencyInjection\ContainerBuilder))
#5 /home/mywebsite.com/core/lib/Drupal/Core/DrupalKernel.php(897): Drupal\Core\DrupalKernel->compileContainer()
#6 /home/mywebsite.com/core/lib/Drupal/Core/Update/UpdateKernel.php(41): Drupal\Core\DrupalKernel->initializeContainer()
#7 /home/mywebsite.com/core/lib/Drupal/Core/DrupalKernel.php(470): Drupal\Core\Update\UpdateKernel->initializeContainer()
#8 /home/mywebsite.com/core/lib/Drupal/Core/Update/UpdateKernel.php(64): Drupal\Core\DrupalKernel->boot()
#9 /home/mywebsite.com/update.php(28): Drupal\Core\Update\UpdateKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#10 {main}

devad’s picture

Re: @cjsmith87 comment #16

You said that you downloaded patch #12 but your git apply command is for patch #6.

Patch #6 had typo in code, and therefore patch 12 is released. See interdiff.

Can you apply patch #12 and reply if you have any issues with it?

It applies cleanly to testbot (just retested). So, it should apply cleanly to you as well.

This may help: If you are on Windows system, to avoid problems with git apply errors do not copy/paste patch text into your text editor and save. Rather right-click the patch in your browser, select "Save link as" and save it to your ludwig's folder directly.

devad’s picture

devad’s picture

Title: [D9] PackageController and PackageDownloader use deprecated file functions » Make Ludwig D9 ready
Status: Needs review » Needs work

It seems that the issue below is not connected with D9 deprications, but it is a must-fix before D9 release since it affects Ludwig + D9 environments. Since is not reproducible at Ludwig + D8 environment it could be a Drupal Core bug/issue as well which we need to find a fix around.

#3153424: [D9] Error: Call to a member function getParameter() on null

Some help there would be appreciated...

Changing title of this issue to address all D9 deprications. If you find more deprications, just post here.

pbhuktar7’s picture

ludwig #12 worked perfectly on D9.07 for me
also consider to add test patch

devad’s picture

@pbhuktar7

Thnx for review.

I have created a new issue for your tests: #3176547: Add more Ludwig tests.

Please, feel free to upload your tests patch there so that it can be properly tested by Drupal automated tests.

devad’s picture

Status: Needs work » Needs review

Good news. The last Ludwig D9 release blocking issue #3153424: [D9] Error: Call to a member function getParameter() on null has a patch now as well.

pbhuktar7’s picture

re @devad #22
There was error like this, while installing of Address Library
it give error like
#3153424: [D9] Error: Call to a member function getParameter() on null
so i followed This issue, also added suitable library definitions to address field. without removing ludwig,, in previous cases after dependency resolve my big mistake i removed ludwig module.
my json library defination :

{
    "require": {
		
		 "doctrine/collections": {
		 "version" : "v1.4.0",
		 "url": "https://github.com/doctrine/collections/archive/v1.4.0.zip"
		 },
		 "commerceguys/enum": {
		 "version" : "v1.0",
		 "url": "https://github.com/commerceguys/enum/archive/v1.0.zip"
		 },
        "commerceguys/addressing": {
            "version": "v1.0.7",
            "url": "https://github.com/commerceguys/addressing/archive/v1.0.7.zip"
        }
    }
}
pbhuktar7’s picture

devad’s picture

Status: Needs review » Reviewed & tested by the community

Marking RTBC as per #21

devad’s picture

StatusFileSize
new6.48 KB

Adding fix for #3153424: [D9] Error: Call to a member function getParameter() on null to patch #12 so that it can be properly tested with D9.

devad’s picture

StatusFileSize
new578 bytes

One line interdiff.

devad’s picture

Status: Reviewed & tested by the community » Needs review

Patch #27 needs review again since it is now supposed to fix both our issue and this issue as well: #3153424: [D9] Error: Call to a member function getParameter() on null.

Re: #24 @pbhuktar7
You can use patch #27 from here and patch #5 from: #3126733-5: doctrine/collections missing when using Ludwig on D9 together.
It should work for you to install Address module + D9 properly with Ludwig.

deixadilson’s picture

I did the same thing as cjsmith87 did with patch 27:

"I have downloaded 8.x-1.0 and unzipped, Downloaded the patch 27 and put it in the root of the module and ran "git apply 3093483-27.patch" but i get the following error:

error: patch failed: ludwig.info.yml:1
error: ludwig.info.yml: patch does not apply

Ok so I edited the info.yml file manually and then the other changes applied correctly"

Then I went to try and install drupal commerce in D9 with ludwig. I put the dependencies (commerceguys/addressing and commerceguys/intl) in their places. Their statuses went "installed" in Ludwig's Packages screen. But when I tried to activate drupal commerce module I still got "Address requires the commerceguys/addressing library." error

deixadilson’s picture

Since i couldn't make d9 work with drupal commerce. I installed d8 and did the same thing. and the same thing happened.

statuses are "installed" in Ludwig's Packages screen. But when I try to activate drupal commerce module I still got "Address requires the commerceguys/addressing library." error

devad’s picture

Re: @deixadilson #30, #31

Are you using Composer or tarball to install Drupal Core?

deixadilson’s picture

Re: devad #32

Tarball

devad’s picture

Re: @deixadilson #30, #31

Did you try to clear cache after you have downloaded and unpacked library into proper folder structure?

Reports > Packages report will show your library as "Installed" even without cache clear, but enabling the module will not work if you do not clear the cache after the library is unpacked.

deixadilson’s picture

It worked after clearing the cache in D9. Sorry for that.

devad’s picture

Re: #35. Good that you have posted your issue. I have learned from it.

Regarding your problems with patch not applying... it is normal since drupal.org is adding few extra lines to info.yml files when project is downloaded as tarball. To apply patch without such problems git clone + git apply is needed.

The last thing, but important for your D9 + Address module configuration: You are going to need patch #5 from #3126733-5: doctrine/collections missing when using Ludwig on D9 for Address module to work nicely with D9.

devad’s picture

Issue summary: View changes
StatusFileSize
new7.09 KB

One more D9 deprecation error with drush ludwig-download command:

ArgumentCountError: Too few arguments to function Drupal\Core\FileTransfer\Local::__construct(), 1 passed in D:\wamp\www\d9ludwig\modules\ludwig\src\PackageDownloader.php on line 100 and exactly 2 expected in Drupal\Core\FileTransfer\Local->__construct() (line 25 of D:\wamp\www\d9ludwig\core\lib\Drupal\Core\FileTransfer\Local.php).

New patch attached. It should fix the Drupal Console ludwig:download command automatically also.

devad’s picture

StatusFileSize
new1.62 KB

Interdiff.

devad’s picture

  • devad committed 5b5863a on 8.x-1.x
    Issue #3093483 by devad, bojanz, pbhuktar7, Spokje: Make Ludwig D9 ready
    
devad’s picture

Status: Needs review » Fixed

Thanks to all. Committed to 8.x-1.x-dev.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

ladybug_3777’s picture

I'm not sure what I may be missing, but I'm not able to use this module on my Drupal 9.2.4 installation.

I've tried version 1.8 and dev but both give me the following error when I try to view the config page:

The website encountered an unexpected error. Please try again later.

InvalidArgumentException: Class "\Drupal\ludwig\Controller\PackageController" does not exist. in Drupal\Core\DependencyInjection\ClassResolver->getInstanceFromDefinition() (line 24 of core/lib/Drupal/Core/DependencyInjection/ClassResolver.php).
Drupal\Core\Controller\ControllerResolver->createController('\Drupal\ludwig\Controller\PackageController::page') (Line: 69)
Drupal\Core\Controller\ControllerResolver->getControllerFromDefinition('\Drupal\ludwig\Controller\PackageController::page', '/admin/reports/packages') (Line: 85)
Drupal\Core\Controller\ControllerResolver->getController(Object) (Line: 141)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 80)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 717)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19

Is there something else I need to do to get this working?

devad’s picture

I can not reproduce this error on clean D9.2.4 installation.

Can you reproduce this error on clean D9.2.4 installation @ladybug_3777?

If yes, can you post the exact steps how to reproduce the error.

And please send us more data about your configuration:

  • What is your PHP version?
  • What is your system OS (Linux, Windows)?
  • Do you have this error appearing at your local site or your site uploaded to some shared hosting environment?

Also, do you have any other log errors appearing close to this one?

mmjvb’s picture

Looks like this happens when you don't use composer to install.
That is how I reproduced it. No classes available. The module depends on composer to make it work.

devad’s picture

Can you please post the exact steps to reproduce post #43 error @mmjvb.

I have done:

1. Installing D9.2.4 from tarball (without composer).
2. Installing Ludwig 1.8 from tarball (without composer as well).

And everything works fine at my local environment with php7.3.12

mmjvb’s picture

879  composer show drupal/ludwig
  880  cd web/modules
  881  ls
  882  cp -r contrib/ludwig .
  883  ls
  884  cd ..
  885  drush pmu ludwig
  886  cd ..
  887  composer remove drupal/ludwig

Copied the composer installed ludwig one higher, uninstall from site and remove code. Then enable using GUI.

Realized I should have cleared cache. So, repeated the proces with drush cr. Now it does work.

Sorry, no longer reproducible.

EDIT Actually, it is. Didn't have my coffee yet. Forgot to remove composer installed ludwig after which a cache rebuild is done. And reproduced the issue!

devad’s picture

Thank you @mmjvb, but your post didn't help me enough. I need a simple steps to reproduce still. Like 1, 2, 3...

BTW... Ludwig is the manual alternative for Composer. Installing D9 + Ludwig with Composer does not make a lot of sense. Drupal users familiar with Composer do not need Ludwig and they shouldn't use it.

mmjvb’s picture

It really doesn't get simpler than what I described.

So, just confirming that it doesn't work when manually installed. It works when installed with composer!
Agree that you should not need to install it with composer. But, now you need to, otherwise it doesn't work.

Started to require classes in ludwig.module, but there are just too many, so gave up.

EDIT No idea why it wouldn't work. Created a new environment with 9.2.4, installed Ludwig with the tar.gz, enabled it, no problem. Copied smtp from other environment. No problem, shows as installed.

devad’s picture

As I said previously... if I follow simple basic installation steps described in my post #46 I can not reproduce the error.

If someone can post here similar 1, 2, 3... steps which can produce this error with clean Drupal 9.2.4 installation it would be helpful.

mmjvb’s picture

@ladybug_3777 My problem was having used composer for Ludwig. In addition to clearing cache you might need `composer dump` to really get rid of outdated configuration. Doesn't look like an issue with Ludwig, just happens to be the project involved, could have been any project.

ladybug_3777’s picture

The issue ended up being a problem with directory syncing on my installation that was using docker. It wasn't properly copying the files from my Vendor folder over to my docker environment. Took me a while to track this down, but glad to report it's not the module that had the problem.

devad’s picture

Thank you for reporting back @ladybug_3777.