Example #1
0
 /**
  * ALIAS OF dieObject() - Display an error with detailed object but don't stop the execution
  *
  * @param object $object Object to display
  */
 public static function p($object)
 {
     return Tools::dieObject($object, false);
 }
 protected function processBulkMyAction()
 {
     Tools::dieObject($this->boxes);
 }
Example #3
0
 public function loadUpdateSQL()
 {
     $file = _PS_TOOL_DIR_ . '/languages/updateLanguages.sql';
     if (!file_exists($file)) {
         Tools::dieObject($file);
     }
     if (!($sqlContent = file_get_contents($file))) {
         Tools::dieObject(file_get_contents($file));
     }
     $sqlContent .= "\n";
     $sqlContent = str_replace('PREFIX_', _DB_PREFIX_, $sqlContent);
     $sqlContent = preg_split("/;\\s*[\r\n]+/", $sqlContent);
     foreach ($sqlContent as $query) {
         $query = trim($query);
         if (!empty($query)) {
             if (!Db::getInstance()->Execute($query)) {
                 Tools::dieObject($query);
             }
         }
     }
     return true;
 }
Example #4
0
 public static function refreshCache($referrers = null, $employee = null)
 {
     if (!$referrers or !is_array($referrers)) {
         $referrers = Db::getInstance()->ExecuteS('SELECT id_referrer FROM ' . _DB_PREFIX_ . 'referrer');
     }
     foreach ($referrers as $row) {
         $referrer = new Referrer((int) $row['id_referrer']);
         $statsVisits = $referrer->getStatsVisits(null, $employee);
         $referrer->cache_visitors = $statsVisits['uniqs'];
         $referrer->cache_visits = $statsVisits['visits'];
         $referrer->cache_pages = $statsVisits['pages'];
         $registrations = $referrer->getRegistrations(null, $employee);
         $referrer->cache_registrations = (int) $registrations;
         $statsSales = $referrer->getStatsSales(null, $employee);
         $referrer->cache_orders = (int) $statsSales['orders'];
         $referrer->cache_sales = number_format($statsSales['sales'], 2, '.', '');
         $referrer->cache_reg_rate = $statsVisits['uniqs'] ? (int) $registrations / $statsVisits['uniqs'] : 0;
         $referrer->cache_order_rate = $statsVisits['uniqs'] ? (int) $statsSales['orders'] / $statsVisits['uniqs'] : 0;
         if (!$referrer->update()) {
             Tools::dieObject(mysql_error());
         }
         Configuration::updateValue('PS_REFERRERS_CACHE_LIKE', ModuleGraph::getDateBetween($employee));
         Configuration::updateValue('PS_REFERRERS_CACHE_DATE', date('Y-m-d H:i:s'));
     }
     return true;
 }