public function refreshCache() { /* Check if we need to check for updates */ $currenttime = time(); if ($this->_last_update + $this->_max_change_age > $currenttime) { return; } $params = array("userIp" => $this->processor->userip, "maxResults" => 500, "includeDeleted" => true, "includeSubscribed" => true); if ($this->getLastCacheId() === '') { $params['maxResults'] = 1; } else { $params['startChangeId'] = (string) ((int) $this->getLastCacheId() + 1); } $changes = $this->processor->getChanges($params); if ($changes !== false) { if ($this->getLastCacheId() === '') { $this->setLastCacheId($changes->getLargestChangeId()); $this->setLastUpdate(); } else { $this->processChanges($changes); $pageToken = $changes->getNextPageToken(); if ($pageToken) { $this->refreshCache(); } if (count($changes->getItems()) === 0) { $this->setLastCacheId($changes->getLargestChangeId()); $this->setLastUpdate(); } } } }
public function DeleteUserfolder($user_id) { $useyourdrivelists = get_option('use_your_drive_lists', array()); $updatelists = array(); foreach ($useyourdrivelists as $list) { if (isset($list['user_upload_folders']) && $list['user_upload_folders'] === 'auto') { $updatelists[] = $list; } } if (count($updatelists) > 0) { require_once 'includes/UseyourDrive.php'; $processor = new UseyourDrive(); foreach ($updatelists as $listoptions) { $deleted_user = get_user_by('id', $user_id); $userfoldername = strtr($processor->settings['userfolder_name'], array("%user_login%" => $deleted_user->user_login, "%user_email%" => $deleted_user->user_email, "%display_name%" => $deleted_user->display_name, "%ID%" => $deleted_user->ID)); $processor->userChangeFolder($listoptions, $userfoldername, false, true); } } }