Move mod/receive to src/Module/Diaspora/receive

- Added routes
- Make Diaspora::decode(Raw) more explicit
- Add new User::getByGuid() method
This commit is contained in:
Philipp Holzer 2019-10-20 13:00:08 +02:00
parent 49c05036ae
commit 7716374593
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90
6 changed files with 182 additions and 103 deletions

View file

@ -18,7 +18,6 @@ use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
use Friendica\Model\Photo;
use Friendica\Model\TwoFactor\AppSpecificPassword;
use Friendica\Object\Image;
use Friendica\Util\Crypto;
@ -105,6 +104,27 @@ class User
return DBA::selectFirst('user', $fields, ['uid' => $uid]);
}
/**
* Returns a user record based on it's GUID
*
* @param string $guid The guid of the user
* @param array $fields The fields to retrieve
* @param bool $active True, if only active records are searched
*
* @return array|boolean User record if it exists, false otherwise
* @throws Exception
*/
public static function getByGuid(string $guid, array $fields = [], bool $active = true)
{
if ($active) {
$cond = ['guid' => $guid, 'account_expired' => false, 'account_removed' => false];
} else {
$cond = ['guid' => $guid];
}
return DBA::selectFirst('user', $fields, $cond);
}
/**
* @param string $nickname
* @param array $fields