当前位置: 首页>>代码示例>>PHP>>正文


PHP OX_OperationInterval::checkIntervalDates方法代码示例

本文整理汇总了PHP中OX_OperationInterval::checkIntervalDates方法的典型用法代码示例。如果您正苦于以下问题:PHP OX_OperationInterval::checkIntervalDates方法的具体用法?PHP OX_OperationInterval::checkIntervalDates怎么用?PHP OX_OperationInterval::checkIntervalDates使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OX_OperationInterval的用法示例。


在下文中一共展示了OX_OperationInterval::checkIntervalDates方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: summariseBucketsRawSupplementary

 /**
  * A method to perform the migration of logged bucket-based supplementary
  * raw statistics data from the bucket table(s) into a final statistics table.
  *
  * @param string $statisticsTableName The name of the statistics table the
  *                                    data is to be migrated to.
  * @param array $aMigrationDetails An array containing the details of the
  *                                 bucket data to migrate into the statistics
  *                                 table. See the
  *                                 Plugins_DeliveryLog::getStatisticsMigration()
  *                                 method for details.
  * @param array $aDates An array containing the PEAR Date objects representing the
  *                      start and end dates for the operation interval being migrated,
  *                      indexed by "start" and "end", respectively.
  * @return mixed A PEAR_Error or MDB2_Error object on failure, otherwise, the number
  *               of rows of raw data that were migrated from the bucket table to the
  *               statistics table.
  */
 function summariseBucketsRawSupplementary($statisticsTableName, $aMigrationDetails, $aDates)
 {
     // Perform basic checking of the parameters; assumes that $aMigrationDetails
     // has already been checked by the Plugins_DeliveryLog::testStatisticsMigration()
     // method
     if ($aMigrationDetails['method'] != 'rawSupplementary') {
         $message = "OX_Dal_Maintenance_Statistics::summariseBucketsRawSupplementary() called with migration map method '{$aMigrationDetails['method']}' != 'rawSupplementary'.";
         $oError = new PEAR_Error($message, MAX_ERROR_INVALIDARGS);
         return $oError;
     }
     if (count($aMigrationDetails['masterTablePrimaryKeys']) != count($aMigrationDetails['bucketTablePrimaryKeys'])) {
         $message = "OX_Dal_Maintenance_Statistics::summariseBucketsRawSupplementary() called with different number of 'masterTablePrimaryKeys' and 'bucketTablePrimaryKeys' columns.";
         $oError = new PEAR_Error($message, MAX_ERROR_INVALIDARGS);
         return $oError;
     }
     if (count($aMigrationDetails['masterTableKeys']) != count($aMigrationDetails['bucketTableKeys'])) {
         $message = "OX_Dal_Maintenance_Statistics::summariseBucketsRawSupplementary() called with different number of 'masterTableKeys' and 'bucketTableKeys' columns.";
         $oError = new PEAR_Error($message, MAX_ERROR_INVALIDARGS);
         return $oError;
     }
     if (count($aMigrationDetails['source']) != count($aMigrationDetails['destination'])) {
         $message = "OX_Dal_Maintenance_Statistics::summariseBucketsRawSupplementary() called with different number of 'source' and 'destination' columns.";
         $oError = new PEAR_Error($message, MAX_ERROR_INVALIDARGS);
         return $oError;
     }
     if (!is_a($aDates['start'], 'Date') || !is_a($aDates['end'], 'Date')) {
         $message = "OX_Dal_Maintenance_Statistics::summariseBucketsRawSupplementary() called with invalid start/end date parameters -- not Date objects.";
         $oError = new PEAR_Error($message, MAX_ERROR_INVALIDARGS);
         return $oError;
     }
     if (!OX_OperationInterval::checkIntervalDates($aDates['start'], $aDates['end'])) {
         $message = "OX_Dal_Maintenance_Statistics::summariseBucketsRawSupplementary() called with invalid start/end date parameters -- not operation interval bounds.";
         $oError = new PEAR_Error($message, MAX_ERROR_INVALIDARGS);
         return $oError;
     }
     // Ensure that tables exist before trying to run commands based on
     // plugin components
     $oTable = new OA_DB_Table();
     if (!$oTable->extistsTable($statisticsTableName)) {
         $message = "OX_Dal_Maintenance_Statistics::summariseBucketsRawSupplementary() called with invalid statistics table '{$statisticsTableName}'.";
         $oError = new PEAR_Error($message, MAX_ERROR_INVALIDREQUEST);
         return $oError;
     }
     if (!$oTable->extistsTable($aMigrationDetails['masterTable'])) {
         $message = "OX_Dal_Maintenance_Statistics::summariseBucketsRawSupplementary() called with invalid master table '{$aMigrationDetails['masterTable']}'.";
         $oError = new PEAR_Error($message, MAX_ERROR_INVALIDREQUEST);
         return $oError;
     }
     if (!$oTable->extistsTable($aMigrationDetails['bucketTable'])) {
         $message = "OX_Dal_Maintenance_Statistics::summariseBucketsRawSupplementary() called with invalid bucket table '{$aMigrationDetails['bucketTable']}'.";
         $oError = new PEAR_Error($message, MAX_ERROR_INVALIDREQUEST);
         return $oError;
     }
     // Prepare the previously migrated raw data statistics table columns array
     $aMasterColumns = array();
     foreach ($aMigrationDetails['masterTablePrimaryKeys'] as $value) {
         $aMasterColumns[] = $this->oDbh->quoteIdentifier($value, true);
     }
     foreach ($aMigrationDetails['masterTableKeys'] as $value) {
         $aMasterColumns[] = $this->oDbh->quoteIdentifier($value, true);
     }
     // Prepare the query to locate the data in columns in the statistics
     // table which contains the previously migrated raw bucket data,
     // which will then be used to locate the supplementary raw data and
     // also to ensure that when this supplementary raw data is migrated
     // to its statistics table, the supplementary raw data can be
     // connected with the previously migrated raw data
     $query = "\n            SELECT\n                " . implode(', ', $aMasterColumns) . "\n            FROM\n                " . $this->oDbh->quoteIdentifier($aMigrationDetails['masterTable'], true) . "\n            WHERE\n                " . $this->oDbh->quoteIdentifier($aMigrationDetails['masterDateTimeColumn'], true) . " >= " . $this->oDbh->quote($aDates['start']->format('%Y-%m-%d %H:%M:%S'), 'timestamp') . "\n                AND\n                " . $this->oDbh->quoteIdentifier($aMigrationDetails['masterDateTimeColumn'], true) . " <= " . $this->oDbh->quote($aDates['end']->format('%Y-%m-%d %H:%M:%S'), 'timestamp');
     // Prevent any strange database error from causing execution to halt
     // by overriding the error handler, run the query, and return the
     // MDB2_Error object, if required
     PEAR::pushErrorHandling(null);
     $rsResult = $this->oDbh->query($query);
     PEAR::popErrorHandling();
     if (PEAR::isError($rsResult)) {
         return $rsResult;
     }
     // Were any rows found for previously migrated summarised raw data?
     if ($rsResult->numRows() == 0) {
         return 0;
     }
     // Ensure that the required arrays are sorted by key
//.........这里部分代码省略.........
开发者ID:villos,项目名称:tree_admin,代码行数:101,代码来源:Statistics.php

示例2: testCheckIntervalDates

 /**
  * A method to test the checkIntervalDates() method.
  */
 function testCheckIntervalDates()
 {
     $conf =& $GLOBALS['_MAX']['CONF'];
     // Set the operation interval
     $conf['maintenance']['operationInterval'] = 30;
     // Test less than one operation interval
     $start = new Date('2004-09-26 00:00:00');
     $end = new Date('2004-09-26 00:15:00');
     $this->assertFalse(OX_OperationInterval::checkIntervalDates($start, $end));
     // Test more than one operation inteterval
     $start = new Date('2004-09-26 00:00:00');
     $end = new Date('2004-09-26 00:45:00');
     $this->assertFalse(OX_OperationInterval::checkIntervalDates($start, $end));
     // Test exactly one operation interval
     $start = new Date('2004-09-26 00:00:00');
     $end = new Date('2004-09-26 00:29:59');
     $this->assertTrue(OX_OperationInterval::checkIntervalDates($start, $end));
     // Set the operation interval
     $conf['maintenance']['operationInterval'] = 60;
     // Test less than one operation interval/hour
     $start = new Date('2004-09-26 00:00:00');
     $end = new Date('2004-09-26 00:30:00');
     $this->assertFalse(OX_OperationInterval::checkIntervalDates($start, $end));
     // Test more than one operation inteterval/hour
     $start = new Date('2004-09-26 00:00:00');
     $end = new Date('2004-09-26 01:15:00');
     $this->assertFalse(OX_OperationInterval::checkIntervalDates($start, $end));
     // Test exactly one operation interval/hour
     $start = new Date('2004-09-26 00:00:00');
     $end = new Date('2004-09-26 00:59:59');
     $this->assertTrue(OX_OperationInterval::checkIntervalDates($start, $end));
     // Set the operation interval
     $conf['maintenance']['operationInterval'] = 120;
     // Test less than one hour
     $start = new Date('2004-09-26 00:00:00');
     $end = new Date('2004-09-26 00:15:00');
     $this->assertFalse(OX_OperationInterval::checkIntervalDates($start, $end));
     // Test more than one hour
     $start = new Date('2004-09-26 00:00:00');
     $end = new Date('2004-09-26 04:00:00');
     $this->assertFalse(OX_OperationInterval::checkIntervalDates($start, $end));
     // Test exactly one hour
     $start = new Date('2004-09-26 00:00:00');
     $end = new Date('2004-09-26 00:59:59');
     $this->assertTrue(OX_OperationInterval::checkIntervalDates($start, $end));
 }
开发者ID:Jaree,项目名称:revive-adserver,代码行数:49,代码来源:OperationInterval.mtc.test.php

示例3: _testParameters

 /**
  * A private method to test the parameters of the getAdTargetingStatistics()
  * and getZoneTargetingStatistics methods.
  *
  * @access private
  * @param integer    $id         The ad or zone ID.
  * @param PEAR::Date $oStartDate The start date of the operation interval.
  * @param PEAR::Date $oEndDate   The end date of the operation interval.
  * @return boolean True if the parameters are okay, false otherwise.
  */
 function _testParameters($id, $oStartDate, $oEndDate)
 {
     // Ensure the parameters are valid
     if (empty($id) || !is_int($id)) {
         return false;
     }
     if (empty($oStartDate) || !is_a($oStartDate, 'Date')) {
         return false;
     }
     if (empty($oEndDate) || !is_a($oEndDate, 'Date')) {
         return false;
     }
     // Ensure that the date range specified is indeed an operation interval
     if (!OX_OperationInterval::checkIntervalDates($oStartDate, $oEndDate)) {
         return false;
     }
     return true;
 }
开发者ID:villos,项目名称:tree_admin,代码行数:28,代码来源:Targeting.php


注:本文中的OX_OperationInterval::checkIntervalDates方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。