public function doUpgrade(&$context, Am_BatchProcessor $batch) { $session = $this->getSession(); if (empty($session->step)) { $this->getSession()->step = 0; } do { $currentOperation = $this->steps[$session->step][0]; $start = (int) @$session->start; $this->outStepHeader(); $ret = call_user_func_array(array($this, $currentOperation), array($batch, &$start)); $session->start = $start; if (!$ret) { $batch->stop(); return false; } $this->outText(___('Done') . "<br />\n"); $session->step = $session->step + 1; if ($session->step >= count($this->steps)) { $session->unsetAll(); return true; } } while ($batch->checkLimits()); }