I made a plugin to update my 3000 users. It is kind of a toolbox to manage and update some users fields.
I am calling the controller directly through its url action.
It is working basically but it stops after 20 seconds when updating too many users, and display a white page in browser, no results.
I can see in my plugin log it updated some few lines before stopping.
I checked php and craft logs and cannot see any error information.
public function actionUsersFix() {
// Delete all the entry caches
craft()->templateCache->deleteCachesByElementType('User');
// Now find the entry IDs
$criteria = craft()->elements->getCriteria('User', array('group' => 'migMembers', 'limit' => null, 'status' => null, 'localeEnabled' => null));
$criteria->group = 'migMembers';
$criteria->limit = null;
$criteria->status = null;
$criteria->localeEnabled = null;
$criteria->accent = '2';
$userIds = $criteria->ids();
//$totalEntries = count($userIds);
//
foreach ($userIds as $userId)
{
$user = craft()->users->getUserById($userId);
$oldAccent = $user->accent;
$newAccent = '3';
$user->getContent()->accent = $newAccent;
$success = craft()->users->saveUser($user);
MigPlugin::log('User '.$user->email.' - accent = '. $oldAccent .' - modified = '.$newAccent, LogLevel::Warning);
}
}