用户定时检测

@return bool
420072
public function check()
    {
        $this->goodPools = getInstance()->sysCache->get($this->name) ?? [];
        if (!$this->goodPools) {
            return false;
        }

        $nowPools = $this->getAllTargets();
        $newPools = array_keys($this->goodPools);
        $loses    = array_diff($nowPools, $newPools);

        if (!empty($loses)) {
            foreach ($loses as $lost) {
                $this->removeTarget($lost);
            }
            writeln('Redis Proxy Remove ( ' . implode(',', $loses) . ' ) from Cluster');
        }

        $adds = array_diff($newPools, $nowPools);
        if (!empty($adds)) {
            foreach ($adds as $add) {
                $this->addTarget($add, $this->pools[$add]);
            }
            writeln('Redis Proxy Add ( ' . implode(',', $adds) . ' ) into Cluster');
        }

        return true;
    }
596274
public function valid()
    {
        if (null === $this->currentDate) {
            return false;
        }
        if (!is_null($this->count)) {
            return $this->counter < $this->count;
        }

        return is_null($this->until) || $this->currentDate <= $this->until;
    }
940269
public function connect()
    {
        if ($this->isConnected) {
            return false;
        }

        if (!$this->pdo) {
            $this->beforeConnect && call_user_func($this->beforeConnect, $this);

            $dsn = $this->getDsn();
            $attrs = $this->attrs + array(
                PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
                PDO::ATTR_STRINGIFY_FETCHES => true,
                PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC
            );

            try {
                $this->pdo = new PDO($dsn, $this->user, $this->password, $attrs);
            } catch (\PDOException $e) {
                $this->connectFails && call_user_func($this->connectFails, $this, $e);
                throw $e;
            }

            $this->afterConnect && call_user_func($this->afterConnect, $this, $this->pdo);
        }

        $this->isConnected = true;

        return true;
    }
723139
public function delete() {
        global $DB;

        if (empty($this->id)) {
            debugging('Can not delete data object, no id!');
            return false;
        }

        $data = $this->get_record_data();

        if ($DB->delete_records($this->table, array('id'=>$this->id))) {
            $this->notify_changed(true);
            return true;

        } else {
            return false;
        }
    }
1087488
public function isSuccess()
	{
		$data = $this->getData();

		if (!$data) {
			return false;
		}

		if (isset($data['error'])) {
			return false;
		}

		return true;
	}
330888
public function current()
    {
        $keys = array_keys($this->items);

        return isset($keys[$this->counter]) ? $this->items[$keys[$this->counter]] : false;
    }
684227
public function delete(){
        if($this->beforeDelete()){
            $pkConditions = $this->buildPKConditions();
            if(false !== $rst = ($this->isNew() || $this->_db->builder()->delete($this->getTable(), $pkConditions[0], $pkConditions[1]))){
                $this->_data = array();
                $this->_dirty = array();
                $this->afterDelete();
                
                return $rst;
            }
        }
        
        return false;
    }
217674
public function remove()
    {
        if (!isset($this->_pkValue)) {
            return false;
        }
        if (self::delete($this->_pkValue) > 0) {
            $this->_pkValue = null;
            return true;
        }
        return false;
    }
905733
public function delete(): bool
    {
        $this->invokeHook("delete");

        if ($this->softDelete) {
            $val = $this->delValType === self::SDEL_VAL_TIMESTAMP
                ? ["func" => "NOW()"]
                : true;
            $status = $this->update([$this->delCol => $val]);
        } else {
            $query = $this->qBuilder->table($this->table)->delete();
            if (($status = $this->db->execute($query)) === false) {
                $this->error = $this->db->lastError();
            }
            $this->qBuilder->reset();
        }

        $this->invokeHook("delete", self::HOOK_AFTER);
        return $status;
    }
57657
public function isTracking()
    {
        if ($this->isTracking === false) {
            return false;
        }

        if (!$this->resqueInstance->redis->exists((string)$this)) {
            $this->isTracking = false;
            return false;
        }

        $this->isTracking = true;
        return true;
    }
1271736
public function delete()
	{
		if ($this->user_id <= 0)
		{
			return false;
		}

		$db = \App::get('db');

		if (empty($db))
		{
			return false;
		}

		if (!isset($this->user_id))
		{
			$db->setQuery("SELECT user_id FROM `#__users_password` WHERE user_id" . $db->quote($this->user_id) . ";");

			$this->__set('user_id', $db->loadResult());
		}

		if (empty($this->user_id))
		{
			return false;
		}

		$db->setQuery("DELETE FROM `#__users_password` WHERE user_id= " . $db->quote($this->user_id) . ";");

		$affected = 0;

		if ($db->query())
		{
			$affected = $db->getAffectedRows();
		}

		if ($affected > 0)
		{
			\Event::trigger('user.onAfterDeletePassword', array($this));
		}

		return true;
	}
1284950
public function valid()
	{
		if(!isset($this->lines[$this->position])){
			return false;
		}
		if(count($this->lines[$this->position])===0){
			return false;
		}
		return true;
	}
939886
public function clear(): bool
    {
        if (!empty($this->tag)) {
            // 指定标签清除
            foreach ($this->tag as $tag) {
                $this->clearTag($tag);
            }

            return true;
        }

        $this->writeTimes++;

        $files = (array) glob($this->options['path'] . ($this->options['prefix'] ? $this->options['prefix'] . DIRECTORY_SEPARATOR : '') . '*');

        foreach ($files as $path) {
            if (is_dir($path)) {
                $matches = glob($path . DIRECTORY_SEPARATOR . '*.php');
                if (is_array($matches)) {
                    array_map('unlink', $matches);
                }
                rmdir($path);
            } else {
                unlink($path);
            }
        }

        return true;
    }
959458
public function valid() {
    if (isset($this->resources[$this->position])) {
      return true;
    }
    $this->preloadPage();
    return isset($this->resources[$this->position]);
  }
948396
public function exists(){
		if($this->from_db)
		{
            foreach ($this->identifiers as $id) {
                if(!isset($this->properties[$id]))
                    return false;
            }
            return true;
       }
       return false;
    }
1137208
public function isTracking()
	{
		if($this->isTracking === false) {
			return false;
		}

		if(!Resque::redis()->exists((string)$this)) {
			$this->isTracking = false;
			return false;
		}

		$this->isTracking = true;
		return true;
	}
413520
public function start()
    {
        $try = $this->tryStart();
        $this->log('debug', 'try start', [
            'result' => (int) $try,
        ]);

        if (!$try) {
            return false;
        }

        $this->log('info', 'Job start');

        // 把进程ID和开始时间记录到上下文中
        $this->setContext(self::KEY_PROC_ID, posix_getpid());
        $this->setContext(self::KEY_PROC_TIME, time());
        $this->saveContext();

        // 执行任务逻辑
        try {
            $this->execute();
        } catch (\Exception $ex) {
            $this->log('error', 'Job execute error', [
                'error' => $ex->getMessage(),
            ]);

            return false;
        }

        $this->stop();

        return true;
    }