Piwik\Plugins\UsersManager\UsersManager::recordAdminUsersInCache PHP Method

recordAdminUsersInCache() public method

Hooks when a website tracker cache is flushed (website/user updated, cache deleted, or empty cache) Will record in the tracker config file the list of Admin token_auth for this website. This will be used when the Tracking API is used with setIp(), setForceDateTime(), setVisitorId(), etc.
public recordAdminUsersInCache ( &$attributes, $idSite ) : void
$attributes
$idSite
return void
    public function recordAdminUsersInCache(&$attributes, $idSite)
    {
        // add the 'hosts' entry in the website array
        $model = new Model();
        $logins = $model->getUsersLoginWithSiteAccess($idSite, 'admin');
        if (empty($logins)) {
            return;
        }
        $users = $model->getUsers($logins);
        $tokens = array();
        foreach ($users as $user) {
            $tokens[] = $user['token_auth'];
        }
        $attributes['admin_token_auth'] = $tokens;
    }