Problem/Motivation

Hello project maintainers,

This is an automated issue to help make this module compatible with Drupal 10.

To read more about this effort by the Drupal Association, please read: The project update bot is being refreshed to support Drupal 10 readiness of contributed projects

Patches will periodically be added to this issue that remove Drupal 10 deprecated API uses. To stop further patches from being posted, change the status to anything other than Active, Needs review, Needs work or Reviewed and tested by the community. Alternatively, you can remove the "ProjectUpdateBotD10" tag from the issue to stop the bot from posting updates.

The patches will be posted by the Project Update Bot official user account. This account will not receive any issue credit contributions for itself or any company.

Proposed resolution

You have a few options for how to use this issue:

  1. Accept automated patches until this issue is closed

    If this issue is left open (status of Active, Needs review, Needs work or Reviewed and tested by the community) and the "ProjectUpdateBotD10" tag is left on this issue, new patches will be posted periodically if new deprecation fixes are needed.

    As the Drupal Rector project improves and is able to fix more deprecated API uses, the patches posted here will cover more of the deprecated API uses in the module.

    Patches and/or merge requests posted by others are ignored by the bot, and general human interactions in the issue do not stop the bot from posting updates, so feel free to use this issue to refine bot patches. The bot will still post new patches then if there is a change in the new generated patch compared to the patch that the bot posted last. Those changes are then up to humans to integrate.

  2. Leave open but stop new automated patches.

    If you want to use this issue as a starting point to remove deprecated API uses but then don't want new automated patches, remove the "ProjectUpdateBotD10" tag from the issue and use it like any other issue (the status does not matter then). If you want to receive automated patches again, add back the "ProjectUpdateBotD10" tag.

  3. Close it and don't use it

    If the maintainers of this project don't find this issue useful, they can close this issue (any status besides Active, Needs review, Needs work and Reviewed and tested by the community) and no more automated patches will be posted here.

    If the issue is reopened, then new automated patches will be posted.

    If you are using another issue(s) to work on Drupal 10 compatibility it would be very useful to other contributors to add those issues as "Related issues" when closing this issue.

Remaining tasks

Using the patches

  1. Apply the latest patch in the comments by Project Update Bot or human contributors that made it better.
  2. Thoroughly test the patch. These patches are automatically generated so they haven't been tested manually or automatically.
  3. Provide feedback about how the testing went. If you can improve the patch, post an updated patch here.

Providing feedback

If there are problems with one of the patches posted by the Project Update Bot, such as it does not correctly replace a deprecation, you can file an issue in the Drupal Rector issue queue. For other issues with the bot, for instance if the issue summary created by the bot is unclear, use the Project analysis issue queue.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Project Update Bot created an issue. See original summary.

project update bot’s picture

Status: Active » Needs review
StatusFileSize
new808 bytes

This is an automated patch generated by Drupal Rector. Please see the issue summary for more details.

It is important that any automated tests available are run with this patch and that you manually test this patch.

Drupal 10 Compatibility

According to the Upgrade Status module, even with this patch, this module is not yet compatible with Drupal 10.

Currently Drupal Rector, version 0.13.0, cannot fix all Drupal 10 compatibility problems.

This patch does not update the info.yml file for Drupal 10 compatibility.

Leaving this issue open, even after committing the current patch, will allow the Project Update Bot to post additional Drupal 10 compatibility fixes as they become available in Drupal Rector.

Debug info

Bot run #139

This patch was created using these packages:

  1. mglaman/phpstan-drupal: 1.1.24
  2. palantirnet/drupal-rector: 0.13.0
project update bot’s picture

hmdnawaz’s picture

Issue summary: View changes
StatusFileSize
new1.7 KB
hmdnawaz’s picture

StatusFileSize
new1.49 KB
hmdnawaz’s picture

StatusFileSize
new1.87 KB
kthull’s picture

Patch #6 applies and upgrade status only reports a problem for D11, so this looks good.

beunerd made their first commit to this issue’s fork.

Wishal.f’s picture

StatusFileSize
new2.93 KB
new1.16 KB

Fixed deprecation warnings/errors.

gidarai’s picture

Status: Needs review » Reviewed & tested by the community

I have reviewed patch #9. Seems to solve all of the errors/warnings in Drupal 10. Let's move this to RTBC

hmdnawaz’s picture

Title: Automated Drupal 10 compatibility fixes » Automated Drupal 10 compatibility fixes.
fabsgugu’s picture

Hello,

Would it be possible to resolve the issue quickly? The end of life of Drupal 9 is near.

fabsgugu’s picture

Priority: Normal » Critical
purushotam.rai’s picture

Can you please create merge request https://git.drupalcode.org/issue/unmanaged_files-3299384/-/compare/1.0.x...
Seems like I don't have access to create PR / MR

alfattal’s picture

@purushotam.rai You're the module/project maintainer and you should have access to the Git repo!

alfattal’s picture

Status: Reviewed & tested by the community » Needs review

Patch in #9 failed to apply while the patch in #6 applied successfully with no errors in the Upgrade Status report.

Full trace:

- Applying patches for drupal/unmanaged_files
https://www.drupal.org/files/issues/2023-05-03/3299384-9.patch (3299384-9: Automated Drupal 10 compatibility fixes)
Downloading https://www.drupal.org/files/issues/2023-05-03/3299384-9.patch
patch '-p1' --no-backup-if-mismatch -d 'docroot/modules/contrib/unmanaged_files' < '/tmp/64d69f6d1f3ac.patch'
Executing command (CWD): patch '-p1' --no-backup-if-mismatch -d 'docroot/modules/contrib/unmanaged_files' < '/tmp/64d69f6d1f3ac.patch'
patching file src/Form/DeleteUnmanagedFilesForm.php

patching file src/UnmanagedFilesManager.php

Reversed (or previously applied) patch detected!
Assume -R? [n]

Apply anyway? [n]

Skipping patch.

2 out of 2 hunks ignored
-- saving rejects to file src/UnmanagedFilesManager.php.rej

patching file unmanaged_files.info.yml

patch '-p0' --no-backup-if-mismatch -d 'docroot/modules/contrib/unmanaged_files' < '/tmp/64d69f6d1f3ac.patch'
Executing command (CWD): patch '-p0' --no-backup-if-mismatch -d 'docroot/modules/contrib/unmanaged_files' < '/tmp/64d69f6d1f3ac.patch'
can't find file to patch at input line 5

Perhaps you used the wrong -p or --strip option?

The text leading up to this was:
--------------------------

|diff --git a/src/Form/DeleteUnmanagedFilesForm.php b/src/Form/DeleteUnmanagedFilesForm.php
|index 3b6968a..55494d3 100644
|--- a/src/Form/DeleteUnmanagedFilesForm.php
|+++ b/src/Form/DeleteUnmanagedFilesForm.php
--------------------------

File to patch:

Skip this patch? [y]

Skipping patch.

4 out of 4 hunks ignored

can't find file to patch at input line 48

Perhaps you used the wrong -p or --strip option?

The text leading up to this was:
--------------------------

|diff --git a/src/UnmanagedFilesManager.php b/src/UnmanagedFilesManager.php
|index 43fd52a..437e2af 100644
|--- a/src/UnmanagedFilesManager.php
|+++ b/src/UnmanagedFilesManager.php
--------------------------

File to patch:

Skip this patch? [y]

Skipping patch.

2 out of 2 hunks ignored

can't find file to patch at input line 70

Perhaps you used the wrong -p or --strip option?

The text leading up to this was:
--------------------------

|diff --git a/unmanaged_files.info.yml b/unmanaged_files.info.yml
|index 8eb8c32..4c77cc6 100644
|--- a/unmanaged_files.info.yml
|+++ b/unmanaged_files.info.yml
--------------------------

File to patch:

Skip this patch? [y]

Skipping patch.

1 out of 1 hunk ignored

patch '-p2' --no-backup-if-mismatch -d 'docroot/modules/contrib/unmanaged_files' < '/tmp/64d69f6d1f3ac.patch'
Executing command (CWD): patch '-p2' --no-backup-if-mismatch -d 'docroot/modules/contrib/unmanaged_files' < '/tmp/64d69f6d1f3ac.patch'
can't find file to patch at input line 5

Perhaps you used the wrong -p or --strip option?

The text leading up to this was:
--------------------------

|diff --git a/src/Form/DeleteUnmanagedFilesForm.php b/src/Form/DeleteUnmanagedFilesForm.php
|index 3b6968a..55494d3 100644
|--- a/src/Form/DeleteUnmanagedFilesForm.php
|+++ b/src/Form/DeleteUnmanagedFilesForm.php
--------------------------

File to patch:

Skip this patch? [y]

Skipping patch.

4 out of 4 hunks ignored

can't find file to patch at input line 48

Perhaps you used the wrong -p or --strip option?

The text leading up to this was:
--------------------------

|diff --git a/src/UnmanagedFilesManager.php b/src/UnmanagedFilesManager.php
|index 43fd52a..437e2af 100644
|--- a/src/UnmanagedFilesManager.php
|+++ b/src/UnmanagedFilesManager.php
--------------------------

File to patch:

Skip this patch? [y]

Skipping patch.

2 out of 2 hunks ignored

can't find file to patch at input line 70

Perhaps you used the wrong -p or --strip option?

The text leading up to this was:
--------------------------

|diff --git a/unmanaged_files.info.yml b/unmanaged_files.info.yml
|index 8eb8c32..4c77cc6 100644
|--- a/unmanaged_files.info.yml
|+++ b/unmanaged_files.info.yml
--------------------------

File to patch:

Skip this patch? [y]

Skipping patch.

1 out of 1 hunk ignored

patch '-p4' --no-backup-if-mismatch -d 'docroot/modules/contrib/unmanaged_files' < '/tmp/64d69f6d1f3ac.patch'
Executing command (CWD): patch '-p4' --no-backup-if-mismatch -d 'docroot/modules/contrib/unmanaged_files' < '/tmp/64d69f6d1f3ac.patch'
can't find file to patch at input line 5

Perhaps you used the wrong -p or --strip option?

The text leading up to this was:
--------------------------

|diff --git a/src/Form/DeleteUnmanagedFilesForm.php b/src/Form/DeleteUnmanagedFilesForm.php
|index 3b6968a..55494d3 100644
|--- a/src/Form/DeleteUnmanagedFilesForm.php
|+++ b/src/Form/DeleteUnmanagedFilesForm.php
--------------------------

File to patch:

Skip this patch? [y]

Skipping patch.

4 out of 4 hunks ignored

can't find file to patch at input line 48

Perhaps you used the wrong -p or --strip option?

The text leading up to this was:
--------------------------

|diff --git a/src/UnmanagedFilesManager.php b/src/UnmanagedFilesManager.php
|index 43fd52a..437e2af 100644
|--- a/src/UnmanagedFilesManager.php
|+++ b/src/UnmanagedFilesManager.php
--------------------------

File to patch:

Skip this patch? [y]

Skipping patch.

2 out of 2 hunks ignored

can't find file to patch at input line 70

Perhaps you used the wrong -p or --strip option?

The text leading up to this was:
--------------------------

|diff --git a/unmanaged_files.info.yml b/unmanaged_files.info.yml
|index 8eb8c32..4c77cc6 100644
|--- a/unmanaged_files.info.yml
|+++ b/unmanaged_files.info.yml
--------------------------

File to patch:

Skip this patch? [y]

Skipping patch.

1 out of 1 hunk ignored

Could not apply patch! Skipping. The error was: Cannot apply patch https://www.drupal.org/files/issues/2023-05-03/3299384-9.patch
Downloading https://packages.drupal.org/8/downloads
[200] https://packages.drupal.org/8/downloads

In Patches.php line 326:

[Exception]
Cannot apply patch 3299384-9: Automated Drupal 10 compatibility fixes (https://www.drupal.org/files/issues/2023-05-03/3299384-9.patch)!

Exception trace:
at /home/ffattal/mndor/vendor/cweagans/composer-patches/src/Patches.php:326
cweagans\Composer\Patches->postInstall() at n/a:n/a
call_user_func() at phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:202
Composer\EventDispatcher\EventDispatcher->doDispatch() at phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:144
Composer\EventDispatcher\EventDispatcher->dispatchPackageEvent() at phar:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php:460
Composer\Installer\InstallationManager->Composer\Installer\{closure}() at phar:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php:475
Composer\Installer\InstallationManager->executeBatch() at phar:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php:390
Composer\Installer\InstallationManager->downloadAndExecuteBatch() at phar:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php:282
Composer\Installer\InstallationManager->execute() at phar:///usr/local/bin/composer/src/Composer/Installer.php:759
Composer\Installer->doInstall() at phar:///usr/local/bin/composer/src/Composer/Installer.php:281
Composer\Installer->run() at phar:///usr/local/bin/composer/src/Composer/Command/InstallCommand.php:137
Composer\Command\InstallCommand->execute() at phar:///usr/local/bin/composer/vendor/symfony/console/Command/Command.php:298
Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:1015
Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:299
Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:334
Composer\Console\Application->doRun() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:171
Symfony\Component\Console\Application->run() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:130
Composer\Console\Application->run() at phar:///usr/local/bin/composer/bin/composer:88
require() at /usr/local/bin/composer:29

alfattal’s picture

Status: Needs review » Needs work

It appeared that patch in #6 although apply and resolve the D10 compatibility issue in the Upgrade Status report, it breaks the module functionality with the following error:

The website encountered an unexpected error. Please try again later.
TypeError: Cannot assign Drupal\Core\File\FileUrlGenerator to property Drupal\unmanaged_files\Form\DeleteUnmanagedFilesForm::$fileUrlGenerator of type Drupal\unmanaged_files\Form\FileUrlGeneratorInterface in Drupal\unmanaged_files\Form\DeleteUnmanagedFilesForm::create() (line 66 of modules/contrib/unmanaged_files/src/Form/DeleteUnmanagedFilesForm.php).
Drupal\unmanaged_files\Form\DeleteUnmanagedFilesForm::create() (Line: 28)
Drupal\Core\DependencyInjection\ClassResolver->getInstanceFromDefinition() (Line: 48)
Drupal\Core\Controller\HtmlFormController->getFormObject() (Line: 58)
Drupal\Core\Controller\FormController->getContentResult()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 169)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 81)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 68)
Drupal\simple_oauth\HttpMiddleware\BasicAuthSwap->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: 50)
Drupal\ban\BanMiddleware->handle() (Line: 270)
Drupal\shield\ShieldMiddleware->bypass() (Line: 137)
Drupal\shield\ShieldMiddleware->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 23)
Stack\StackedHttpKernel->handle() (Line: 718)
Drupal\Core\DrupalKernel->handle() (Line: 19)
schlaukopf’s picture

Status: Needs work » Needs review
StatusFileSize
new2.97 KB

This is basically the changes on 9, but this time composer should be able to apply the changes.

hitchshock’s picture

StatusFileSize
new4.26 KB

Fixed fatal error of the last patch

Fatal error: Could not check compatibility between Drupal\unmanaged_files\Form\DeleteUnmanagedFilesForm::create(Drupal\unmanaged_files\Form\ContainerInterface $container) and Drupal\Core\Form\FormBase::create(Symfony\Component\DependencyInjection\ContainerInterface $container), because class Drupal\unmanaged_files\Form\ContainerInterface is not available in /var/www/html/docroot/modules/contrib/unmanaged_files/src/Form/DeleteUnmanagedFilesForm.php on line 60

andy_w’s picture

StatusFileSize
new4.54 KB
new464 bytes

The mysql Connection now resides in its own module, so I've attached an amend to the patch.

karenann’s picture

Do we know if this module is still being maintained and on a path for D10 compatibility?