@Kevin : great, is this in 1.7.x or the upcoming 1.8?
It's in 1.7.2 and higher at least.
Got sidetracked but just tried this out now.
Works perfectly thanks Kevin!
This is the full syntax I used in case anyone else needs it:
$last_player = elgg_get_entities_from_relationship(array('relationship' => 'member', 'relationship_guid' => $team->guid, 'inverse_relationship' => TRUE, 'order_by' => 'r.time_created DESC', 'limit' => 1));
Hmm.. very interesting.. I will have to go thru your notes in more detail !
What we did was not to "Grab all the users" -
but did a one-time and incremental create of users' emails into files called
userlist_123_999.data from users_entity tbl
where 123 is guid of the first user and 999 is the guid of the last user on the file
next -->
listdir userlist_123_999.data
if (notfound)
all emails have been sent
rename newsletter_123.mail --> newsletter_999.done
and
grab 1st userlist_999_999.data
process with newsletter_999.mail
rename userlist_123_999.data --> userlist_999_999.done
while a userlist_123_999.data file is found -
it gets processed by CRON'ed sendnewsletter.php
The CRON is simple -->
CRON x 5mins, PHP CLI := sendnewsletter.php
#!../bin/bash
...
echo ".START::NEWSLETTERSEND:: "$DATE
date
php /www/httpdocs/mod/newslettersend.php > $LOGFILE
echo ".END::NEWSLETTERSEND.SH"
Thanks. That looks much much simpler.
The "grab all users" approach is a disaster, PHP runs out of memory in a lot of other places where we have used it, replacing it with something that cycles through the list, 100 at a time (which seems to be the sweet spot on the current configuration).
If you test the upgrade first on a test site, you can do the upgrade with all your plugins enabled which saves a lot of time. My site upgrades normally take about a minute.
Or you can break the database connection first by editing the settings.php file, while you are FTP'ying the files. Later once file transfer is completed change the settings.php credentials to the original and run the upgrade.php
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by Raül Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.