public function startRecalculationAjax() { if (Status::isCalculationInProgress()) { return \BootstrapUI::buttonRemoteResponse()->text('Calculation is already in progress'); } return \BootstrapUI::buttonRemoteResponse()->disableButton()->text('Recalculation is in progress...')->after(function () { set_time_limit(0); \Status::calculationStarted(); \Status::setCalculationStatus('Recalculating brands'); \Brand::recalculate(); \Status::setCalculationStatus('Recalculating countries'); \Country::recalculate(); \Status::setCalculationStatus('Recalculating packages'); \Package::recalculate(); \Status::setCalculationStatus('Recalculating package versions'); \Package\Version::recalculate(); \Status::setCalculationStatus('Recalculating phone models'); \Phone\Model::recalculate(); \Status::setCalculationStatus('Recalculating product names'); \Product::recalculate(); \Status::setCalculationStatus('Recalculating providers'); \Provider::recalculate(); \Status::setCalculationStatus('Recalculating stack traces'); \Stack\Trace::recalculate(); \Status::setCalculationStatus('Recalculating OS versions'); \Version::recalculate(); \Status::calculationFinished('all'); }); }