<p>It was a php.ini config problem, I put some parameters values up and the update succeeded in less than 2 minutes and completed my users batch update.</p>

<p>So you just need to update the values below and <code>reload</code> your web server (ie: Apache).  </p>

<pre><code>max_execution_time 120 (instead of initial value 30)  
memory_limit 512M (instead of initial value 128M)
</code></pre>

CC BY-SA 3.0
2015-10-11T12:08:42.027Z
2015-10-11T12:14:06.393Z
2015-10-11T12:14:06.393Z
migmaker
<p>I made a plugin to update my 3000 users. It is kind of a toolbox to manage and update some users fields.</p>

<p>I am calling the controller directly through its url action.<br>
It is working basically but it stops after 20 seconds when updating too many users, and display a white page in browser, no results.  </p>

<p>I can see in my plugin log it updated some few lines before stopping.<br>
I checked php and craft logs and cannot see any error information.</p>

<p>public function actionUsersFix() {</p>

<pre><code>    // Delete all the entry caches
    craft()-&gt;templateCache-&gt;deleteCachesByElementType('User');

    // Now find the entry IDs
    $criteria = craft()-&gt;elements-&gt;getCriteria('User', array('group' =&gt; 'migMembers', 'limit' =&gt; null, 'status' =&gt; null, 'localeEnabled' =&gt; null));
    $criteria-&gt;group = 'migMembers';
    $criteria-&gt;limit = null;
    $criteria-&gt;status = null;
    $criteria-&gt;localeEnabled = null;
    $criteria-&gt;accent = '2';

    $userIds = $criteria-&gt;ids();
    //$totalEntries = count($userIds);

    //
    foreach ($userIds as $userId)
    {
        $user = craft()-&gt;users-&gt;getUserById($userId);

        $oldAccent = $user-&gt;accent;
        $newAccent = '3';

        $user-&gt;getContent()-&gt;accent = $newAccent;
        $success = craft()-&gt;users-&gt;saveUser($user);
        MigPlugin::log('User '.$user-&gt;email.' - accent = '. $oldAccent .' - modified = '.$newAccent, LogLevel::Warning);
    }

}
</code></pre>

<plugin-development><batch>
Craft plugin controller for batch update users break with empty page
# Craft plugin controller for batch update users break with empty page

(Asked by: username_0 on 2015-10-11)

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);
    }

}

**Tags:** plugin-development, batch

---

## 1 answers

### Answer by username_0 on 2015-10-11. Score: 1

It was a php.ini config problem, I put some parameters values up and the update succeeded in less than 2 minutes and completed my users batch update.
So you just need to update the values below and reload your web server (ie: Apache).  
max_execution_time 120 (instead of initial value 30)  
memory_limit 512M (instead of initial value 128M)


---

