Permalink
Browse files

BackwardsCompatibilityBreak - Removed fCore::trigger()

  • Loading branch information...
wbond committed Nov 17, 2008
1 parent 2238719 commit 843e4a01be334eb35f2bb7168e79c4fee46230bb
Showing with 54 additions and 72 deletions.
  1. +6 −42 classes/fCore.php
  2. +6 −6 classes/fDatabase.php
  3. +24 −6 classes/fEmail.php
  4. +9 −9 classes/fResult.php
  5. +9 −9 classes/fUnbufferedResult.php
View
@@ -30,7 +30,6 @@ class fCore
const reset = 'fCore::reset';
const sendMessagesOnShutdown = 'fCore::sendMessagesOnShutdown';
const stringlike = 'fCore::stringlike';
const trigger = 'fCore::trigger';
/**
@@ -552,12 +551,12 @@ static public function getOS()
return 'windows';
}
self::trigger(
'warning',
trigger_error(
self::compose(
'Unable to reliably determine the server OS. Defaulting to %s.',
"'linux/unix'"
)
),
E_USER_WARNING
);
return 'linux/unix';
@@ -652,12 +651,12 @@ static public function handleException($exception)
try {
self::call(self::$exception_handler_callback, self::$exception_handler_parameters);
} catch (Exception $e) {
self::trigger(
'error',
trigger_error(
self::compose(
'An exception was thrown in the %s closing code callback',
'setExceptionHandling()'
)
),
E_USER_ERROR
);
}
}
@@ -800,41 +799,6 @@ static public function stringlike($value)
}
/**
* Triggers a user-level error
*
* The default error handler in PHP will show the line number of this
* method as the triggering code. To get a full backtrace, use
* ::enableErrorHandling().
*
* @param string $error_type The type of error to trigger: `'error'`, `'warning'`, `'notice'`
* @param string $message The error message
* @return void
*/
static public function trigger($error_type, $message)
{
$valid_error_types = array('error', 'warning', 'notice');
if (!in_array($error_type, $valid_error_types)) {
self::toss(
'fProgrammerException',
self::compose(
'Invalid error type, %1$s, specified. Must be one of: %2$s.',
self::dump($error_type),
join(', ', $valid_error_types)
)
);
}
static $error_type_map = array(
'error' => E_USER_ERROR,
'warning' => E_USER_WARNING,
'notice' => E_USER_NOTICE
);
trigger_error($message, $error_type_map[$error_type]);
}
/**
* Forces use as a static class
*
View
@@ -1471,14 +1471,14 @@ public function query($sql)
);
if ($this->slow_query_threshold && $query_time > $this->slow_query_threshold) {
fCore::trigger(
'warning',
trigger_error(
self::compose(
'The following query took %1$s milliseconds, which is above the slow query threshold of %2$s:%3$s',
$query_time,
$this->slow_query_threshold,
"\n" . $result->getSQL()
)
),
E_USER_WARNING
);
}
@@ -1667,14 +1667,14 @@ public function unbufferedQuery($sql)
);
if ($this->slow_query_threshold && $query_time > $this->slow_query_threshold) {
fCore::trigger(
'warning',
trigger_error(
self::compose(
'The following query took %1$s milliseconds, which is above the slow query threshold of %2$s:%3$s',
$query_time,
$this->slow_query_threshold,
"\n" . $result->getSQL()
)
),
E_USER_WARNING
);
}
View
@@ -121,8 +121,14 @@ static public function fixQmail()
if (!$sendmail_command) {
self::$convert_crlf = TRUE;
fCore::trigger('warning', 'The proper fix for sending through qmail is not possible since the sendmail path is not set');
fCore::trigger('warning', 'Trying to fix qmail by converting all \r\n to \n. This will cause invalid (but possibly functioning) email headers to be generated.');
trigger_error(
self::compose('The proper fix for sending through qmail is not possible since the sendmail path is not set'),
E_USER_WARNING
);
trigger_error(
self::compose('Trying to fix qmail by converting all \r\n to \n. This will cause invalid (but possibly functioning) email headers to be generated.'),
E_USER_WARNING
);
}
$sendmail_command_parts = explode(' ', $sendmail_command, 2);
@@ -158,11 +164,23 @@ static public function fixQmail()
} else {
self::$convert_crlf = TRUE;
if ($safe_mode) {
fCore::trigger('warning', 'The proper fix for sending through qmail is not possible since safe mode is turned on and the sendmail binary is not in one of the paths defined by the safe_mode_exec_dir ini setting');
fCore::trigger('warning', 'Trying to fix qmail by converting all \r\n to \n. This will cause invalid (but possibly functioning) email headers to be generated.');
trigger_error(
self::compose('The proper fix for sending through qmail is not possible since safe mode is turned on and the sendmail binary is not in one of the paths defined by the safe_mode_exec_dir ini setting'),
E_USER_WARNING
);
trigger_error(
self::compose('Trying to fix qmail by converting all \r\n to \n. This will cause invalid (but possibly functioning) email headers to be generated.'),
E_USER_WARNING
);
} else {
fCore::trigger('warning', 'The proper fix for sending through qmail is not possible since the sendmail binary could not be found or is not executable');
fCore::trigger('warning', 'Trying to fix qmail by converting all \r\n to \n. This will cause invalid (but possibly functioning) email headers to be generated.');
trigger_error(
self::compose('The proper fix for sending through qmail is not possible since the sendmail binary could not be found or is not executable'),
E_USER_WARNING
);
trigger_error(
self::compose('Trying to fix qmail by converting all \r\n to \n. This will cause invalid (but possibly functioning) email headers to be generated.'),
E_USER_WARNING
);
}
}
}
View
@@ -403,30 +403,30 @@ private function fixDblibMSSQLDriver($row)
foreach ($row as $key => $value) {
if ($value == ' ') {
$row[$key] = '';
fCore::trigger(
'notice',
trigger_error(
self::compose(
'A single space was detected coming out of the database and was converted into an empty string - see %s for more information',
'http://bugs.php.net/bug.php?id=26315'
)
),
E_USER_NOTICE
);
}
if (strlen($key) == 30) {
fCore::trigger(
'notice',
trigger_error(
self::compose(
'A column name exactly 30 characters in length was detected coming out of the database - this column name may be truncated, see %s for more information.',
'http://bugs.php.net/bug.php?id=23990'
)
),
E_USER_NOTICE
);
}
if (strlen($value) == 256) {
fCore::trigger(
'notice',
trigger_error(
self::compose(
'A value exactly 255 characters in length was detected coming out of the database - this value may be truncated, see %s for more information.',
'http://bugs.php.net/bug.php?id=37757'
)
),
E_USER_NOTICE
);
}
}
@@ -338,30 +338,30 @@ private function fixDblibMSSQLDriver($row)
foreach ($row as $key => $value) {
if ($value == ' ') {
$row[$key] = '';
fCore::trigger(
'notice',
trigger_error(
self::compose(
'A single space was detected coming out of the database and was converted into an empty string - see %s for more information',
'http://bugs.php.net/bug.php?id=26315'
)
),
E_USER_NOTICE
);
}
if (strlen($key) == 30) {
fCore::trigger(
'notice',
trigger_error(
self::compose(
'A column name exactly 30 characters in length was detected coming out of the database - this column name may be truncated, see %s for more information.',
'http://bugs.php.net/bug.php?id=23990'
)
),
E_USER_NOTICE
);
}
if (strlen($value) == 256) {
fCore::trigger(
'notice',
trigger_error(
self::compose(
'A value exactly 255 characters in length was detected coming out of the database - this value may be truncated, see %s for more information.',
'http://bugs.php.net/bug.php?id=37757'
)
),
E_USER_NOTICE
);
}
}

0 comments on commit 843e4a0

Please sign in to comment.