public static function doWork($langs) { $allshg = array(); $startmem = memory_get_usage(FALSE); //echo '1:'.round(memory_get_usage(FALSE)/1024/1024).'Mb'.'<br />'; foreach (OPCXmlExport::$classes as $class2) { $allshg[] = $class2->config->shopper_group; } $allshg = array_unique($allshg); //echo '1:'.round(memory_get_usage(FALSE)/1024/1024).'Mb'.'<br />'; if (empty(OPCXmlExport::$classes)) { return; } $compress = JRequest::getInt('compress', 1); // zero step: $from = JRequest::getInt('from', 1); $to = JRequest::getInt('to', OPCXmlExport::$config->product_count); /* if (empty($from) && (empty($to)) && ($compress != 2)) { self::$cats = OPCXmlExport::prepareCats($langs); return; } */ // case 2, all exported at once: /* if (($from == 1) && ($to >= OPCXmlExport::$config->product_count)) self::$cats =& OPCXmlExport::prepareCats($langs); */ // last step: if ($compress == 2) { OPCXmlExport::compress(); return; } // normal steps: $from = JRequest::getInt('from', 1); if (!empty($to)) { if ($from == 1) { OPCXmlExport::clear(); OPCXmlExport::startHeaders(); } //self::$cats =& OPCXmlExport::prepareCats($langs); //echo '2:'.round(memory_get_usage(FALSE)/1024/1024).'Mb'.'<br />'; $continue = OPCXmlExport::getItems($langs, $allshg); if ($continue) { OPCXmlExport::endHeaders(); OPCXmlExport::close(); if ($compress == 1) { OPCXmlExport::compress(); } } } $endmem = memory_get_usage(FALSE); $mem = $endmem - $startmem; echo 'Mem: ' . round($mem / 1024 / 1024) . 'Mb'; }