Drush warning for aggregates

Created on 9 October 2018, over 5 years ago
Updated 14 July 2023, 12 months ago

When running Drush command for Advagg cron, there is an output which is missing number of total database entries removed:

Some old and unused aggregates were found. A total of database entries were removed.

Note part in bold, there is no number. And that trows following warning:

htmlspecialchars() expects parameter 1 to be string, array given bootstrap.inc:1843

Fix is in advagg.drush.inc file, line 181. Instead parameter $output[3], it should be $output[3][key($output[3])]['advagg_aggregates'], because $output[3] dump is:

Array 
(
    [sites/all/modules/genpass/genpass.css] => Array
        (
            [advagg_files] => 0
            [advagg_aggregates_versions] => 20
            [advagg_aggregates] => 714
        )

)

Attached a patch against D7-dev.

Output after patch:

Some old and unused aggregates were found. A total of 254 database entries were removed.

Edit: fixed one badly referenced array parameter and re-uploaded patch. Please ignore advagg_7x2x_20181009.patch and advagg_7x2x_20181009_02.patch. It was rushed thus quite faulty.

πŸ› Bug report
Status

Needs work

Version

2.0

Component

Code

Created by

πŸ‡·πŸ‡ΈSerbia milovan

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΈπŸ‡°Slovakia poker10

    Thanks for working on this.

    I am not sure if the patch is correct, because $output[3] can be an array with multiple filenames.

      $deleted[$filename] = array(
        'advagg_files' => $advagg_files_del,
        'advagg_aggregates_versions' => $advagg_aggregates_versions_del,
        'advagg_aggregates' => $advagg_aggregates_del,
      );
    

    So fixing the count for one specific filename (see $output[3][key($output[3])]['advagg_aggregates']) will not return the correct number. I think we need to loop thru this array and count it manually.

Production build 0.69.0 2024