getHash() public method

Returns a hash of the segment condition, or the empty string if the segment condition is empty.
public getHash ( ) : string
return string
コード例 #1
0
 private function insertNumericArchive($tableMonth, $idSite, $period, $date1, $date2, $segment, $doneValue)
 {
     $this->insertRow('archive_numeric', $tableMonth, $idSite, $period, $date1, $date2, 'nb_schweetz', 2);
     $this->insertRow('archive_numeric', $tableMonth, $idSite, $period, $date1, $date2, 'nb_fixes', 3);
     $this->insertRow('archive_numeric', $tableMonth, $idSite, $period, $date1, $date2, 'nb_wrecks', 4);
     $doneFlag = 'done';
     if (!empty($segment)) {
         $segmentObj = new Segment($segment, array());
         $doneFlag .= $segmentObj->getHash();
     }
     $this->insertRow('archive_numeric', $tableMonth, $idSite, $period, $date1, $date2, $doneFlag, $doneValue);
 }
コード例 #2
0
ファイル: API.php プロジェクト: brienomatty/elmsln
 protected function checkSegmentValue($definition, $idSite)
 {
     // unsanitize so we don't record the HTML entitied segment
     $definition = Common::unsanitizeInputValue($definition);
     $definition = str_replace("#", '%23', $definition);
     // hash delimiter
     $definition = str_replace("'", '%27', $definition);
     // not encoded in JS
     $definition = str_replace("&", '%26', $definition);
     try {
         $segment = new Segment($definition, $idSite);
         $segment->getHash();
     } catch (Exception $e) {
         throw new Exception("The specified segment is invalid: " . $e->getMessage());
     }
     return $definition;
 }
コード例 #3
0
ファイル: SegmentTest.php プロジェクト: carriercomm/piwik
 /**
  * @dataProvider getCommonTestData
  * @group Core
  */
 public function testCommon($segment, $expected)
 {
     $select = 'log_visit.idvisit';
     $from = 'log_visit';
     $expected = array('sql' => '
             SELECT
                 log_visit.idvisit
             FROM
                 ' . Common::prefixTable('log_visit') . ' AS log_visit
             WHERE
                 ' . $expected['where'], 'bind' => $expected['bind']);
     $segment = new Segment($segment, $idSites = array());
     $sql = $segment->getSelectQuery($select, $from, false);
     $this->assertEquals($this->_filterWhitsSpaces($expected), $this->_filterWhitsSpaces($sql));
     // calling twice should give same results
     $sql = $segment->getSelectQuery($select, array($from));
     $this->assertEquals($this->_filterWhitsSpaces($expected), $this->_filterWhitsSpaces($sql));
     $this->assertEquals(32, strlen($segment->getHash()));
 }
コード例 #4
0
ファイル: Rules.php プロジェクト: diosmosis/piwik
 public static function getDoneFlagArchiveContainsAllPlugins(Segment $segment)
 {
     return 'done' . $segment->getHash();
 }
コード例 #5
0
 protected static function makeLockName($idsite, Period $period, Segment $segment)
 {
     $config = Config::getInstance();
     $lockName = 'piwik.' . $config->database['dbname'] . '.' . $config->database['tables_prefix'] . '/' . $idsite . '/' . (!$segment->isEmpty() ? $segment->getHash() . '/' : '') . $period->getId() . '/' . $period->getDateStart()->toString('Y-m-d') . ',' . $period->getDateEnd()->toString('Y-m-d');
     return $lockName . '/' . md5($lockName . SettingsPiwik::getSalt());
 }