Automattic / vip-scanner

Deprecated: Scan all sorts of themes and files and things! Use PHPCS and the VIP coding standards instead
https://automattic.com
140 stars 51 forks source link

Async Scanning #73

Open joshbetz opened 10 years ago

joshbetz commented 10 years ago

As the number of tests increases (especially things like virus scanning and PHP Codesniffer tests) the time it takes to scan slows.

I think this can be addressed with some async (wp-cron) and some ajax scanning. Scanning asynchronously would also let us add an admin bar node that continuously updates with the number of blockers.

To start, I'd like to add cron that scans the code every X minutes. It would be nice to disable things like virus scans on "intermediate" scans and only run that before a theme submission or at least more infrequently. Eventually, it would be nice to have something running in a local environment (like Quickstart) that watches files and fires a scan of that specific file when it changes, which then updates the counts. It would probably be easiest just to make that a wp-cli command. We already have a command to scan themes, but I think the individual file is key because it would make this a lot faster if we can easily merge the results into previous results that we have stored somewhere.

Mobius5150 commented 10 years ago

I too have been thinking alot about doing scans via AJAX, and would be happy to lead that up once I'm done the analyzer stuff.

And why not store async scans in a postmeta for a CPT? Sure, we won't be creating a whole ton of posts (one for every theme/file being scanned?) but this completely avoids the max size for options which could be a problem.

It looks like it would be pretty easy to use inotify and potentially inotify-tools to watch the filesystem. This would just require adding a WP-CLI command to be run when a file is updated, as well as adding some logic to the Quickstart dashboard to setup the monitor through inotify.