Exemple #1
0
 public function __construct($config)
 {
     parent::__construct($config);
     if (isset($_SESSION['bot']) === true) {
         $this->botId = $_SESSION['bot'];
     }
 }
Exemple #2
0
        if ($line === 'FAILURES!') {
            $console->writeln('<error>' . $line . '</error>');
        } else {
            $console->writeln($line);
        }
    }
    end($output);
    if (prev($output) === 'FAILURES!') {
        exit;
    }
    unset($output);
    chdir(__DIR__);
}
$config = Cerberus::loadConfig();
if ($config['bot']['autostart']) {
    $db = new Db($config['db']);
    $db->connect();
    $bots = $db->getActiveBotList();
    $botCount = 0;
    if ($bots) {
        exec('ps -e | grep php', $output);
        $pidList = [];
        foreach ($output as $line) {
            $data = explode(' ', trim(preg_replace('/[ ]+/', ' ', $line)));
            if ($data[3] === 'php') {
                $pidList[] = $data[0];
            }
        }
        foreach ($bots as $bot) {
            if (in_array($bot['pid'], $pidList, true) === true) {
                $botCount++;