function site_audit_drush_command in Site Audit 8.2
Same name and namespace in other branches
- 7 site_audit.drush.inc \site_audit_drush_command()
Implements hook_drush_command().
File
- ./
site_audit.drush.inc, line 56 - Drupal site auditing commands.
Code
function site_audit_drush_command() {
$items = array();
$vendor_options = array(
'vendor' => array(
'description' => dt("If used, will adjust recommendations based on a Vendor's specific needs. Currently supported: pantheon"),
'example-value' => dt('pantheon'),
'value' => 'required',
),
);
$options_all = array_merge(site_audit_common_options(), $vendor_options);
$items['audit-best-practices'] = array(
'description' => dt('Audit best practices used.'),
'callback' => 'drush_site_audit_generic_callback',
'aliases' => array(
'abp',
),
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_FULL,
'options' => array_merge(site_audit_common_options(), $vendor_options),
'checks' => array(
'Fast404',
'Sites',
'Multisite',
'Settings',
'Services',
'SitesDefault',
'SitesSuperfluous',
'FolderStructure',
),
);
$items['audit-cache'] = array(
'description' => dt("Audit Drupal's caching settings."),
'aliases' => array(
'ac',
),
'callback' => 'drush_site_audit_generic_callback',
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_FULL,
'options' => array_merge(site_audit_common_options(), $vendor_options),
'checks' => array(
'AllBackends',
'DefaultBackends',
'UsedBackends',
'PageExpire',
'PreprocessCss',
'PreprocessJs',
),
);
$options_codebase = array(
'custom-code' => array(
'description' => dt('Comma separated the directories/files containing custom code.'),
'example-value' => dt('./modules/custom,./modules/features,./code.php'),
'value' => 'required',
),
'phploc-names' => array(
'description' => dt('A comma-separated list of file names for phploc to check'),
'example-value' => dt('*.php,*.module,*.install,*.test,*.inc,*.profile,*.theme'),
'value' => 'required',
),
'phploc-names-exclude' => array(
'description' => dt('A comma-separated list of file names for phploc to exclude'),
'example-value' => dt('*.features.*,*_default.inc,*.ds.inc,*.strongarm.inc,*.panelizer.inc,*_defaults.inc,*.box.inc,*.context.inc,*displays.inc'),
'value' => 'required',
),
'phpmd-ruleset' => array(
'description' => dt('phpmd rules to be used, can also be an xml file with custom ruleset'),
'example-value' => dt('codesize,naming,design,unusedcode'),
'value' => 'required',
),
'phpmd-suffixes' => array(
'description' => dt('Comma-separated string of valid source code filename extensions checked by phpmd'),
'example-value' => dt('.php,.module,.install,.test,.inc,.profile,.theme'),
'value' => 'required',
),
'phpmd-exclude' => array(
'description' => dt('Comma-separated string of patterns that are used to ignore directories by phpmd'),
'example-value' => dt('*.features.*,*_default.inc,*.ds.inc,*.strongarm.inc,*.panelizer.inc,*_defaults.inc,*.box.inc,*.context.inc,*displays.inc'),
'value' => 'required',
),
'phpmd-minimumpriority' => array(
'description' => dt('The phpmd rule priority threshold; rules with lower priority than they will not be used; between 1 and 5'),
'example-value' => dt('3'),
'value' => 'required',
),
'phpmd-strict' => array(
'description' => dt('Phpmd also reports those nodes with a @SuppressWarnings annotation'),
'value' => 'optional',
),
'phpcpd-names' => array(
'description' => dt('A comma-separated list of file names for phpcpd to check'),
'example-value' => dt('*.php,*.module,*.install,*.test,*.inc,*.profile,*.theme'),
'value' => 'required',
),
'phpcpd-names-exclude' => array(
'description' => dt('A comma-separated list of file names for phpcpd to exclude'),
'example-value' => dt('*.features.*,*_default.inc,*.ds.inc,*.strongarm.inc,*.panelizer.inc,*_defaults.inc,*.box.inc,*.context.inc,*displays.inc'),
'value' => 'required',
),
'phpdcd-names' => array(
'description' => dt('A comma-separated list of file names for phpdcd to check'),
'example-value' => dt('*.php,*.module,*.install,*.test,*.inc,*.profile,*.theme'),
'value' => 'required',
),
'phpdcd-names-exclude' => array(
'description' => dt('A comma-separated list of file names for phpdcd to exclude'),
'example-value' => dt('*.features.*,*_default.inc,*.ds.inc,*.strongarm.inc,*.panelizer.inc,*_defaults.inc,*.box.inc,*.context.inc,*displays.inc'),
'value' => 'required',
),
'phpcs-extensions' => array(
'description' => dt('A comma separated list of file extensions to be checked by phpcs'),
'example-value' => dt('php,module,inc,install,test,profile,theme,css,info,txt'),
'value' => 'required',
),
'phpcs-ignore' => array(
'description' => dt('A comma separated list of patterns for phpcs to ignore files and directories'),
'example-value' => dt('*/modules/features/'),
'value' => 'required',
),
'phpcs-standard' => array(
'description' => dt('Name or absolute path of the coding standard to be used by phpcs'),
'example-value' => dt('~/.drush/site_audit/vendor/drupal/coder/coder_sniffer/Drupal'),
'value' => 'required',
),
);
$items['audit-codebase'] = array(
'description' => dt('Audit the codebase.'),
'aliases' => array(
'acb',
),
'callback' => 'drush_site_audit_generic_callback',
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_FULL,
'options' => array_merge(site_audit_common_options(), $options_codebase),
'checks' => array(
'SizeFiles',
'SizeAll',
'ManagedFileCount',
'ManagedFileSize',
'GitContributions',
'PhpLOC',
'PhpMessDetection',
'PhpCodeSniffer',
'PhpCopyPasteDetection',
'PhpDeadCodeDetection',
),
);
$items['audit-content'] = array(
'description' => dt('Audit content.'),
'aliases' => array(
'acn',
),
'callback' => 'drush_site_audit_generic_callback',
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_FULL,
'options' => site_audit_common_options(),
'checks' => array(
'ContentEntityTypes',
'ContentEntityTypesUnused',
'DuplicateTitles',
'Taxonomy',
'Vocabularies',
'VocabulariesUnused',
'FieldEnabled',
'FieldCount',
'FieldInstances',
'FieldsUnused',
),
);
$items['audit-cron'] = array(
'description' => dt('Audit cron.'),
'aliases' => array(
'acr',
),
'callback' => 'drush_site_audit_generic_callback',
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_FULL,
'options' => site_audit_common_options(),
'checks' => array(
'Enabled',
'Last',
),
);
$options_db = array(
'min_rows' => array(
'description' => dt('Minimum number of rows to check for. Defaults to 1000.'),
'example-value' => dt('1000'),
'value' => 'required',
),
);
$options_all = array_merge($options_all, $options_db);
$items['audit-database'] = array(
'description' => dt("Report information about a site's database."),
'aliases' => array(
'ad',
),
'callback' => 'drush_site_audit_generic_callback',
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_FULL,
'options' => array_merge(site_audit_common_options(), $options_db),
'checks' => array(
'Size',
'Collation',
'Engine',
'RowCount',
'Fragmentation',
),
);
$items['audit-extensions'] = array(
'description' => dt('Audit extensions (modules and themes).'),
'aliases' => array(
'ae',
),
'callback' => 'drush_site_audit_generic_callback',
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_FULL,
'options' => array_merge(site_audit_common_options(), $vendor_options),
'checks' => array(
'Count',
'Dev',
'Duplicate',
'Unrecommended',
),
);
$items['audit-extensions']['options']['extension_count'] = array(
'description' => dt('Specify threshold for average number of extensions'),
'example-value' => dt('150'),
'value' => 'required',
);
$options_fe = array(
'impact' => array(
'description' => dt('Only show results with an impact greater than what\'s specified. 3 is considered high impact.'),
'example-value' => dt('3'),
'value' => 'required',
),
'limit' => array(
'description' => dt('Limit the number of records shown for each item.'),
'example-value' => dt('3'),
'value' => 'required',
),
'wpt-key' => array(
'description' => dt('WebPageTest API Key - see http://www.webpagetest.org/getkey.php'),
'example-value' => dt('3'),
'value' => 'required',
),
'gi-key' => array(
'description' => dt('Google Code API Key - see https://developers.google.com/speed/docs/insights/v1/getting_started#auth'),
'value' => 'required',
),
'url' => array(
'description' => dt('Limit the number of records shown for each item.'),
'example-value' => dt('3'),
'value' => 'required',
),
);
$options_all = array_merge($options_all, $options_fe);
$items['audit-front-end'] = array(
'description' => dt("Analyze a site's front end performance."),
'aliases' => array(
'afe',
),
'callback' => 'drush_site_audit_generic_callback',
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_FULL,
'options' => array_merge(site_audit_common_options(), $options_fe),
'checks' => array(
'GooglePageSpeed',
'WebPageTest',
),
);
$items['audit-security'] = array(
'description' => dt('Audit a site for known security vulnerabilities.'),
'aliases' => array(
'asec',
),
'callback' => 'drush_site_audit_generic_callback',
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_FULL,
'options' => site_audit_common_options(),
'checks' => array(
'MenuRouter',
),
);
$items['audit-status'] = array(
'description' => dt("Audit Drupal's built-in status report."),
'aliases' => array(
'as',
),
'callback' => 'drush_site_audit_generic_callback',
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_FULL,
'options' => site_audit_common_options(),
'checks' => array(
'System',
),
);
$items['audit-users'] = array(
'description' => dt('Audit Users.'),
'aliases' => array(
'au',
),
'callback' => 'drush_site_audit_generic_callback',
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_FULL,
'options' => site_audit_common_options(),
'checks' => array(
'CountAll',
'CountBlocked',
'RolesList',
'WhoIsNumberOne',
'BlockedNumberOne',
),
);
$items['audit-views'] = array(
'description' => dt('Audit Views.'),
'aliases' => array(
'av',
),
'callback' => 'drush_site_audit_generic_callback',
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_FULL,
'options' => site_audit_common_options(),
'checks' => array(
'Enabled',
'Count',
'CacheResults',
'CacheOutput',
),
);
$items['audit-watchdog'] = array(
'description' => dt('Audit the database logs.'),
'aliases' => array(
'aw',
),
'callback' => 'drush_site_audit_generic_callback',
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_FULL,
'options' => array_merge(site_audit_common_options(), $vendor_options),
'checks' => array(
'Syslog',
'Enabled',
'Count',
'Age',
'404',
'Php',
),
);
$items['audit-all'] = array(
'description' => dt('Executes every Site Audit Report'),
'aliases' => array(
'aa',
),
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_FULL,
'options' => $options_all,
'reports' => array(
'BestPractices',
'Cache',
'Codebase',
'Content',
'Extensions',
'Cron',
'Database',
'Users',
'FrontEnd',
'Status',
'Watchdog',
'Views',
),
);
$items['site-audit-version'] = array(
'description' => dt('Show the Site Audit version.'),
'aliases' => array(
'sav',
),
'callback' => 'drush_site_audit_site_audit_version',
'bootstrap' => DRUSH_BOOTSTRAP_NONE,
);
return $items;
}