本文整理汇总了PHP中MAX::raiseError方法的典型用法代码示例。如果您正苦于以下问题:PHP MAX::raiseError方法的具体用法?PHP MAX::raiseError怎么用?PHP MAX::raiseError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MAX
的用法示例。
在下文中一共展示了MAX::raiseError方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processBucket
/**
* Process an aggregate-type bucket. This is MySQL specific.
*
* @param Plugins_DeliveryLog $oBucket a reference to the using (context) object.
* @param Date $oEnd A PEAR_Date instance, interval_start to process up to (inclusive).
*/
public function processBucket($oBucket, $oEnd)
{
$sTableName = $oBucket->getBucketTableName();
$oMainDbh =& OA_DB_Distributed::singleton();
if (PEAR::isError($oMainDbh)) {
MAX::raiseError($oMainDbh, MAX_ERROR_DBFAILURE, PEAR_ERROR_DIE);
}
OA::debug(' - Processing the ' . $sTableName . ' table for data with operation interval start equal to or before ' . $oEnd->format('%Y-%m-%d %H:%M:%S') . ' ' . $oEnd->tz->getShortName(), PEAR_LOG_INFO);
// Select all rows with interval_start <= previous OI start.
$rsData =& $this->getBucketTableContent($sTableName, $oEnd);
$rowCount = $rsData->getRowCount();
OA::debug(' - ' . $rsData->getRowCount() . ' records found', PEAR_LOG_DEBUG);
if ($rowCount) {
// We can't do bulk inserts with ON DUPLICATE.
$aExecQueries = array();
while ($rsData->fetch()) {
// Get first row
$aRow = $rsData->toArray();
// Insert or update
$aExecQueries[] = "SELECT bucket_update_{$sTableName}(" . join(',', array_map(array(&$oMainDbh, 'quote'), $aRow)) . ")";
}
if (count($aExecQueries)) {
foreach ($aExecQueries as $execQuery) {
$result = $oMainDbh->exec($execQuery);
if (PEAR::isError($result)) {
MAX::raiseError($result, MAX_ERROR_DBFAILURE, PEAR_ERROR_DIE);
}
}
}
}
}
示例2: _getControllerClass
function _getControllerClass($controllerType = '', $aParams = null, &$class, &$file)
{
if (!is_array($aParams)) {
$aParams = array();
}
if (empty($controllerType) || $controllerType == '-') {
$controllerType = basename($_SERVER['SCRIPT_NAME']);
$controllerType = preg_replace('#^(?:stats-)?(.*)\\.php#', '$1', $controllerType);
}
// Validate
if (!preg_match('/^[a-z-]+$/Di', $controllerType)) {
$errMsg = "OA_Admin_Statistics_Factory::_getControllerClass() Unsupported controller type";
return MAX::raiseError($errMsg, MAX_ERROR_INVALIDARGS, PEAR_ERROR_RETURN);
}
// Prepare the strings required to generate the file and class names
list($primary, $secondary) = explode('-', $controllerType, 2);
$primary = ucfirst(strtolower($primary));
$aSecondary = explode('-', $secondary);
foreach ($aSecondary as $key => $string) {
$aSecondary[$key] = ucfirst(strtolower($string));
}
$file = MAX_PATH . '/lib/OA/Admin/Statistics/Delivery/Controller/';
$file .= $primary;
foreach ($aSecondary as $string) {
$file .= $string;
}
$file .= '.php';
$class = 'OA_Admin_Statistics_Delivery_Controller_';
$class .= $primary;
foreach ($aSecondary as $string) {
$class .= $string;
}
}
示例3: belongsToAccount
/**
* The belongsToAccount() method behaves in a different way when looking
* at entries in the "audit" table. To check if an account has access
* to view specific audit data, we only need to check if the account's
* ID is set in the appropriate column in the record.
*
* @param string $accountId The account ID to test if this DB_DataObject is
* owned by.
* @return boolean|null Returns true if the entity belongs to the specified
* account, false if doesn't, or null if it was not
* possible to find the required object references.
*/
function belongsToAccount($accountId = null)
{
// Set the account ID, if not passed in
if (empty($accountId)) {
$accountId = OA_Permission::getAccountId();
}
// Prepare $this with the required info of the "entity" to be tested
if (!$this->N) {
$key = $this->getFirstPrimaryKey();
if (empty($this->{$key})) {
MAX::raiseError('Key on object is not set, table: ' . $this->getTableWithoutPrefix());
return null;
}
if (!$this->find($autoFetch = true)) {
return null;
}
}
// Test the account ID type, and then test for access
$accountType = OA_Permission::getAccountTypeByAccountId($accountId);
// Test the access to the audit trail entry
if ($accountType == OA_ACCOUNT_ADMIN) {
// Admin always has access
return true;
} else {
if ($accountType == OA_ACCOUNT_MANAGER) {
// Test if the account ID is equal to the account_id field
if (is_null($this->account_id)) {
return null;
}
if ($this->account_id == $accountId) {
return true;
}
} else {
if ($accountType == OA_ACCOUNT_ADVERTISER) {
// Test if the account ID is equal to the advertiser_account_id field
if (is_null($this->advertiser_account_id)) {
return null;
}
if ($this->advertiser_account_id == $accountId) {
return true;
}
} else {
if ($accountType == OA_ACCOUNT_TRAFFICKER) {
// Test if the account ID is equal to the website_account_id field
if (is_null($this->website_account_id)) {
return null;
}
if ($this->website_account_id == $accountId) {
return true;
}
}
}
}
}
return false;
}
示例4: processBucket
/**
* Process a raw-type bucket.
*
* @param Plugins_DeliveryLog a reference to the using (context) object.
* @param Date $oEnd A PEAR_Date instance, interval_start to process up to (inclusive).
*/
public function processBucket($oBucket, $oEnd)
{
$sTableName = $oBucket->getBucketTableName();
$oMainDbh =& OA_DB_Distributed::singleton();
if (PEAR::isError($oMainDbh)) {
MAX::raiseError($oMainDbh, MAX_ERROR_DBFAILURE, PEAR_ERROR_DIE);
}
OA::debug(' - Processing the ' . $sTableName . ' table for data with operation interval start equal to or before ' . $oEnd->format('%Y-%m-%d %H:%M:%S') . ' ' . $oEnd->tz->getShortName(), PEAR_LOG_INFO);
// As this is raw data being processed, data will not be logged based on the operation interval,
// but based on the time the raw data was collected. Adjust the $oEnd value accordingly...
$aDates = OX_OperationInterval::convertDateToOperationIntervalStartAndEndDates($oEnd);
OA::debug(' - The ' . $sTableName . ' table is a raw data table. Data logged in real-time, not operation intervals.', PEAR_LOG_INFO);
OA::debug(' - Accordingly, processing of the ' . $sTableName . ' table will be performed based on data that has a logged date equal to', PEAR_LOG_INFO);
OA::debug(' or before ' . $aDates['end']->format('%Y-%m-%d %H:%M:%S') . ' ' . $aDates['end']->tz->getShortName(), PEAR_LOG_INFO);
// Select all rows with interval_start <= previous OI start.
$rsData =& $this->getBucketTableContent($sTableName, $aDates['end']);
$count = $rsData->getRowCount();
OA::debug(' - ' . $rsData->getRowCount() . ' records found', PEAR_LOG_DEBUG);
if ($count) {
$packetSize = 16777216;
// 16 MB hardcoded (there's no max limit)
$i = 0;
while ($rsData->fetch()) {
$aRow = $rsData->toArray();
$sRow = '(' . join(',', array_map(array(&$oMainDbh, 'quote'), $aRow)) . ')';
if (!$i) {
$sInsert = "INSERT INTO {$sTableName} (" . join(',', array_keys($aRow)) . ") VALUES ";
$query = '';
$aExecQueries = array();
}
if (!$query) {
$query = $sInsert . $sRow;
// Leave 4 bytes headroom for max_allowed_packet
} elseif (strlen($query) + strlen($sRow) + 4 < $packetSize) {
$query .= ',' . $sRow;
} else {
$aExecQueries[] = $query;
$query = $sInsert . $sRow;
}
if (++$i >= $count || strlen($query) >= $packetSize) {
$aExecQueries[] = $query;
$query = '';
}
if (count($aExecQueries)) {
foreach ($aExecQueries as $execQuery) {
$result = $oMainDbh->exec($execQuery);
if (PEAR::isError($result)) {
MAX::raiseError($result, MAX_ERROR_DBFAILURE, PEAR_ERROR_DIE);
}
}
$aExecQueries = array();
}
}
}
}
示例5: getFieldType
/**
* This method returns class field type.
*
* @param string $fieldName
* @return string field type
*/
function getFieldType($fieldName)
{
$aFieldsTypes = $this->getFieldsTypes();
if (!isset($aFieldsTypes) || !is_array($aFieldsTypes)) {
MAX::raiseError('Please provide field types array for Info object creation');
}
if (!array_key_exists($fieldName, $aFieldsTypes)) {
MAX::raiseError('Unknown type for field \'' . $fieldName . '\'');
}
return $aFieldsTypes[$fieldName];
}
示例6: OX_Maintenance
function OX_Maintenance()
{
$this->aConf = $GLOBALS['_MAX']['CONF'];
OA_Preferences::loadAdminAccountPreferences();
$this->aPref = $GLOBALS['_MAX']['PREF'];
// Get a connection to the datbase
$this->oDbh =& OA_DB::singleton();
if (PEAR::isError($this->oDbh)) {
// Unable to continue!
MAX::raiseError($this->oDbh, null, PEAR_ERROR_DIE);
}
}
示例7: registerDecorator
/**
* Registers OA_Admin_UI_Decorator for a decorator
*
* @return true if successfully registered, false if there is already decorator
* registered for this name.
*/
function registerDecorator($decoratorName, $path, $className)
{
$decoratorName = strtolower($decoratorName);
if (empty($decoratorName) || empty($path) || empty($className)) {
$errMsg = "DecoratorRegistry::add() Cannot register decorator {$decoratorName} from class {$className} included from {$path}";
return MAX::raiseError($errMsg);
}
if (isset($GLOBALS['_OA_Admin_UI_Decorator_Factory_registered_decorators'][$decoratorName])) {
return false;
}
$GLOBALS['_OA_Admin_UI_Decorator_Factory_registered_decorators'][$decoratorName] = array($path, $className);
return true;
}
示例8: registerJQueryRuleAdaptor
/**
* Registers OA_Admin_UI_Rule_QuickFormToJQueryRuleAdaptor for a given quickform rule
*
* @return true if successfully registered, false if there is already adaptor
* registered for this quickform rule.
*/
function registerJQueryRuleAdaptor($quickFormRuleName, $path, $className)
{
$quickFormRuleName = strtolower($quickFormRuleName);
if (empty($quickFormRuleName) || empty($path) || empty($className)) {
$errMsg = "JQueryRuleAdaptorRegistry::add() Cannot register adaptor for class {$className} for rule {$quickFormRuleName} included from {$path}";
return MAX::raiseError($errMsg);
}
if (isset($GLOBALS['_OA_Admin_UI_Rule_JQueryRuleAdaptorRegistry_registered_adaptors'][$quickFormRuleName])) {
return false;
}
$GLOBALS['_OA_Admin_UI_Rule_JQueryRuleAdaptorRegistry_registered_adaptors'][$quickFormRuleName] = array($path, $className);
return true;
}
示例9: processBucket
/**
* Process an aggregate-type bucket. This is MySQL specific.
*
* @param Plugins_DeliveryLog $oBucket a reference to the using (context) object.
* @param Date $oEnd A PEAR_Date instance, interval_start to process up to (inclusive).
*/
public function processBucket($oBucket, $oEnd)
{
$sTableName = $oBucket->getBucketTableName();
$oMainDbh =& OA_DB_Distributed::singleton();
if (PEAR::isError($oMainDbh)) {
MAX::raiseError($oMainDbh, MAX_ERROR_DBFAILURE, PEAR_ERROR_DIE);
}
OA::debug(' - Processing the ' . $sTableName . ' table for data with operation interval start equal to or before ' . $oEnd->format('%Y-%m-%d %H:%M:%S') . ' ' . $oEnd->tz->getShortName(), PEAR_LOG_INFO);
// Select all rows with interval_start <= previous OI start.
$rsData =& $this->getBucketTableContent($sTableName, $oEnd);
$rowCount = $rsData->getRowCount();
OA::debug(' - ' . $rsData->getRowCount() . ' records found', PEAR_LOG_DEBUG);
if ($rowCount) {
// We can't do bulk inserts with ON DUPLICATE.
$aExecQueries = array();
if ($rsData->fetch()) {
// Get first row
$aRow = $rsData->toArray();
// Prepare INSERT
$sInsert = "INSERT INTO {$sTableName} (" . join(',', array_keys($aRow)) . ") VALUES ";
// Add first row data
$sRow = '(' . join(',', array_map(array(&$oMainDbh, 'quote'), $aRow)) . ')';
$sOnDuplicate = ' ON DUPLICATE KEY UPDATE count = count + ' . $aRow['count'];
// Add first insert
$aExecQueries[] = $sInsert . $sRow . $sOnDuplicate;
// Deal with the other rows
while ($rsData->fetch()) {
$aRow = $rsData->toArray();
$sRow = '(' . join(',', array_map(array(&$oMainDbh, 'quote'), $aRow)) . ')';
$sOnDuplicate = ' ON DUPLICATE KEY UPDATE count = count + ' . $aRow['count'];
$aExecQueries[] = $sInsert . $sRow . $sOnDuplicate;
}
}
if (count($aExecQueries)) {
// Try to disable the binlog for the inserts so we don't
// replicate back out over our logged data.
PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
$result = $oMainDbh->exec('SET SQL_LOG_BIN = 0');
if (PEAR::isError($result)) {
OA::debug('Unable to disable the bin log, proceeding anyway.', PEAR_LOG_WARNING);
}
PEAR::staticPopErrorHandling();
foreach ($aExecQueries as $execQuery) {
$result = $oMainDbh->exec($execQuery);
if (PEAR::isError($result)) {
MAX::raiseError($result, MAX_ERROR_DBFAILURE, PEAR_ERROR_DIE);
}
}
}
}
}
示例10: switch
/**
* Creates a new Field object of the appropriate subclass.
*
* @param string $fieldType The type of field to create.
* @return Admin_UI_Field An instance of the correct {@link Admin_UI_Field} subclass.
*/
function &newField($fieldType)
{
switch ($fieldType) {
case 'advertiser':
$oField = new Admin_UI_AdvertiserIdField();
break;
case 'affiliateid-dropdown':
case 'publisherid-dropdown':
$oField = new Admin_UI_PublisherIdField();
break;
case 'campaignid-dropdown':
$oField = new Admin_UI_CampaignSelectionField();
break;
case 'clientid-dropdown':
$oField = new Admin_UI_AdvertiserIdField();
break;
case 'channelid-dropdown':
$oField = new Admin_UI_ChannelIdField();
break;
case 'date-month':
case 'day-span':
case 'day-span-selector':
$oField = new Admin_UI_DaySpanField();
break;
case 'dropdown':
$oField = new Admin_UI_DropdownField();
break;
case 'edit':
$oField = new Admin_UI_TextField();
break;
case 'scope':
$oField = new Admin_UI_OrganisationSelectionField();
break;
case 'sheet':
$oField = new Admin_UI_SheetSelectionField();
break;
case 'trackerid-dropdown':
$oField = new Admin_UI_TrackerField();
break;
case 'zone-scope':
$oField = new Admin_UI_ZoneScopeField();
break;
case 'zoneid-dropdown':
$oField = new Admin_UI_ZoneIdField();
break;
default:
MAX::raiseError("The report module discovered a field type that it didn't know how to handle.", MAX_ERROR_INVALIDARGS);
}
return $oField;
}
示例11: _getBucketProcessingStrategy
/**
* A private method to get the required default deliveryLog extension
* bucket processing strategy class.
*
* @access private
* @param string $type Either "Aggregate" or "Raw".
* @return OX_Extension_DeliveryLog_BucketProcessingStrategy
*/
private static function _getBucketProcessingStrategy($type)
{
$dbType = $GLOBALS['_MAX']['CONF']['database']['type'];
// Prepare the required filename for the default bucket processing strategy needed
$fileName = LIB_PATH . '/Extension/deliveryLog/' . ucfirst(strtolower($type)) . 'BucketProcessingStrategy' . ucfirst(strtolower($dbType)) . '.php';
// Include the required bucket processing strategy file
if (file_exists($fileName)) {
@(include_once $fileName);
// Prepare the required class name for the default bucket processing strategy needed
$className = 'OX_Extension_DeliveryLog_' . ucfirst(strtolower($type)) . 'BucketProcessingStrategy' . ucfirst(strtolower($dbType));
if (class_exists($className)) {
return new $className();
}
}
$message = 'Unable to instantiate the required default ' . strtolower($type) . " datbase bucket processing strategy for database type '{$dbType}'.";
MAX::raiseError($message, MAX_ERROR_INVALIDARGS, PEAR_ERROR_DIE);
}
示例12: OA_Permission_User
/**
* Class constructor
*
* @param DataObjects_Users $doUsers
* @return OA_Permission_User
*/
function OA_Permission_User($doUsers, $skipDatabaseAccess = false)
{
if (!is_a($doUsers, 'DataObjects_Users')) {
MAX::raiseError('doUser not a DataObjects_Users');
}
// Store user information as array
$this->aUser = $doUsers->toArray();
// For safety reasons, do not store the password
unset($this->aUser['password']);
// Make sure we start with an empty account
$this->_clearAccountData();
if (!$skipDatabaseAccess) {
// Check if the user is linked to the admin account
$this->aUser['is_admin'] = $this->_isAdmin();
$this->loadAccountData($this->aUser['default_account_id']);
} else {
$this->aUser['is_admin'] = false;
}
}
示例13: checkOperationIntervalValue
/**
* A class to test if an operation interval value is valid.
*
* @static
* @param integer $oi The operation interval value in minutes.
* @param mixed True if the operation interval value is valid, a {@link PEAR_Error}
* object with error type MAX_ERROR_INVALIDOPERATIONINT otherwise.
*/
function checkOperationIntervalValue($oi)
{
if ($oi < 1) {
// Operation interval must be at least every minute
$error = 'The operation interval of ' . $oi . ' is invalud';
return MAX::raiseError($error, MAX_ERROR_INVALIDOPERATIONINT);
} elseif ($oi < 60) {
// Operation interval is more often than once an hour
if (60 % $oi != 0) {
// Operation interval must be a factor of 60 minutes
$error = 'The operation interval of ' . $oi . ' is invalud';
return MAX::raiseError($error, MAX_ERROR_INVALIDOPERATIONINT);
}
} elseif ($oi > 60) {
// Operation interval must not be more than 60
$error = 'The operation interval of ' . $oi . ' is invalud';
return MAX::raiseError($error, MAX_ERROR_INVALIDOPERATIONINT);
}
return true;
}
示例14: deliveryBlocked
/**
* A method to determine if the delivery limitation stored will prevent an
* ad from delivering or not, given a time/date.
*
* @abstract
* @param object $oDate PEAR:Date, represeting the time/date to test if the ACL would
* block delivery at that point in time.
* @return mixed A boolean (true if the ad is BLOCKED (i.e. will NOT deliver), false
* if the ad is NOT BLOCKED (i.e. WILL deliver), or a PEAR::Error.
*/
function deliveryBlocked($oDate)
{
$aConf = $GLOBALS['_MAX']['CONF'];
if (!is_a($oDate, 'Date')) {
return MAX::raiseError('Parameter passed to OA_Maintenance_Priority_DeliveryLimitation_Common is not a PEAR::Date object', MAX_ERROR_INVALIDARGS);
}
$aParts = OX_Component::parseComponentIdentifier($this->type);
if (!empty($aParts) && count($aParts) == 3) {
$fileName = MAX_PATH . $aConf['pluginPaths']['plugins'] . join('/', $aParts) . '.delivery.php';
$funcName = "MAX_check{$aParts[1]}_{$aParts[2]}";
$callable = function_exists($funcName);
if (!$callable && file_exists($fileName)) {
require_once $fileName;
$callable = true;
}
$aParams = array('timestamp' => $oDate->getDate(DATE_FORMAT_UNIXTIME));
if ($callable) {
// Return non-delivery
return !$funcName($this->data, $this->comparison, $aParams);
}
}
return MAX::raiseError('Limitation parameter passed to OA_Maintenance_Priority_DeliveryLimitation_Common is not correct', MAX_ERROR_INVALIDARGS);
}
示例15: setAppendCodes
function setAppendCodes($tracker_id, $codes)
{
$tracker_id = is_numeric($tracker_id) ? $tracker_id : (int) $tracker_id;
$query = "\n DELETE FROM {$this->prefix}{$this->conf['table']['tracker_append']}\n WHERE tracker_id = " . $this->oDbh->quote($tracker_id, 'integer');
$result = $this->oDbh->exec($query);
if (PEAR::isError($result)) {
MAX::raiseError($result, MAX_ERROR_DBFAILURE, PEAR_ERROR_DIE);
}
$rank = 0;
$appendcodes = array();
$doTrackerAppend = OA_Dal::factoryDO('tracker_append');
$doTrackerAppend->tracker_id = $tracker_id;
foreach ($codes as $v) {
$tagcode = trim($v['tagcode']);
$paused = $v['paused'] ? 't' : 'f';
$autotrack = $v['autotrack'] ? 't' : 'f';
if (!strlen($tagcode)) {
continue;
}
$doTA = clone $doTrackerAppend;
$doTA->tagcode = $tagcode;
$doTA->paused = $paused;
$doTA->autotrack = $autotrack;
$doTA->rank = ++$rank;
$result = $doTA->insert();
if (empty($result)) {
MAX::raiseError("Could not insert tracker append row", MAX_ERROR_DBFAILURE, PEAR_ERROR_DIE);
}
$appendcodes[] = array('tagcode' => $tagcode, 'paused' => $paused, 'autotrack' => $autotrack);
}
$query = "\n UPDATE {$this->prefix}{$this->conf['table']['trackers']}\n SET appendcode = " . $this->oDbh->quote($this->generateAppendCode($appendcodes)) . "\n WHERE trackerid = " . $this->oDbh->quote($tracker_id);
$result = $this->oDbh->exec($query);
if (PEAR::isError($result)) {
MAX::raiseError($result, MAX_ERROR_DBFAILURE, PEAR_ERROR_DIE);
}
}