public static function newInstance() { if (!self::$instance instanceof self) { self::$instance = new self(); } return self::$instance; }
function butler_delete_activated_users($days = 30, $limit = 1000) { $users = ModelButler::newInstance()->inactivatedUsers($days, $limit); $mUsers = User::newInstance(); $numSuccess = 0; foreach ($users as $user) { $success = $mUsers->deleteUser($user['pk_i_id']); if ($success) { $numSuccess++; } } osc_set_preference('activated_users', (int) osc_get_preference('activated_users', 'butler') + $numSuccess, 'butler', 'INTEGER'); }