예제 #1
0
 /**
  * @param int $ip
  * @return CM_Model_Location|null
  */
 private static function _findByIp($ip)
 {
     $result = CM_Db_Db::execRead("SELECT `id`, `level`, `ipStart` FROM `cm_model_location_ip`\r\n\t\t\tWHERE `ipEnd` >= ?\r\n\t\t\tORDER BY `ipEnd` ASC\r\n\t\t\tLIMIT 1", array($ip))->fetch();
     if ($result) {
         if ($result['ipStart'] <= $ip) {
             return new CM_Model_Location($result['level'], $result['id']);
         }
     }
     return null;
 }
예제 #2
0
    /**
     * @return array
     */
    protected function _getAggregationData()
    {
        $cacheKey = $this->_getCacheKeyAggregation();
        $cache = CM_Cache_Local::getInstance();
        if (false === ($aggregationData = $cache->get($cacheKey))) {
            $conversionData = CM_Db_Db::execRead('
              SELECT COUNT(1) as `conversionCount`, SUM(`conversionWeight`) as `conversionWeight`, SUM(`conversionWeight` * `conversionWeight`) as `conversionWeightSquared`
                FROM `cm_splittestVariation_fixture`
				WHERE `splittestId`=? AND `variationId`=? AND `conversionStamp` IS NOT NULL', array($this->_getSplittestId(), $this->getId()))->fetch();
            $fixtureCount = (int) CM_Db_Db::execRead('SELECT COUNT(1) FROM `cm_splittestVariation_fixture`
				WHERE `splittestId`=? AND `variationId`=?', array($this->_getSplittestId(), $this->getId()))->fetchColumn();
            $aggregationData = array('conversionCount' => (int) $conversionData['conversionCount'], 'conversionWeight' => (double) $conversionData['conversionWeight'], 'conversionWeightSquared' => (double) $conversionData['conversionWeightSquared'], 'fixtureCount' => $fixtureCount);
            $cache->set($cacheKey, $aggregationData, 30);
        }
        return $aggregationData;
    }
예제 #3
0
파일: 56.php 프로젝트: cargomedia/cm
<?php

return;
$rows = CM_Db_Db::execRead('SELECT `id`, `thumbnailCount` FROM cm_streamChannel_media WHERE thumbnailCount > 0');
while ($row = $rows->fetch()) {
    CM_Db_Db::exec('UPDATE cm_streamChannel_media SET `data`=? WHERE `id`=? ', [CM_Params::encode(['thumbnailCount' => (int) $row['thumbnailCount']], true), $row['id']]);
}
$rows = CM_Db_Db::execRead('SELECT `id`, `thumbnailCount` FROM cm_streamChannelArchive_media WHERE thumbnailCount > 0');
while ($row = $rows->fetch()) {
    CM_Db_Db::exec('UPDATE cm_streamChannelArchive_media SET `data`=? WHERE `id`=? ', [CM_Params::encode(['thumbnailCount' => (int) $row['thumbnailCount']], true), $row['id']]);
}
예제 #4
0
파일: Mail.php 프로젝트: NicolasSchmutz/cm
 /**
  * @param int $limit
  */
 public static function processQueue($limit)
 {
     $limit = (int) $limit;
     $result = CM_Db_Db::execRead('SELECT * FROM `cm_mail` ORDER BY `createStamp` LIMIT ' . $limit);
     while ($row = $result->fetch()) {
         $mail = new CM_Mail();
         foreach (unserialize($row['to']) as $to) {
             $mail->addTo($to['address'], $to['name']);
         }
         foreach (unserialize($row['replyTo']) as $replyTo) {
             $mail->addReplyTo($replyTo['address'], $replyTo['name']);
         }
         foreach (unserialize($row['cc']) as $cc) {
             $mail->addCc($cc['address'], $cc['name']);
         }
         foreach (unserialize($row['bcc']) as $bcc) {
             $mail->addBcc($bcc['address'], $bcc['name']);
         }
         if ($headerList = unserialize($row['customHeaders'])) {
             foreach ($headerList as $label => $valueList) {
                 foreach ($valueList as $value) {
                     $mail->addCustomHeader($label, $value);
                 }
             }
         }
         $sender = unserialize($row['sender']);
         $mail->setSender($sender['address'], $sender['name']);
         $mail->_send($row['subject'], $row['text'], $row['html']);
         CM_Db_Db::delete('cm_mail', array('id' => $row['id']));
     }
 }