Created
September 23, 2014 20:09
-
-
Save albertvolkman/1603169239366c9e3291 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function getAllUuids($exclude_users) | |
{ | |
$this->uuidOnly = true; | |
$this->result = array(); | |
if (!$this->filters(self::DATABASE_MONGO)) { | |
// Searches SQL without mongo. | |
$this->loadSQLData(true, true); | |
} else { | |
// Filters mongo then searches SQL. | |
$this->getUsersMongoSQL(); | |
} | |
if (!empty($exclude_users)) { | |
$uuids = array_flip($this->result); | |
foreach ($exclude_users as $uuid) { | |
unset($uuids[$uuid]); | |
} | |
$this->result = array_keys($uuids); | |
} | |
return $this->result; | |
} | |
vs | |
public function getAllUsersUuids($exclude_uuids = array()) | |
{ | |
$this->result = array(); | |
$this->fields = array(); | |
// Perform mongo search. | |
$this->initMongoCursor(true); | |
// Process mongo query. | |
$this->processMongoResults(INF); | |
// Change uids to uuids. | |
$users = ConvertIds::userUidsToWebappUuids(array_keys($this->result)); | |
$flipped = array_flip($users); | |
foreach ($exclude_uuids as $exclude) { | |
unset($users[$flipped[$exclude]]); | |
} | |
// Return the output. | |
return $users; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment