From 8040159dfc8c64edb68d1549d65dd997c7a9d150 Mon Sep 17 00:00:00 2001 From: Michael Fairchild <mfairchild365@gmail.com> Date: Fri, 5 Feb 2016 09:06:30 -0600 Subject: [PATCH] Pick up where we left off and include new avatars --- plugins/cas_auth_unl/migration.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/plugins/cas_auth_unl/migration.php b/plugins/cas_auth_unl/migration.php index ab9b8ae3..541e58b2 100644 --- a/plugins/cas_auth_unl/migration.php +++ b/plugins/cas_auth_unl/migration.php @@ -6,11 +6,17 @@ require_once __DIR__ . '/../../elgg/vendor/autoload.php'; $lock_file = __DIR__ . '/migration.lock'; $lock = @file_get_contents($lock_file); + +$lock_data = json_decode($lock, true); + if (!$lock) { - $lock = 0; + $lock_data = array( + 'last_guid' => 0, + 'icontime' => 0 + ); } -if (!$users = @file_get_contents('http://planetred.unl.edu/sync.php?start='.$lock)) { +if (!$users = @file_get_contents('https://planetred.unl.edu/sync.php?start='.$lock_data['last_guid'] . '&icontime='.$lock_data['icontime'])) { echo 'FAILED TO CONNECT' . PHP_EOL; exit(); } @@ -86,5 +92,10 @@ foreach ($users as $source_user) { $target_user->icontime = time(); //Update the lock file - file_put_contents($lock_file, $source_user['guid']); + $lock_data = array( + 'last_guid' => $source_user['guid'], + 'icontime' => time() + ); + + file_put_contents($lock_file, json_encode($lock_data)); } -- GitLab