Download the PHP package dbrabon/filelink_usage without Composer

On this page you can find all versions of the php package dbrabon/filelink_usage. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package filelink_usage

Filelink Usage

Detect and track hard-coded file links in Drupal content to ensure accurate file usage.

The filelink_usage module scans HTML-formatted text fields across a Drupal 10/11 site – currently nodes, custom block content, taxonomy terms, and comments – for hard-coded links to files in the public or private file systems. If a link matches a managed file, the module will add an entry to Drupal’s file_usage table (just as if the file were referenced via a File or Media field) so that the file is not treated as orphaned. This helps maintain correct file usage counts and prevents accidental deletion of files that are still in use.

Features

Installation

  1. Download the module: Install the filelink_usage module as you would any Drupal module. If the module is available via Composer, run composer require drupal/filelink_usage. Otherwise, download or copy the module’s code into your Drupal installation (e.g. under modules/custom/filelink_usage). The module requires PHP 8.1+ and is compatible with Drupal 10 and 11.
  2. Enable the module: Enable Filelink Usage on your site either through the Extend admin UI or with Drush:

  3. Run database updates: If installing on an existing site, run the update script to set up the required database tables. For example:

    This will create the custom tables (filelink_usage_matches and filelink_usage_scan_status) used to store link matches and scan timestamps.

  4. Configure settings: After enabling, visit Configuration → Content Authoring → Filelink Usage (or run drush cedit filelink_usage.settings) to review module settings as described below.

Configuration

On the settings page, you can adjust how and when the scanner runs:

These configurations let you balance performance with immediacy. For example, on a large site you might set a weekly or monthly cron scan interval to gradually cover all content, whereas a smaller site could scan every cron run. Verbose logging (verbose_logging) can be toggled as needed to trace the module’s actions.

Usage

Once installed and configured, Filelink Usage works mostly behind the scenes to keep file usage up-to-date. Typical usage scenarios include:

Usage Examples

Testing

Kernel and unit tests are located under tests/src. Install the development dependencies first and run PHPUnit using the included configuration file.

These tests verify the scanner hooks and overall module behaviour.

Cron Behavior

Drupal’s Cron plays a key role in ongoing maintenance of file link usage data. On each cron run, filelink_usage checks if any content needs to be rescanned based on the configured frequency:

The cron routine itself runs in three distinct scans:

  1. Populate matches – eligible entities are rendered and file links are recorded in the filelink_usage_matches table without touching file_usage.
  2. Record usage – any links from the matches table that now reference real files are added to file_usage.
  3. Remove stale usage – usage rows that lack a corresponding match (because the link was removed) are deleted.

In summary, regular cron runs are recommended to catch any file links that might have been missed or that become valid later (such as files that are uploaded after content was created). Adjust the Cron scan frequency setting to control this behavior. For most sites the default (yearly per node) is conservative; if you prefer more frequent checking, set a smaller interval like weekly or daily, with the understanding that each interval’s cron run will add some overhead by scanning older content.

Cache Clearing Behavior

To make file usage updates visible immediately without hurting performance, Filelink Usage employs targeted cache invalidation:

If you are integrating with other systems that display file usage, note that you might want to use Drupal’s cache tags (e.g. attach the file:{fid} cache tag to any custom block that shows file usage info) so that it clears when Filelink Usage updates that file.

Architecture and Internals

The module’s architecture is designed for clarity and extensibility. Key components include:

By structuring the module this way, it remains robust against Drupal core changes and can be extended. Developers could, for instance, swap in a different link-detection regex or support additional file URL patterns by altering the Scanner service, without affecting the rest of the system.

Use Cases

This module is useful in a variety of situations to ensure file references are properly tracked:

Troubleshooting

Having issues or unexpected results with Filelink Usage? Consider these tips:

By following these troubleshooting steps and best practices, you can ensure that Filelink Usage continues to operate smoothly and that your file usage data remains accurate.

Status

Project Status: This module is under active development and is being used to manage file usage on Drupal 10/11 sites. The feature set has recently expanded (scanning multiple entity types (nodes, custom block content, taxonomy terms, comments), deduplication improvements, etc.), and it is considered stable for production use, although further testing and feedback are welcome. Always back up your database before widespread usage, and consider testing on a staging environment if you have a very large site.

Contributions in the form of bug reports, feature requests, and patches are appreciated. If you encounter an issue or have ideas for improvement, please open an issue in the project repository.

License

This project is licensed under the GNU General Public License, version 2 or later. All contributions will be released under the same license. Use, share, and modify freely, but provide attribution and share improvements. Happy coding!


All versions of filelink_usage with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package dbrabon/filelink_usage contains the following files

Loading the files please wait ...