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)

screenshot

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

Issue fork site_audit-3331602

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

irinaz created an issue. See original summary.

irinaz’s picture

Issue summary: View changes
StatusFileSize
new134.13 KB
new30.42 KB
new311.3 KB
irinaz’s picture

Issue summary: View changes
jon pugh’s picture

Issue tags: +Soft Landing Initiati
Related issues: +#3326092: Site Audit 4.x

I agree on keeping 7.x supported for these reasons.

Very nice to hear about the Soft Landing initiative!

I am the new maintainer of the 4.x version which is Drupal 8+, but I'm here to help figure this out.

This is relevant to 4.x because I am adding a Site Audit Server that can receive Site Audit reports from another site and save them.

We will want to ensure the server can also receive reports from a D7 site.

irinaz’s picture

Title: Add Web UI to view site audit data in browser » Port Web UI to D7 to support migration off D7
irinaz’s picture

Issue tags: -Soft Landing Initiati +Soft Landing Initiative, +GlobalContributionWeekend2023
gambry’s picture

Adding the correct tag for Drupal Global Contribution Weekend 2023.

norman.lol’s picture

Issue tags: -GlobalContributionWeekend2023
avpaderno’s picture

Issue tags: -Soft Landing Initiative
irinaz’s picture

Issue tags: +Needs backport to D7
irinaz’s picture

Issue summary: View changes
StatusFileSize
new608.11 KB
keiserjb’s picture

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.

irinaz’s picture

@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’s picture

Title: Port Web UI to D7 to support migration off D7 » [Meta] Port Web UI to D7 to support migration off D7

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

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

keiserjb’s picture

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

devkinetic’s picture

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.

irinaz’s picture

This is fantastic!! Thank you so much!!

cyu’s picture

@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.

avpaderno’s picture

devkinetic’s picture

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.

irinaz’s picture

@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 :)

cyu’s picture

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.

irinaz’s picture

@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!

irinaz’s picture

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.

cyu’s picture

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.

cyu’s picture

@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.

irinaz’s picture

@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!!!

irinaz’s picture

@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.

jon pugh’s picture

Status: Active » Needs review

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.

irinaz’s picture

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

irinaz’s picture

Status: Needs review » Reviewed & tested by the community

  • Jon Pugh committed 179e38e2 on 7.x-2.x authored by irinaz
    Issue #3331602 by Jon Pugh, cYu, devkinetic, irinaz, apaderno, keiserjb...
jon pugh’s picture

Nice work, everyone.

keiserjb’s picture

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.

jon pugh’s picture

Status: Reviewed & tested by the community » Fixed

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!

keiserjb’s picture

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 and it also needs to move into Backdrop Contrib.

Status: Fixed » Closed (fixed)

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