Apply suggestions from code review

Co-authored-by: Hypolite Petovan <hypolite@mrpetovan.com>
pull/1180/head
Michael Vogel 2021-10-03 20:58:52 +02:00 committed by GitHub
parent deb4f8d9ef
commit 674249ccfc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 10 deletions

View File

@ -687,12 +687,10 @@ function pumpio_sync(App $a)
Logger::notice('pumpio: cron_start');
$pconfigs = DBA::selectToArray('pconfig', ['cat' => 'pumpio', 'k' => 'mirror', 'v' => '1']);
if (DBA::isResult($pconfigs)) {
foreach ($pconfigs as $rr) {
Logger::notice('pumpio: mirroring user '.$rr['uid']);
pumpio_fetchtimeline($a, $rr['uid']);
}
}
$abandon_days = intval(DI::config()->get('system', 'account_abandon_days'));
if ($abandon_days < 1) {
@ -702,7 +700,6 @@ function pumpio_sync(App $a)
$abandon_limit = date(DateTimeFormat::MYSQL, time() - $abandon_days * 86400);
$pconfigs = DBA::selectToArray('pconfig', ['cat' => 'pumpio', 'k' => 'import', 'v' => '1']);
if (DBA::isResult($pconfigs)) {
foreach ($pconfigs as $rr) {
if ($abandon_days != 0) {
if (DBA::exists('user', ["uid = ? AND `login_date` >= ?", $rr['uid'], $abandon_limit])) {
@ -727,7 +724,6 @@ function pumpio_sync(App $a)
DI::pConfig()->set($rr['uid'], 'pumpio', 'contact_check', time());
}
}
}
Logger::notice('pumpio: cron_end');

View File

@ -135,7 +135,7 @@ function windowsphonepush_settings(&$a, &$s)
function windowsphonepush_cron()
{
// retrieve all UID's for which the addon windowsphonepush is enabled and loop through every user
$pconfigs = DBA::selectToArray('pconfig', ['cat' => 'windowsphonepush', 'k' => 'enable', 'v' => true]);
$pconfigs = DBA::selectToArray('pconfig', ['uid'], ['cat' => 'windowsphonepush', 'k' => 'enable', 'v' => true]);
foreach ($pconfigs as $rr) {
// load stored information for the user-id of the current loop
$device_url = DI::pConfig()->get($rr['uid'], 'windowsphonepush', 'device_url');
@ -399,7 +399,7 @@ function windowsphonepush_updatesettings()
// the user on the Windows Phone device and that device url is no longer true for the other user, so we
// et the device_url for the OTHER user blank (should normally not occur as App should include User/server
// in url request to Microsoft Push Notification server)
$pconfigs = DBA::selectToArray('pconfig', ["`uid` != ? AND `cat` = ? AND `k` = ? AND `v` = ?", local_user(), 'windowsphonepush', 'device_url', $device_url]);
$pconfigs = DBA::selectToArray('pconfig', ['uid'], ["`uid` != ? AND `cat` = ? AND `k` = ? AND `v` = ?", local_user(), 'windowsphonepush', 'device_url', $device_url]);
foreach ($pconfigs as $rr) {
DI::pConfig()->set($rr['uid'], 'windowsphonepush', 'device_url', '');
Logger::notice("WARN: the sent URL was already registered with user '" . $rr['uid'] . "'. Deleted for this user as we expect to be correct now for user '" . local_user() . "'.");