Apply suggestions from code review
Co-authored-by: Hypolite Petovan <hypolite@mrpetovan.com>
This commit is contained in:
parent
deb4f8d9ef
commit
674249ccfc
2 changed files with 6 additions and 10 deletions
|
@ -687,11 +687,9 @@ function pumpio_sync(App $a)
|
||||||
Logger::notice('pumpio: cron_start');
|
Logger::notice('pumpio: cron_start');
|
||||||
|
|
||||||
$pconfigs = DBA::selectToArray('pconfig', ['cat' => 'pumpio', 'k' => 'mirror', 'v' => '1']);
|
$pconfigs = DBA::selectToArray('pconfig', ['cat' => 'pumpio', 'k' => 'mirror', 'v' => '1']);
|
||||||
if (DBA::isResult($pconfigs)) {
|
foreach ($pconfigs as $rr) {
|
||||||
foreach ($pconfigs as $rr) {
|
Logger::notice('pumpio: mirroring user '.$rr['uid']);
|
||||||
Logger::notice('pumpio: mirroring user '.$rr['uid']);
|
pumpio_fetchtimeline($a, $rr['uid']);
|
||||||
pumpio_fetchtimeline($a, $rr['uid']);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$abandon_days = intval(DI::config()->get('system', 'account_abandon_days'));
|
$abandon_days = intval(DI::config()->get('system', 'account_abandon_days'));
|
||||||
|
@ -702,8 +700,7 @@ function pumpio_sync(App $a)
|
||||||
$abandon_limit = date(DateTimeFormat::MYSQL, time() - $abandon_days * 86400);
|
$abandon_limit = date(DateTimeFormat::MYSQL, time() - $abandon_days * 86400);
|
||||||
|
|
||||||
$pconfigs = DBA::selectToArray('pconfig', ['cat' => 'pumpio', 'k' => 'import', 'v' => '1']);
|
$pconfigs = DBA::selectToArray('pconfig', ['cat' => 'pumpio', 'k' => 'import', 'v' => '1']);
|
||||||
if (DBA::isResult($pconfigs)) {
|
foreach ($pconfigs as $rr) {
|
||||||
foreach ($pconfigs as $rr) {
|
|
||||||
if ($abandon_days != 0) {
|
if ($abandon_days != 0) {
|
||||||
if (DBA::exists('user', ["uid = ? AND `login_date` >= ?", $rr['uid'], $abandon_limit])) {
|
if (DBA::exists('user', ["uid = ? AND `login_date` >= ?", $rr['uid'], $abandon_limit])) {
|
||||||
Logger::notice('abandoned account: timeline from user '.$rr['uid'].' will not be imported');
|
Logger::notice('abandoned account: timeline from user '.$rr['uid'].' will not be imported');
|
||||||
|
@ -726,7 +723,6 @@ function pumpio_sync(App $a)
|
||||||
pumpio_getallusers($a, $rr["uid"]);
|
pumpio_getallusers($a, $rr["uid"]);
|
||||||
DI::pConfig()->set($rr['uid'], 'pumpio', 'contact_check', time());
|
DI::pConfig()->set($rr['uid'], 'pumpio', 'contact_check', time());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger::notice('pumpio: cron_end');
|
Logger::notice('pumpio: cron_end');
|
||||||
|
|
|
@ -135,7 +135,7 @@ function windowsphonepush_settings(&$a, &$s)
|
||||||
function windowsphonepush_cron()
|
function windowsphonepush_cron()
|
||||||
{
|
{
|
||||||
// retrieve all UID's for which the addon windowsphonepush is enabled and loop through every user
|
// 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) {
|
foreach ($pconfigs as $rr) {
|
||||||
// load stored information for the user-id of the current loop
|
// load stored information for the user-id of the current loop
|
||||||
$device_url = DI::pConfig()->get($rr['uid'], 'windowsphonepush', 'device_url');
|
$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
|
// 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
|
// 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)
|
// 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) {
|
foreach ($pconfigs as $rr) {
|
||||||
DI::pConfig()->set($rr['uid'], 'windowsphonepush', 'device_url', '');
|
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() . "'.");
|
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() . "'.");
|
||||||
|
|
Loading…
Reference in a new issue