Skip to content

Commit

Permalink
t
Browse files Browse the repository at this point in the history
dividing language domains

cake - end user
cake_error - error messages
cake_developer - not an error, just for the developer
  • Loading branch information
AD7six committed Mar 19, 2011
1 parent b19ca3c commit 268c061
Show file tree
Hide file tree
Showing 13 changed files with 35 additions and 35 deletions.
4 changes: 2 additions & 2 deletions lib/Cake/Model/AclNode.php
Expand Up @@ -133,7 +133,7 @@ public function node($ref = null) {
$model = ClassRegistry::init(array('class' => $name, 'alias' => $name));

if (empty($model)) {
trigger_error(__d('cake', "Model class '%s' not found in AclNode::node() when trying to bind %s object", $type, $this->alias), E_USER_WARNING);
trigger_error(__d('cake_error', "Model class '%s' not found in AclNode::node() when trying to bind %s object", $type, $this->alias), E_USER_WARNING);
return null;
}

Expand Down Expand Up @@ -178,7 +178,7 @@ public function node($ref = null) {
$result = $db->read($this, $queryData, -1);

if (!$result) {
trigger_error(__d('cake', "AclNode::node() - Couldn't find %s node identified by \"%s\"", $type, print_r($ref, true)), E_USER_WARNING);
trigger_error(__d('cake_error', "AclNode::node() - Couldn't find %s node identified by \"%s\"", $type, print_r($ref, true)), E_USER_WARNING);
}
}
return $result;
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Model/Behavior/AclBehavior.php
Expand Up @@ -54,7 +54,7 @@ public function setup($model, $config = array()) {
}
$model->{$type} = ClassRegistry::init($type);
if (!method_exists($model, 'parentNode')) {
trigger_error(__d('cake', 'Callback parentNode() not defined in %s', $model->alias), E_USER_WARNING);
trigger_error(__d('cake_error', 'Callback parentNode() not defined in %s', $model->alias), E_USER_WARNING);
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Model/Behavior/ContainableBehavior.php
Expand Up @@ -359,7 +359,7 @@ public function containments($Model, $contain, $containments = array(), $throwEr

if (!isset($Model->{$name}) || !is_object($Model->{$name})) {
if ($throwErrors) {
trigger_error(__d('cake', 'Model "%s" is not associated with model "%s"', $Model->alias, $name), E_USER_WARNING);
trigger_error(__d('cake_error', 'Model "%s" is not associated with model "%s"', $Model->alias, $name), E_USER_WARNING);
}
continue;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/Cake/Model/Behavior/TranslateBehavior.php
Expand Up @@ -55,7 +55,7 @@ public function setup($model, $config = array()) {
$db = ConnectionManager::getDataSource($model->useDbConfig);
if (!$db->connected) {
trigger_error(
__d('cake', 'Datasource %s for TranslateBehavior of model %s is not connected', $model->useDbConfig, $model->alias),
__d('cake_error', 'Datasource %s for TranslateBehavior of model %s is not connected', $model->useDbConfig, $model->alias),
E_USER_ERROR
);
return false;
Expand Down Expand Up @@ -426,7 +426,7 @@ function bindTranslation($model, $fields, $reset = true) {
foreach (array('hasOne', 'hasMany', 'belongsTo', 'hasAndBelongsToMany') as $type) {
if (isset($model->{$type}[$association]) || isset($model->__backAssociation[$type][$association])) {
trigger_error(
__d('cake', 'Association %s is already binded to model %s', $association, $model->alias),
__d('cake_error', 'Association %s is already binded to model %s', $association, $model->alias),
E_USER_ERROR
);
return false;
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Model/BehaviorCollection.php
Expand Up @@ -219,7 +219,7 @@ public function dispatchMethod($model, $method, $params = array(), $strict = fal
$method = $this->hasMethod($method, true);

if ($strict && empty($method)) {
trigger_error(__d('cake', "BehaviorCollection::dispatchMethod() - Method %s not found in any attached behavior", $method), E_USER_WARNING);
trigger_error(__d('cake_error', "BehaviorCollection::dispatchMethod() - Method %s not found in any attached behavior", $method), E_USER_WARNING);
return null;
}
if (empty($method)) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Model/CakeSchema.php
Expand Up @@ -592,7 +592,7 @@ public function __columns(&$Obj) {
$value['key'] = 'primary';
}
if (!isset($db->columns[$value['type']])) {
trigger_error(__d('cake', 'Schema generation error: invalid column type %s does not exist in DBO', $value['type']), E_USER_NOTICE);
trigger_error(__d('cake_error', 'Schema generation error: invalid column type %s does not exist in DBO', $value['type']), E_USER_NOTICE);
continue;
} else {
$defaultCol = $db->columns[$value['type']];
Expand Down
8 changes: 4 additions & 4 deletions lib/Cake/Model/Datasource/CakeSession.php
Expand Up @@ -254,7 +254,7 @@ public static function delete($name) {
self::__overwrite($_SESSION, Set::remove($_SESSION, $name));
return (self::check($name) == false);
}
self::__setError(2, __d('cake', "%s doesn't exist", $name));
self::__setError(2, __d('cake_error', "%s doesn't exist", $name));
return false;
}

Expand Down Expand Up @@ -480,7 +480,7 @@ protected static function _configureSession() {
foreach ($sessionConfig['ini'] as $setting => $value) {
if (ini_set($setting, $value) === false) {
throw new CakeSessionException(sprintf(
__d('cake', 'Unable to configure the session, setting %s failed.'),
__d('cake_error', 'Unable to configure the session, setting %s failed.'),
$setting
));
}
Expand Down Expand Up @@ -514,13 +514,13 @@ protected static function _getHandler($handler) {
list($plugin, $class) = pluginSplit($handler, true);
App::uses($class, $plugin . 'Model/Datasource/Session');
if (!class_exists($class)) {
throw new CakeSessionException(__d('cake', 'Could not load %s to handle the session.', $class));
throw new CakeSessionException(__d('cake_error', 'Could not load %s to handle the session.', $class));
}
$handler = new $class();
if ($handler instanceof CakeSessionHandlerInterface) {
return $handler;
}
throw new CakeSessionException(__d('cake', 'Chosen SessionHandler does not implement CakeSessionHandlerInterface it cannot be used with an engine key.'));
throw new CakeSessionException(__d('cake_error', 'Chosen SessionHandler does not implement CakeSessionHandlerInterface it cannot be used with an engine key.'));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Model/Datasource/Database/Mssql.php
Expand Up @@ -116,7 +116,7 @@ class DboMssql extends DboSource {
function __construct($config, $autoConnect = true) {
if ($autoConnect) {
if (!function_exists('mssql_min_message_severity')) {
trigger_error(__d('cake', "PHP SQL Server interface is not installed, cannot continue. For troubleshooting information, see http://php.net/mssql/"), E_USER_WARNING);
trigger_error(__d('cake_error', "PHP SQL Server interface is not installed, cannot continue. For troubleshooting information, see http://php.net/mssql/"), E_USER_WARNING);
}
mssql_min_message_severity(15);
mssql_min_error_severity(2);
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Model/Datasource/Database/Mysql.php
Expand Up @@ -298,7 +298,7 @@ function describe($model) {
$fields = false;
$cols = $this->_execute('SHOW FULL COLUMNS FROM ' . $this->fullTableName($model));
if (!$cols) {
throw new CakeException(__d('cake', 'Could not describe table for %s', $model->name));
throw new CakeException(__d('cake_error', 'Could not describe table for %s', $model->name));
}

foreach ($cols as $column) {
Expand Down
6 changes: 3 additions & 3 deletions lib/Cake/Model/Datasource/Database/Oracle.php
Expand Up @@ -571,7 +571,7 @@ function truncate($table, $reset = 0) {
*/
function constraint($action, $table) {
if (empty($table)) {
trigger_error(__d('cake', 'Must specify table to operate on constraints'));
trigger_error(__d('cake_error', 'Must specify table to operate on constraints'));
}

$table = strtoupper($table);
Expand Down Expand Up @@ -629,7 +629,7 @@ function constraint($action, $table) {
return $constraints;
break;
default:
trigger_error(__d('cake', 'DboOracle::constraint() accepts only enable, disable, or list'));
trigger_error(__d('cake_error', 'DboOracle::constraint() accepts only enable, disable, or list'));
}
}
return true;
Expand Down Expand Up @@ -976,7 +976,7 @@ function queryAssociation($model, &$linkModel, $type, $association, $assocData,
if ($query = $this->generateAssociationQuery($model, $linkModel, $type, $association, $assocData, $queryData, $external, $resultSet)) {
if (!isset($resultSet) || !is_array($resultSet)) {
if (Configure::read('debug') > 0) {
echo '<div style = "font: Verdana bold 12px; color: #FF0000">' . __d('cake', 'SQL Error in model %s:', $model->alias) . ' ';
echo '<div style = "font: Verdana bold 12px; color: #FF0000">' . __d('cake_error', 'SQL Error in model %s:', $model->alias) . ' ';
if (isset($this->error) && $this->error != null) {
echo $this->error;
}
Expand Down
10 changes: 5 additions & 5 deletions lib/Cake/Model/Datasource/Database/Sqlite.php
Expand Up @@ -231,7 +231,7 @@ function update($model, $fields = array(), $values = null, $conditions = null) {
*/
function truncate($table) {
$this->_execute('DELETE FROM sqlite_sequence where name=' . $this->fullTableName($table));
return $this->execute('DELETE FROM ' . $this->fullTableName($table));
return $this->execute('DELETE FROM ' . $this->fullTableName($table));
}

/**
Expand Down Expand Up @@ -387,12 +387,12 @@ function buildColumn($column) {
extract($column);

if (empty($name) || empty($type)) {
trigger_error('Column name or type not defined in schema', E_USER_WARNING);
trigger_error(__d('cake_error', 'Column name or type not defined in schema'), E_USER_WARNING);
return null;
}

if (!isset($this->columns[$type])) {
trigger_error(__d('cake', 'Column type %s does not exist', $type), E_USER_WARNING);
trigger_error(__d('cake_error', 'Column type %s does not exist', $type), E_USER_WARNING);
return null;
}

Expand Down Expand Up @@ -473,7 +473,7 @@ function index($model) {
$table = $this->fullTableName($model);
if ($table) {
$indexes = $this->query('PRAGMA index_list(' . $table . ')');

if (is_bool($indexes)) {
return array();
}
Expand Down Expand Up @@ -554,4 +554,4 @@ public function dropSchema(CakeSchema $schema, $table = null) {
}
return $out;
}
}
}
18 changes: 9 additions & 9 deletions lib/Cake/Model/Datasource/DboSource.php
Expand Up @@ -941,11 +941,11 @@ public function showQuery($sql) {
if (Configure::read('debug') > 0) {
$out = null;
if ($error) {
trigger_error('<span style="color:Red;text-align:left"><b>' . __d('cake', 'SQL Error:') . "</b> {$this->error}</span>", E_USER_WARNING);
trigger_error('<span style="color:Red;text-align:left"><b>' . __d('cake_developer', 'SQL Error:') . "</b> {$this->error}</span>", E_USER_WARNING);
} else {
$out = ('<small>[' . __d('cake', 'Aff:%s Num:%s Took:%sms', $this->affected, $this->numRows, $this->took) . ']</small>');
$out = ('<small>[' . __d('cake_developer', 'Aff:%s Num:%s Took:%sms', $this->affected, $this->numRows, $this->took) . ']</small>');
}
pr(sprintf('<p style="text-align:left"><b>' . __d('cake', 'Query:') . '</b> %s %s</p>', $sql, $out));
pr(sprintf('<p style="text-align:left"><b>' . __d('cake_developer', 'Query:') . '</b> %s %s</p>', $sql, $out));
}
}

Expand Down Expand Up @@ -1169,7 +1169,7 @@ public function queryAssociation($model, &$linkModel, $type, $association, $asso
if ($query = $this->generateAssociationQuery($model, $linkModel, $type, $association, $assocData, $queryData, $external, $resultSet)) {
if (!is_array($resultSet)) {
if (Configure::read('debug') > 0) {
echo '<div style = "font: Verdana bold 12px; color: #FF0000">' . __d('cake', 'SQL Error in model %s:', $model->alias) . ' ';
echo '<div style = "font: Verdana bold 12px; color: #FF0000">' . __d('cake_developer', 'SQL Error in model %s:', $model->alias) . ' ';
if (isset($this->error) && $this->error != null) {
echo $this->error;
}
Expand Down Expand Up @@ -2725,7 +2725,7 @@ public function hasAny($Model, $sql) {
*/
public function length($real) {
if (!preg_match_all('/([\w\s]+)(?:\((\d+)(?:,(\d+))?\))?(\sunsigned)?(\szerofill)?/', $real, $result)) {
trigger_error(__d('cake', "FIXME: Can't parse field: " . $real), E_USER_WARNING);
trigger_error(__d('cake_error', "FIXME: Can't parse field: " . $real), E_USER_WARNING);
$col = str_replace(array(')', 'unsigned'), '', $real);
$limit = null;

Expand Down Expand Up @@ -2833,7 +2833,7 @@ public function index($model) {
*/
public function createSchema($schema, $tableName = null) {
if (!is_a($schema, 'CakeSchema')) {
trigger_error(__d('cake', 'Invalid schema object'), E_USER_WARNING);
trigger_error(__d('cake_error', 'Invalid schema object'), E_USER_WARNING);
return null;
}
$out = '';
Expand Down Expand Up @@ -2915,12 +2915,12 @@ public function buildColumn($column) {
extract(array_merge(array('null' => true), $column));

if (empty($name) || empty($type)) {
trigger_error(__d('cake', 'Column name or type not defined in schema'), E_USER_WARNING);
trigger_error(__d('cake_error', 'Column name or type not defined in schema'), E_USER_WARNING);
return null;
}

if (!isset($this->columns[$type])) {
trigger_error(__d('cake', 'Column type %s does not exist', $type), E_USER_WARNING);
trigger_error(__d('cake_error', 'Column type %s does not exist', $type), E_USER_WARNING);
return null;
}

Expand Down Expand Up @@ -3146,4 +3146,4 @@ public function getQueryCache($sql, $params = array()) {
return false;
}

}
}
8 changes: 4 additions & 4 deletions lib/Cake/Model/Model.php
Expand Up @@ -1005,7 +1005,7 @@ public function schema($field = false) {
public function getColumnTypes() {
$columns = $this->schema();
if (empty($columns)) {
trigger_error(__d('cake', '(Model::getColumnTypes) Unable to build model field data. If you are using a model without a database table, try implementing schema()'), E_USER_WARNING);
trigger_error(__d('cake_error', '(Model::getColumnTypes) Unable to build model field data. If you are using a model without a database table, try implementing schema()'), E_USER_WARNING);
}
$cols = array();
foreach ($columns as $field => $values) {
Expand Down Expand Up @@ -2602,7 +2602,7 @@ function invalidFields($options = array()) {
if (isset($validator['message'])) {
$message = $validator['message'];
} else {
$message = __d('cake', 'This field cannot be left blank');
$message = __d('cake_error', 'This field cannot be left blank');
}

if (
Expand Down Expand Up @@ -2650,7 +2650,7 @@ function invalidFields($options = array()) {
} elseif (!is_array($validator['rule'])) {
$valid = preg_match($rule, $data[$fieldName]);
} elseif (Configure::read('debug') > 0) {
trigger_error(__d('cake', 'Could not find validation handler %s for %s', $rule, $fieldName), E_USER_WARNING);
trigger_error(__d('cake_error', 'Could not find validation handler %s for %s', $rule, $fieldName), E_USER_WARNING);
}

if (!$valid || (is_string($valid) && strlen($valid) > 0)) {
Expand Down Expand Up @@ -2957,7 +2957,7 @@ public function joinModel($assoc, $keys = array()) {
return array($with, array_unique(array_merge($assoc[$with], $keys)));
}
trigger_error(
__d('cake', 'Invalid join model settings in %s', $model->alias),
__d('cake_error', 'Invalid join model settings in %s', $model->alias),
E_USER_WARNING
);
}
Expand Down

0 comments on commit 268c061

Please sign in to comment.