[Meta] Port Web UI to D7 to support migration off D7

Created on 6 January 2023, almost 2 years ago
Updated 19 July 2023, over 1 year ago

Problem/Motivation

Support owners of current D7 sites in moving off Drupal 7 before final Drupal 7's End-of-Life date . Site audit is first step in migration off D7. Providing results of site audit in web UI will decrease cost of migration for site owners and communication managers. This issues is part of Drupal 7 soft landing initiative

Proposed resolution

Backport UI implemented for D8/9/10 (/admin/reports/site-audit)

The following reports are top priority

  • extensions / modules ( contrib / custom / need security updates)
  • content types (total number, fields per content type)
  • content nodes (total number of nodes by type, dates first and last created/updated)
  • blocks (total number, by type - views, from module, drupal basic blocks, beans)
  • views
  • users

Remaining tasks

User interface changes

API changes

Data model changes

Feature request
Status

Fixed

Version

1.0

Component

User interface

Created by

🇺🇸United States irinaz

Live updates comments and jobs are added and updated live.
  • Needs backport to D7

    After being applied to the 8.x branch, it should be considered for backport to the 7.x branch. Note: This tag should generally remain even after the backport has been written, approved, and committed.

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.

  • 🇮🇹Italy gambry Milan

    Adding the correct tag for Drupal Global Contribution Weekend 2023.

  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • 🇺🇸United States keiserjb

    Interested in trying to get this working because it would probably help out the other project I work on if I could port a module with a UI.

  • 🇺🇸United States irinaz

    @keiserjb, let me know if there is anything that will make it easier for you to get started :). Also here is related session on May 12 https://webcamp.stanford.edu/session/site-audit-4-track-your-drupal-site...

  • @irinaz opened merge request.
  • First commit to issue fork.
  • First commit to issue fork.
  • 🇺🇸United States keiserjb

    I left before the end yesterday. How far did you guys actually get and where did the code you were working on go?

  • 🇺🇸United States devkinetic

    I have the latest version on my laptop, and will be pushing it up in the morning. We now need a settings page to mirror the options from the drush command and then to rework the check and report classes to work outside of drush.

    As of now, it's a full fledged module with the addition of the info file metadata and module file so it shows up under manage extensions, and we have the actual report route showing a list of the reports. Once the classes are refactored we can uncomment the final code and it should work.

    I did have an idea on how to easily detect drush execution vs the UI so we can get the existing code to work with minimal effort, and I'm going to be testing that out hopefully tomorrow if not next week.

  • 🇺🇸United States irinaz

    This is fantastic!! Thank you so much!!

  • 🇺🇸United States cYu

    @devkinetic on the "minimal effort" path, I was wondering how it would look to wrap all of the drush commands that are in use in the module, so building off of how Jon had something like:

    if (!function_exists('dt')) {
      function dt($text) {
        return t($text);
      }
    }
    

    We'd also have stuff like:

    if (!function_exists('drush_set_error')) {
      function drush_set_error($message, $type = NULL) {
        drupal_set_message($message, 'error');
      }
    }
    

    And then to start we could have something like:

    if (!function_exists('drush_parse_command')) {
      function drush_parse_command() {
        return ['command' => 'audit all'];
      }
    }
    

    which could probably be altered a bit to pull settings from a configuration page and give a subset of the full audit.

    Then for stuff like drush_command_invoke_all_ref(), outside of the drush environment we could wrap that, but not have any logic since it won't be applicable to the web ui.

    If that's possible, we may not need to touch much (or anything) outside of the main .module file, which would mean we could be pretty sure of not breaking any of the existing drush generated reports. While this isn't a great solution, it could be a fit for the short term task of adding something to Drupal 7 in order to help get people off of Drupal 7.

  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • 🇺🇸United States devkinetic

    I agree that would be the easiest path to get things working.

    TODO:
    - Add settings page
    - Add wrapper functions around drush calls
    - Develop a mapping function for usage of settings
    - Update readme
    - consider adding dependencies to info from composer file

    TBD:
    - Backporting of functionality from newer versions of the module.

  • 🇺🇸United States irinaz

    @devkinetic, thank you! I tested this branch and I am ready to update readme for 7.x branch to indicate that now there is a web UI in Reports section to begin with.
    Looking forward for other features coming in this UI :)

  • 🇺🇸United States cYu

    I had a little time tonight to push a proof of concept for wrapping all of the drush functions. The report page will now generate reports without errors, though a lot of the wrapped drush functions aren't returning values equal to the drush equivalents so those still need improved before the reports can be trusted. I also hit some issues with the best practices report that I didn't have time to solve, so I've excluded that one for now.

  • 🇺🇸United States irinaz

    @cYu, thank you so much - this is super cool, I can see page now with some data. Yes, I see all the errors as well, but this is already huge progress! thank you!

  • 🇺🇸United States irinaz

    I installed the module, and I can see the first results, but it seems that my instance (on Pantheon) returns
    drush_get_option('html') == FALSE
    What should I do to make this option TRUE so I can see the correct formatting? Many thanks in advance.

  • 🇺🇸United States cYu

    I'm working on this a bit from Drupalcamp Asheville, setting that HTML option improves the readability and I've added a small config page to more easily debug individual reports.

  • 🇺🇸United States cYu

    @irinaz can you give the latest code a try and report back on which reports are working differently for you in the webui than they do via the drush command? i think there are a few more adjustments needed to the wrapped drush functions.

  • 🇺🇸United States irinaz

    @cYu, I will work on this today and should have test results by 2 pm Pacific, it would be FANTASTIC to announce it at Drupalcamp Asheville!!!

  • 🇺🇸United States irinaz

    @cYu, here are my testing results

    • /admin/reports/site-audit/configuration works great, I can enable/disable report types. There are only four now, comparing to the previous version
    • On the audit page I see the following errors:
      Notice: Undefined index: audit_front_end in SiteAuditReportAbstract->getCheckNames() (line 344 of /code/sites/all/modules/site_audit-3331602/Report/Abstract.php).
      Notice: Trying to access array offset on value of type null in SiteAuditReportAbstract->getCheckNames() (line 349 of /code/sites/all/modules/site_audit-3331602/Report/Abstract.php).
      Warning: Invalid argument supplied for foreach() in SiteAuditReportAbstract->getCheckNames() (line 349 of /code/sites/all/modules/site_audit-3331602/Report/Abstract.php).
      Warning: Invalid argument supplied for foreach() in SiteAuditReportAbstract->toHtml() (line 242 of /code/sites/all/modules/site_audit-3331602/Report/Abstract.php).
      Notice: Trying to get property 'score' of non-object in SiteAuditCheckInsightsAnalyze->calculateScore() (line 279 of /code/sites/all/modules/site_audit-3331602/Check/Insights/Analyze.php).
      Notice: Trying to get property 'score' of non-object in SiteAuditCheckInsightsAnalyze->calculateScore() (line 283 of /code/sites/all/modules/site_audit-3331602/Check/Insights/Analyze.php).
      Notice: Trying to get property 'pageStats' of non-object in SiteAuditCheckInsightsAnalyze->getResultPass() (line 59 of /code/sites/all/modules/site_audit-3331602/Check/Insights/Analyze.php).
      Warning: Invalid argument supplied for foreach() in SiteAuditCheckInsightsAnalyze->getResultPass() (line 59 of /code/sites/all/modules/site_audit-3331602/Check/Insights/Analyze.php).
      Notice: Trying to get property 'formattedResults' of non-object in SiteAuditCheckInsightsAnalyze->getResultPass() (line 99 of /code/sites/all/modules/site_audit-3331602/Check/Insights/Analyze.php).
      Notice: Trying to get property 'ruleResults' of non-object in SiteAuditCheckInsightsAnalyze->getResultPass() (line 99 of /code/sites/all/modules/site_audit-3331602/Check/Insights/Analyze.php).
      Warning: Invalid argument supplied for foreach() in SiteAuditCheckInsightsAnalyze->getResultPass() (line 99 of /code/sites/all/modules/site_audit-3331602/Check/Insights/Analyze.php).
      Notice: Undefined offset: 0 in SiteAuditCheckCodebaseSizeFiles->calculateScore() (line 68 of /code/sites/all/modules/site_audit-3331602/Check/Codebase/SizeFiles.php).

      let me know if this is helpful.

  • Status changed to Needs review over 1 year ago
  • 🇺🇸United States Jon Pugh Newburgh, NY

    Site Audit 7.x-2.x is ready for review!

    I've pushed many fixes to the Merge Request:

    1. Removal of drush_X calls from all SiteAudit Checks. Replaced with ::getOption() method.
    2. Moved shared things to autoload file.
    3. Fixed all reports and checks, including Google PageSpeed.
    4. Fixed Menu tabs.
    5. Improved Settings page, added Google PageSpeed URL and API key fields.
    6. Removed boatloads of warnings for missing things.

    I believe this is ready to merge.

    If someone could give it a test to expose anything major I might have missed, please do and set to RTBC!

    Thanks to Fibonacci Web Studio for sponsoring this work.

  • 🇺🇸United States irinaz

    I have tested this version and it looks very good! @jonpugh, I think that we should merge it

  • Status changed to RTBC over 1 year ago
  • 🇺🇸United States Jon Pugh Newburgh, NY

    Nice work, everyone.

  • 🇺🇸United States keiserjb

    This is great. I put the release on a D7 site and it's really going to help with the upgrade. Sorry I did not know how to help more.

  • Status changed to Fixed over 1 year ago
  • 🇺🇸United States Jon Pugh Newburgh, NY

    Fixed.

    Please no apologies, @keiserjb!

    You are testing the module in real life. You'll likely submit bug reports if you find them. That is incredibly valuable.

    Even just showing interest in the module is motivating for developers.

    Keep it up!

  • 🇺🇸United States keiserjb

    Well, I ran the new branch through the Coder Upgrade module https://backdropcms.org/project/coder_upgrade. I then messed around with it a little and I think it works in Backdrop.

    https://github.com/keiserjb/site_audit

    We'd need to make it work with Bee instead of Drush. I can loop in our Bee maintainers.

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

Production build 0.71.5 2024