@command doctor:check

@hidden
12352
public function doctorCheck() {
    $status = $this->getInspector()->getStatus();
    $this->printArrayAsTable($status);

    $checks = [
      AcsfCheck::class,
      BehatCheck::class,
      ComposerCheck::class,
      ConfigCheck::class,
      DbCheck::class,
      DevDesktopCheck::class,
      DrupalCheck::class,
      DrupalVmCheck::class,
      DrushCheck::class,
      FileSystemCheck::class,
      NodeCheck::class,
      PhpCheck::class,
      SettingsFilesCheck::class,
      SimpleSamlPhpCheck::class,
      WebUriCheck::class,
    ];

    $success = TRUE;
    foreach ($checks as $class) {
      /** @var \Acquia\Blt\Robo\Commands\Doctor\DoctorCheck $object */
      $object = new $class($this->getConfig(), $this->getInspector(), $this->getContainer()->get('executor'), $status);
      $object->performAllChecks();
      $this->problems = array_merge($this->problems, $object->getProblems());
      if ($object->wasErrorLogged()) {
        $success = FALSE;
      }
    }

    $this->printArrayAsTable($this->problems, ['Check', "Problem"]);
    if (!$success) {
      throw new BltException("BLT Doctor discovered one or more critical issues.");
    }
  }
984630
def mod_run_check(onlyif, unless, creates):
    '''
    
    '''
    cmd_kwargs = {'use_vt': False, 'bg': False}

    if onlyif is not None:
        if isinstance(onlyif, six.string_types):
            onlyif = [onlyif]
        if not isinstance(onlyif, list) \
                or not all(isinstance(x, six.string_types) for x in onlyif):
            return {'comment': 'onlyif is not a string or list of strings',
                    'skip_watch': True,
                    'result': True}
        for entry in onlyif:
            retcode = __salt__['cmd.retcode'](
                entry,
                ignore_retcode=True,
                python_shell=True)
            if retcode != 0:
                return {
                    'comment': 'onlyif command {0} returned exit code of {1}'
                               .format(entry, retcode),
                    'skip_watch': True,
                    'result': True
                }

    if unless is not None:
        if isinstance(unless, six.string_types):
            unless = [unless]
        if not isinstance(unless, list) \
                or not all(isinstance(x, six.string_types) for x in unless):
            return {'comment': 'unless is not a string or list of strings',
                    'skip_watch': True,
                    'result': True}
        for entry in unless:
            retcode = __salt__['cmd.retcode'](
                entry,
                ignore_retcode=True,
                python_shell=True)
            if retcode == 0:
                return {
                    'comment': 'unless command {0} returned exit code of {1}'
                               .format(entry, retcode),
                    'skip_watch': True,
                    'result': True
                }

    if creates is not None:
        if isinstance(creates, six.string_types):
            creates = [creates]
        if not isinstance(creates, list) \
                or not all(isinstance(x, six.string_types) for x in creates):
            return {'comment': 'creates is not a string or list of strings',
                    'skip_watch': True,
                    'result': True}
        if all(os.path.exists(x) for x in creates):
            return {'comment': 'All specified paths in \'creates\' '
                               'argument exist',
                    'result': True}

    # No reason to stop, return True
    return True
378530
function is_hidden($new = null)
    {
        if (isset($new) && ($this->_attributes['is_hidden'] != $new)){
            $this->change('is_hidden', (bool)$new);
        }
        return $this->_attributes['is_hidden'];
    }
749718
function isHidden(option) {
  return option.hidden === true ||
         (option.value != null && option.value.hidden);
}
1172390
def check_undelivered(to=None):
    
    failed_count = Dispatch.objects.filter(dispatch_status=Dispatch.DISPATCH_STATUS_FAILED).count()

    if failed_count:
        from sitemessage.shortcuts import schedule_email
        from sitemessage.messages.email import EmailTextMessage

        if to is None:
            admins = settings.ADMINS

            if admins:
                to = list(dict(admins).values())

        if to:
            priority = 999

            register_message_types(EmailTextMessage)

            schedule_email(
                'You have %s undelivered dispatch(es) at %s' % (failed_count, get_site_url()),
                subject='[SITEMESSAGE] Undelivered dispatches',
                to=to, priority=priority)

            send_scheduled_messages(priority=priority)

    return failed_count
779837
public function getHidden()
    {
        if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
            throw new \Parable\Console\Exception(
                "Hidden input is not supported on windows."
            );
        }

        $this->disableShowInput();
        $input = $this->get();
        $this->enableShowInput();

        return $input;
    }
1102192
function checkHostmask (hostmask, admin) {
            return names.every(function (name) {
                const result = admin[name].test(hostmask[name]);

                client.debug("PluginAdmin", format("%s: %s, %s (%s)",
                    name, hostmask[name], admin[name], result));

                return result;
            });
        }
1356431
def command?(cmd)
      !!system(cmd, out: ::File::NULL, err: ::File::NULL)
    end
1313584
def toggle_show_source(self, checked):
        """"""
        if checked:
            self.switch_to_plain_text()
        self.docstring = not checked
        self.force_refresh()
        self.set_option('rich_mode', not checked)
732798
def checkppolicy(self, **params):
        
        self._check_auth(must_admin=False, redir_login=False)
        keys = list(params.keys())
        if len(keys) != 1:
            cherrypy.response.status = 400
            return "bad argument"
        password = params[keys[0]]
        is_admin = self._check_admin()
        ret = self._checkppolicy(password)
        if ret['match']:
            cherrypy.response.status = 200
        else:
            cherrypy.response.status = 200
        return json.dumps(ret, separators=(',', ':'))
1115620
function (cmd,context,silent)
		{
			var ctx = (context!=undefined?context:this);
			try
			{
				return (function () {
					var result = eval(cmd);
					if (!silent)
						self.e.log&&self.e.log(util.inspect(result),'result');
					return result;
				}.bind(ctx))();
			} catch (e)
			{
				this.e.exception&&this.e.exception(e);
			}
			return;
		}
445641
def check( state_engine, nameop, block_id, checked_ops ):
    

    namespace_id = nameop['namespace_id']
    sender = nameop['sender']

    # must have been revealed
    if not state_engine.is_namespace_revealed( namespace_id ):
       log.warning("Namespace '%s' is not revealed" % namespace_id )
       return False

    # must have been sent by the same person who revealed it
    revealed_namespace = state_engine.get_namespace_reveal( namespace_id )
    if revealed_namespace['recipient'] != sender:
       log.warning("Namespace '%s' is not owned by '%s' (but by %s)" % (namespace_id, sender, revealed_namespace['recipient']))
       return False

    # can't be ready yet
    if state_engine.is_namespace_ready( namespace_id ):
       # namespace already exists
       log.warning("Namespace '%s' is already registered" % namespace_id )
       return False

    # preserve from revealed 
    nameop['sender_pubkey'] = revealed_namespace['sender_pubkey']
    nameop['address'] = revealed_namespace['address']

    # can commit imported nameops
    return True
603947
public String checkSanity() {
        for (CronTab tab : tabs) {
            String s = tab.checkSanity();
            if(s!=null)     return s;
        }
        return null;
    }
1263042
def cmdHELP(self, params):
        
        if params:
            cmd = params[0].upper()
            if self.COMMANDS.has_key(cmd):
                method = self.COMMANDS[cmd]
                doc = method.__doc__.split("\n")
                docp = doc[0].strip()
                docl = '\n'.join( [l.strip() for l in doc[2:]] )
                if not docl.strip():  # If there isn't anything here, use line 1
                    docl = doc[1].strip()
                self.writeline(
                    "%s %s\n\n%s" % (
                        cmd,
                        docp,
                        docl,
                    )
                )
                return
            else:
                self.writeline("Command '%s' not known" % cmd)
        else:
            self.writeline("Help on built in commands\n")
        keys = self.COMMANDS.keys()
        keys.sort()
        for cmd in keys:
            method = self.COMMANDS[cmd]
            if getattr(method, 'hidden', False):
                continue
            if method.__doc__ == None:
                self.writeline("no help for command %s" % method)
                return
            doc = method.__doc__.split("\n")
            docp = doc[0].strip()
            docs = doc[1].strip()
            if len(docp) > 0:
                docps = "%s - %s" % (docp, docs, )
            else:
                docps = "- %s" % (docs, )
            self.writeline(
                "%s %s" % (
                    cmd,
                    docps,
                )
            )
1085180
def check_cli_verbose(default=3):
    """"""
    args = sys.argv[1:]
    verbose = default + args.count("--verbose") - args.count("--quiet")

    for arg in args:
        if arg.startswith("-") and not arg.startswith("--"):
            verbose += arg[1:].count("v")
            verbose -= arg[1:].count("q")
    return verbose
649685
def has(cmd):
    
    helps = ["--help", "-h", "--version"]
    if "nt" == os.name:
        helps.insert(0, "/?")
    fakecmd = "fakecmd"
    cmderr = strerr(fakecmd).replace(fakecmd, cmd)
    for h in helps:
        hcmd = "%s %s" % (cmd, h)
        if 0 == silent(hcmd):
            return True
        if len(listout(hcmd)) > 0:
            return True
        if strerr(hcmd) != cmderr:
            return True
    return False
1288847
def cmd(send, msg, args):
    
    if not msg:
        send("Seen who?")
        return
    cmdchar, ctrlchan = args['config']['core']['cmdchar'], args['config']['core']['ctrlchan']
    last = get_last(args['db'], cmdchar, ctrlchan, msg)
    if last is None:
        send("%s has never shown their face." % msg)
        return
    delta = datetime.now() - last.time
    # We only need second-level precision.
    delta -= delta % timedelta(seconds=1)
    output = "%s was last seen %s ago " % (msg, delta)
    if last.type == 'pubmsg' or last.type == 'privmsg':
        output += 'saying "%s"' % last.msg
    elif last.type == 'action':
        output += 'doing "%s"' % last.msg
    elif last.type == 'part':
        output += 'leaving and saying "%s"' % last.msg
    elif last.type == 'nick':
        output += 'nicking to %s' % last.msg
    elif last.type == 'quit':
        output += 'quiting and saying "%s"' % last.msg
    elif last.type == 'kick':
        output += 'kicking %s for "%s"' % last.msg.split(',')
    elif last.type == 'topic':
        output += 'changing topic to %s' % last.msg
    elif last.type in ['pubnotice', 'privnotice']:
        output += 'sending notice %s' % last.msg
    elif last.type == 'mode':
        output += 'setting mode %s' % last.msg
    else:
        raise Exception("Invalid type.")
    send(output)