HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux WebLive 5.15.0-79-generic #86-Ubuntu SMP Mon Jul 10 16:07:21 UTC 2023 x86_64
User: ubuntu (1000)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/html/wpdeskera/wp-content/plugins/defender-security/extra/shared-tasks/wpmudev_lint.js
module.exports = function (grunt, wpmudev) {
	'use strict';

	var run_linter = function (cmd, done, fail, orig_args) {
		fail = !!fail;
		var task = (cmd || {}).cmd;
		if (grunt.task.exists(task)) {
			grunt.verbose.writeln("Has project-specific task " + task + ", defaulting to that");
			var args = Array.prototype.slice.call(orig_args || {}).map(function (a) { return ':' + a; });
			grunt.task.run(task + args.join(''));
			return done();
		}

		grunt.log.write("Attempting to lint via system " + task + "... ");
		var which = require('which').sync,
			has_binary = false
		;
		try {
			has_binary = !!which(task);
		} catch (e) { has_binary = false; }

		if (!has_binary) {
			grunt.log.writeln("SKIP".yellow);
			return done();
		}
		grunt.log.writeln("OK".green);

		grunt.util.spawn(cmd, function (error, result) {
			if (error) {
				(fail ? grunt.fail.fatal : grunt.log.error)("Linting failed".red);
			}
			done();
		});

	};

	grunt.registerTask('wpmudev_lint', function () {
		grunt.task.run('wpmudev_jshint');
		grunt.task.run('wpmudev_phpcs');
	});

	grunt.registerTask('wpmudev_phpcs', function () {
		var done = this.async(),
			files = grunt.file.expand({ filter: 'isFile' }, ['**/*.php'].concat(wpmudev.files.not_meta())),
			standard = grunt.file.exists('phpcs.ruleset.xml') ? ['--standard=phpcs.ruleset.xml'] : []
		;
		run_linter({
			cmd: 'phpcs',
			args: standard.concat(files),
			opts: { stdio: 'inherit' }
		}, done, true, arguments);
	});

	grunt.registerTask('wpmudev_jshint', function () {
		var done = this.async(),
			files = grunt.file.expand({ filter: 'isFile' }, ['**/*.js'].concat(wpmudev.files.not_meta()))
		;
		run_linter({
			cmd: 'jshint',
			args: files,
			opts: { stdio: 'inherit' }
		}, done, true, arguments);
	});

};