mirror of
https://github.com/friendica/friendica
synced 2025-04-27 10:30:10 +00:00
Some easy to replace "q" calls have been replaced by "DBA" calls (#5632)
* Some easy to replace "q" calls have been replaced by "DBA" calls * Simplified the GUID creation * And one in the API ... * And OStatus has got some DBA calls more * Just some more replaced database calls * The event query is now simplified * Events are now shown again * subthread is now using the DBA calls as well * Some more replaced database calls * And some more replaced database calls and prevented notices * Better use gravity * Some more replaced database stuff * Some more replaced database calls in DFRN.php * The gcontact class now has got the new DBA functions as well * The Contact class is now changed to new database functions as well * Small correction * We can now delete without cascade * One more functionality is safe for future changes
This commit is contained in:
parent
dfe4413463
commit
7f3fb34c24
21 changed files with 275 additions and 501 deletions
|
@ -124,12 +124,10 @@ class Profile
|
|||
// fetch user tags if this isn't the default profile
|
||||
|
||||
if (!$pdata['is-default']) {
|
||||
$x = q(
|
||||
"SELECT `pub_keywords` FROM `profile` WHERE `uid` = %d AND `is-default` = 1 LIMIT 1",
|
||||
intval($pdata['profile_uid'])
|
||||
);
|
||||
if ($x && count($x)) {
|
||||
$pdata['pub_keywords'] = $x[0]['pub_keywords'];
|
||||
$condition = ['uid' => $pdata['profile_uid'], 'is-default' => true];
|
||||
$profile = DBA::selectFirst('profile', ['pub_keywords'], $condition);
|
||||
if (DBA::isResult($profile)) {
|
||||
$pdata['pub_keywords'] = $profile['pub_keywords'];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -641,37 +639,26 @@ class Profile
|
|||
$bd_format = L10n::t('g A l F d'); // 8 AM Friday January 18
|
||||
$classtoday = '';
|
||||
|
||||
$s = DBA::p(
|
||||
"SELECT `event`.*
|
||||
FROM `event`
|
||||
INNER JOIN `item`
|
||||
ON `item`.`uid` = `event`.`uid`
|
||||
AND `item`.`parent-uri` = `event`.`uri`
|
||||
WHERE `event`.`uid` = ?
|
||||
AND `event`.`type` != 'birthday'
|
||||
AND `event`.`start` < ?
|
||||
AND `event`.`start` >= ?
|
||||
AND `item`.`author-id` = ?
|
||||
AND (`item`.`verb` = ? OR `item`.`verb` = ?)
|
||||
AND `item`.`visible`
|
||||
AND NOT `item`.`deleted`
|
||||
ORDER BY `event`.`start` ASC",
|
||||
local_user(),
|
||||
DateTimeFormat::utc('now + 7 days'),
|
||||
DateTimeFormat::utc('now - 1 days'),
|
||||
public_contact(),
|
||||
ACTIVITY_ATTEND,
|
||||
ACTIVITY_ATTENDMAYBE
|
||||
);
|
||||
$condition = ["`uid` = ? AND `type` != 'birthday' AND `start` < ? AND `start` >= ?",
|
||||
local_user(), DateTimeFormat::utc('now + 7 days'), DateTimeFormat::utc('now - 1 days')];
|
||||
$s = DBA::select('event', [], $condition, ['order' => ['start']]);
|
||||
|
||||
$r = [];
|
||||
|
||||
if (DBA::isResult($s)) {
|
||||
$istoday = false;
|
||||
$total = 0;
|
||||
|
||||
while ($rr = DBA::fetch($s)) {
|
||||
$condition = ['parent-uri' => $rr['uri'], 'uid' => $rr['uid'], 'author-id' => public_contact(),
|
||||
'activity' => [Item::activityToIndex(ACTIVITY_ATTEND), Item::activityToIndex(ACTIVITY_ATTENDMAYBE)],
|
||||
'visible' => true, 'deleted' => false];
|
||||
if (!Item::exists($condition)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strlen($rr['summary'])) {
|
||||
$total ++;
|
||||
$total++;
|
||||
}
|
||||
|
||||
$strt = DateTimeFormat::convert($rr['start'], $rr['adjust'] ? $a->timezone : 'UTC', 'UTC', 'Y-m-d');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue