Drush command to recalculate media usage

Created on 18 November 2023, over 1 year ago

Problem/Motivation

Hello,
I need to use the media entity usage module for the existing website with many nodes and media, but the module doesn't have existing functionality for recalculating usage for existing media.

Proposed resolution

I created a pull request with the command for drush for recalculating media usage for existing entities.

✨ Feature request
Status

Active

Version

9.1

Component

Code

Created by

πŸ‡΅πŸ‡±Poland adrianliegmann

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @adrianliegmann
  • Merge request !2Resolve #3402584 "Drush command" β†’ (Open) created by adrianliegmann
  • Status changed to Needs review over 1 year ago
  • πŸ‡³πŸ‡±Netherlands Drumanuel

    Many improvements here. The module seems to work now using this fork, it didn't out of the box.

    Any plans on merging?

  • Hello Guys,
    I cannot test it. can help me ?
    I get this error Error: Class "Drupal\media_entity_usage\Service\MediaUsageInfo" not found in Drupal\Component\DependencyInjection\Container->createService()

  • πŸ‡«πŸ‡·France JΓ©rΓ΄me Dehorter Lille

    Hi,
    On our site we have media in reference to parent paragraphs, so I tried the command:
    drush media-entity-usage:recalculate meu_paragraphs.persistance media
    I have this error

    Unable to decode output into JSON: Syntax error                                                                                                                                                                                                                                                                                                                                                          
    TypeError: in_array(): Argument #2 ($haystack) must be of type array, false given in in_array() (line 29 of /app/drupal/www/modules/contrib/media_entity_usage/src/Service/MediaUsagePersistance.php).

    So I tried the command described in example :
    drush media-entity-usage:recalculate meu_node.persistance node
    I have exactly the same error

Production build 0.71.5 2024