Пример #1
0
 /**
  * Get the phone model ID
  * @param string $brand
  * @param string $phoneModel
  * @return int
  */
 private function getModelId($brand, $phoneModel)
 {
     if ($brand === null || $phoneModel === null || trim($brand) == '' || trim($phoneModel) == '') {
         return null;
     }
     $key = $brand . $phoneModel;
     if (!isset($this->brandIds[$key])) {
         $this->brandIds[$key] = PhoneModel::getId($brand, $phoneModel);
     }
     return $this->brandIds[$key];
 }
Пример #2
0
 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');
     });
 }