Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/2.0' into 2.0-plugin-loader
Browse files Browse the repository at this point in the history
Conflicts:
	lib/Cake/tests/test_app/plugins/TestPlugin/Model/test_plugin_post.php
	lib/Cake/tests/test_app/plugins/test_plugin/Model/TestPluginPost.php
	lib/Cake/tests/test_app/plugins/test_plugin/Model/test_plugin_post.php
  • Loading branch information
lorenzo committed May 9, 2011
2 parents 8ccbd6f + 0026a6a commit 77788a9
Show file tree
Hide file tree
Showing 112 changed files with 2,338 additions and 1,067 deletions.
3 changes: 2 additions & 1 deletion .gitignore
@@ -1,4 +1,5 @@
/app/config
/app/tmp
/plugins
/vendors
/vendors
.DS_Store
12 changes: 3 additions & 9 deletions README
Expand Up @@ -18,17 +18,11 @@ http://bakery.cakephp.org
The Show - live and archived podcasts about CakePHP and more
http://live.cakephp.org

CakePHP TV - screen casts from events and video tutorials
http://tv.cakephp.org

CakePHP Google Group - community mailing list and forum
http://groups.google.com/group/cake-php

#cakephp on irc.freenode.net - chat with CakePHP developers
irc://irc.freenode.net/cakephp

CakeForge - open development for CakePHP
http://cakeforge.org

CakePHP gear
http://www.cafepress.com/cakefoundation

Recommended Reading
http://astore.amazon.com/cakesoftwaref-20/
2 changes: 1 addition & 1 deletion app/config/core.php
Expand Up @@ -286,7 +286,7 @@

/**
* Pick the caching engine to use. If APC is enabled use it.
* If running via cli - apc is disabled by default. ensure it's avaiable and enabled in this case
* If running via cli - apc is disabled by default. ensure it's available and enabled in this case
*
*/
$engine = 'File';
Expand Down
36 changes: 13 additions & 23 deletions lib/Cake/Console/Command/AclShell.php
Expand Up @@ -71,10 +71,8 @@ public function startup() {

if (!in_array(Configure::read('Acl.classname'), array('DbAcl', 'DB_ACL'))) {
$out = "--------------------------------------------------\n";
$out .= __d('cake_console', 'Error: Your current Cake configuration is set to') . "\n";
$out .= __d('cake_console', 'an ACL implementation other than DB. Please change') . "\n";
$out .= __d('cake_console', 'your core config to reflect your decision to use') . "\n";
$out .= __d('cake_console', 'DbAcl before attempting to use this script') . ".\n";
$out .= __d('cake_console', 'Error: Your current Cake configuration is set to an ACL implementation other than DB.') . "\n";
$out .= __d('cake_console', 'Please change your core config to reflect your decision to use DbAcl before attempting to use this script') . "\n";
$out .= "--------------------------------------------------\n";
$out .= __d('cake_console', 'Current ACL Classname: %s', Configure::read('Acl.classname')) . "\n";
$out .= "--------------------------------------------------\n";
Expand Down Expand Up @@ -150,7 +148,7 @@ public function delete() {
$nodeId = $this->_getNodeId($class, $identifier);

if (!$this->Acl->{$class}->delete($nodeId)) {
$this->error(__d('cake_console', 'Node Not Deleted') . __d('cake_console', 'There was an error deleting the %s. Check that the node exists', $class) . ".\n");
$this->error(__d('cake_console', 'Node Not Deleted') . __d('cake_console', 'There was an error deleting the %s. Check that the node exists.', $class) . "\n");
}
$this->out(__d('cake_console', '<success>%s deleted.</success>', $class), 2);
}
Expand Down Expand Up @@ -263,7 +261,7 @@ public function deny() {
}

/**
* Set an ARO to inhermit permission to an ACO.
* Set an ARO to inherit permission to an ACO.
*
*/
public function inherit() {
Expand Down Expand Up @@ -308,7 +306,7 @@ public function view() {
$this->error(__d('cake_console', '%s not found', $this->args[0]), __d('cake_console', 'No tree returned.'));
}
}
$this->out($class . " tree:");
$this->out($class . ' tree:');
$this->hr();

$stack = array();
Expand Down Expand Up @@ -357,7 +355,7 @@ public function getOptionParser() {
'help' => __d('cake_console', 'Type of node to create.')
);

$parser->description('A console tool for managing the DbAcl')
$parser->description(__d('cake_console', 'A console tool for managing the DbAcl'))
->addSubcommand('create', array(
'help' => __d('cake_console', 'Create a new ACL node'),
'parser' => array(
Expand Down Expand Up @@ -407,8 +405,7 @@ public function getOptionParser() {
'parser' => array(
'description' => array(
__d('cake_console', "Returns the path to the ACL object specified by <node>."),
__d('cake_console', "This command is useful in determining the inhertiance of permissions"),
__d('cake_console', "for a certain object in the tree.")
__d('cake_console', "This command is useful in determining the inheritance of permissions for a certain object in the tree.")
),
'arguments' => array(
'type' => $type,
Expand All @@ -422,9 +419,7 @@ public function getOptionParser() {
'help' => __d('cake_console', 'Check the permissions between an ACO and ARO.'),
'parser' => array(
'description' => array(
__d('cake_console', "Use this command to grant ACL permissions. Once executed, the ARO "),
__d('cake_console', "specified (and its children, if any) will have ALLOW access to the"),
__d('cake_console', "specified ACO action (and the ACO's children, if any).")
__d('cake_console', 'Use this command to grant ACL permissions. Once executed, the ARO specified (and its children, if any) will have ALLOW access to the specified ACO action (and the ACO\'s children, if any).')
),
'arguments' => array(
'aro' => array('help' => __d('cake_console', 'ARO to check.'), 'required' => true),
Expand All @@ -436,9 +431,7 @@ public function getOptionParser() {
'help' => __d('cake_console', 'Grant an ARO permissions to an ACO.'),
'parser' => array(
'description' => array(
__d('cake_console', "Use this command to grant ACL permissions. Once executed, the ARO"),
__d('cake_console', "specified (and its children, if any) will have ALLOW access to the"),
__d('cake_console', "specified ACO action (and the ACO's children, if any).")
__d('cake_console', 'Use this command to grant ACL permissions. Once executed, the ARO specified (and its children, if any) will have ALLOW access to the specified ACO action (and the ACO\'s children, if any).')
),
'arguments' => array(
'aro' => array('help' => __d('cake_console', 'ARO to grant permission to.'), 'required' => true),
Expand All @@ -450,9 +443,7 @@ public function getOptionParser() {
'help' => __d('cake_console', 'Deny an ARO permissions to an ACO.'),
'parser' => array(
'description' => array(
__d('cake_console', "Use this command to deny ACL permissions. Once executed, the ARO"),
__d('cake_console', "specified (and its children, if any) will have DENY access to the"),
__d('cake_console', "specified ACO action (and the ACO's children, if any).")
__d('cake_console', 'Use this command to deny ACL permissions. Once executed, the ARO specified (and its children, if any) will have DENY access to the specified ACO action (and the ACO\'s children, if any).')
),
'arguments' => array(
'aro' => array('help' => __d('cake_console', 'ARO to deny.'), 'required' => true),
Expand All @@ -464,11 +455,10 @@ public function getOptionParser() {
'help' => __d('cake_console', 'Inherit an ARO\'s parent permissions.'),
'parser' => array(
'description' => array(
__d('cake_console', "Use this command to force a child ARO object to inherit its"),
__d('cake_console', "permissions settings from its parent.")
__d('cake_console', "Use this command to force a child ARO object to inherit its permissions settings from its parent.")
),
'arguments' => array(
'aro' => array('help' => __d('cake_console', 'ARO to have permisssions inherit.'), 'required' => true),
'aro' => array('help' => __d('cake_console', 'ARO to have permissions inherit.'), 'required' => true),
'aco' => array('help' => __d('cake_console', 'ACO to inherit permissions on.'), 'required' => true),
'action' => array('help' => __d('cake_console', 'Action to inherit'), 'default' => 'all')
)
Expand Down Expand Up @@ -526,7 +516,7 @@ public function nodeExists() {
}

/**
* Parse an identifier into Model.foriegnKey or an alias.
* Parse an identifier into Model.foreignKey or an alias.
* Takes an identifier determines its type and returns the result as used by other methods.
*
* @param string $identifier Identifier to parse
Expand Down
8 changes: 4 additions & 4 deletions lib/Cake/Console/Command/ApiShell.php
Expand Up @@ -36,7 +36,7 @@ class ApiShell extends Shell {
public $paths = array();

/**
* Override intialize of the Shell
* Override initialize of the Shell
*
*/
public function initialize() {
Expand Down Expand Up @@ -140,9 +140,9 @@ public function main() {
public function getOptionParser() {
$parser = parent::getOptionParser();
$parser->addArgument('type', array(
'help' => 'Either a full path or type of class (model, behavior, controller, component, view, helper)'
'help' => __d('cake_console', 'Either a full path or type of class (model, behavior, controller, component, view, helper)')
))->addArgument('className', array(
'help' => 'A CakePHP core class name (e.g: Component, HtmlHelper).'
'help' => __d('cake_console', 'A CakePHP core class name (e.g: Component, HtmlHelper).')
))->addOption('method', array(
'short' => 'm',
'help' => __d('cake_console', 'The specific method you want help on.')
Expand Down Expand Up @@ -181,7 +181,7 @@ public function help() {
} elseif (isset($commands[strtolower($this->args[1])])) {
$this->out($commands[strtolower($this->args[1])] . "\n\n");
} else {
$this->out("Command '" . $this->args[1] . "' not found");
$this->out(__d('cake_console', 'Command %s not found', $this->args[1]));
}
}

Expand Down
31 changes: 15 additions & 16 deletions lib/Cake/Console/Command/BakeShell.php
Expand Up @@ -79,16 +79,16 @@ public function main() {
$this->args = null;
return $this->DbConfig->execute();
}
$this->out('Interactive Bake Shell');
$this->out(__d('cake_console', 'Interactive Bake Shell'));
$this->hr();
$this->out('[D]atabase Configuration');
$this->out('[M]odel');
$this->out('[V]iew');
$this->out('[C]ontroller');
$this->out('[P]roject');
$this->out('[F]ixture');
$this->out('[T]est case');
$this->out('[Q]uit');
$this->out(__d('cake_console', '[D]atabase Configuration'));
$this->out(__d('cake_console', '[M]odel'));
$this->out(__d('cake_console', '[V]iew'));
$this->out(__d('cake_console', '[C]ontroller'));
$this->out(__d('cake_console', '[P]roject'));
$this->out(__d('cake_console', '[F]ixture'));
$this->out(__d('cake_console', '[T]est case'));
$this->out(__d('cake_console', '[Q]uit'));

$classToBake = strtoupper($this->in(__d('cake_console', 'What would you like to Bake?'), array('D', 'M', 'V', 'C', 'P', 'F', 'T', 'Q')));
switch ($classToBake) {
Expand Down Expand Up @@ -199,12 +199,11 @@ public function all() {
*/
public function getOptionParser() {
$parser = parent::getOptionParser();
return $parser->description(
'The Bake script generates controllers, views and models for your application.' .
'If run with no command line arguments, Bake guides the user through the class' .
'creation process. You can customize the generation process by telling Bake' .
'where different parts of your application are using command line arguments.'
)->addSubcommand('all', array(
return $parser->description(__d('cake_console',
'The Bake script generates controllers, views and models for your application.'
. ' If run with no command line arguments, Bake guides the user through the class creation process.'
. ' You can customize the generation process by telling Bake where different parts of your application are using command line arguments.'
))->addSubcommand('all', array(
'help' => __d('cake_console', 'Bake a complete MVC. optional <name> of a Model'),
))->addSubcommand('project', array(
'help' => __d('cake_console', 'Bake a new app folder in the path supplied or in current directory if no path is specified'),
Expand All @@ -231,7 +230,7 @@ public function getOptionParser() {
'help' => __d('cake_console', 'Bake a unit test.'),
'parser' => $this->Test->getOptionParser()
))->addOption('connection', array(
'help' => __d('cake_console', 'Database connection to use in conjunction with `bake all`.'),
'help' => __d('cake_console', 'Database connection to use in conjunction with `bake all`.'),
'short' => 'c',
'default' => 'default'
));
Expand Down
17 changes: 8 additions & 9 deletions lib/Cake/Console/Command/CommandListShell.php
Expand Up @@ -43,18 +43,17 @@ public function startup() {
*/
public function main() {
if (empty($this->params['xml'])) {
$this->out("<info>Current Paths:</info>", 2);
$this->out(__d('cake_console', "<info>Current Paths:</info>"), 2);
$this->out(" -app: ". APP_DIR);
$this->out(" -working: " . rtrim(APP_PATH, DS));
$this->out(" -root: " . rtrim(ROOT, DS));
$this->out(" -core: " . rtrim(CORE_PATH, DS));
$this->out("");
$this->out("<info>Changing Paths:</info>", 2);
$this->out("Your working path should be the same as your application path");
$this->out("to change your path use the '-app' param.");
$this->out("Example: -app relative/path/to/myapp or -app /absolute/path/to/myapp", 2);
$this->out(__d('cake_console', "<info>Changing Paths:</info>"), 2);
$this->out(__d('cake_console', "Your working path should be the same as your application path to change your path use the '-app' param."));
$this->out(__d('cake_console', "Example: -app relative/path/to/myapp or -app /absolute/path/to/myapp"), 2);

$this->out("<info>Available Shells:</info>", 2);
$this->out(__d('cake_console', "<info>Available Shells:</info>"), 2);
}

$shellList = $this->_getShellList();
Expand Down Expand Up @@ -140,8 +139,8 @@ protected function _asText($shellList) {
$this->out(" " . $row);
}
$this->out();
$this->out("To run a command, type <info>cake shell_name [args]</info>");
$this->out("To get help on a specific command, type <info>cake shell_name --help</info>", 2);
$this->out(__d('cake_console', "To run a command, type <info>cake shell_name [args]</info>"));
$this->out(__d('cake_console', "To get help on a specific command, type <info>cake shell_name --help</info>"), 2);
}

/**
Expand Down Expand Up @@ -212,7 +211,7 @@ protected function _asXml($shellList) {
*/
public function getOptionParser() {
$parser = parent::getOptionParser();
return $parser->description('Get the list of available shells for this CakePHP application.')
return $parser->description(__d('cake_console', 'Get the list of available shells for this CakePHP application.'))
->addOption('xml', array(
'help' => __d('cake_console', 'Get the listing as XML.'),
'boolean' => true
Expand Down
35 changes: 19 additions & 16 deletions lib/Cake/Console/Command/ConsoleShell.php
Expand Up @@ -47,7 +47,7 @@ class ConsoleShell extends Shell {
public $models = array();

/**
* Override intialize of the Shell
* Override initialize of the Shell
*
*/
public function initialize() {
Expand All @@ -61,8 +61,8 @@ public function initialize() {
App::uses($class, 'Model');
$this->{$class} = new $class();
}
$this->out('Model classes:');
$this->out('--------------');
$this->out(__d('cake_console', 'Model classes:'));
$this->hr();

foreach ($this->models as $model) {
$this->out(" - {$model}");
Expand Down Expand Up @@ -151,7 +151,7 @@ public function main($command = null) {
return true;
break;
case 'models':
$this->out('Model classes:');
$this->out(__d('cake_console', 'Model classes:'));
$this->hr();
foreach ($this->models as $model) {
$this->out(" - {$model}");
Expand All @@ -169,9 +169,10 @@ public function main($command = null) {

if ($this->_isValidModel($modelA) && $this->_isValidModel($modelB) && in_array($association, $this->associations)) {
$this->{$modelA}->bindModel(array($association => array($modelB => array('className' => $modelB))), false);
$this->out("Created $association association between $modelA and $modelB");
$this->out(__d('cake_console', "Created %s association between %s and %s",
$association, $modelA, $modelB));
} else {
$this->out("Please verify you are using valid models and association types");
$this->out(__d('cake_console', "Please verify you are using valid models and association types"));
}
break;
case (preg_match("/^(\w+) unbind (\w+) (\w+)/", $command, $tmp) == true):
Expand All @@ -196,9 +197,10 @@ public function main($command = null) {

if ($this->_isValidModel($modelA) && $this->_isValidModel($modelB) && in_array($association, $this->associations) && $validCurrentAssociation) {
$this->{$modelA}->unbindModel(array($association => array($modelB)));
$this->out("Removed $association association between $modelA and $modelB");
$this->out(__d('cake_console', "Removed %s association between %s and %s",
$association, $modelA, $modelB));
} else {
$this->out("Please verify you are using valid models, valid current association, and valid association types");
$this->out(__d('cake_console', "Please verify you are using valid models, valid current association, and valid association types"));
}
break;
case (strpos($command, "->find") > 0):
Expand Down Expand Up @@ -248,10 +250,11 @@ public function main($command = null) {
}
}
} else {
$this->out("\nNo result set found");
$this->out();
$this->out(__d('cake_console', "No result set found"));
}
} else {
$this->out("$modelToCheck is not a valid model");
$this->out(__d('cake_console', "%s is not a valid model", $modelToCheck));
}

break;
Expand All @@ -267,7 +270,7 @@ public function main($command = null) {
$data = preg_replace('/^\(*(array)?\(*(.+?)\)*$/i', '\\2', $data);
$saveCommand = "\$this->{$modelToSave}->save(array('{$modelToSave}' => array({$data})));";
@eval($saveCommand);
$this->out('Saved record for ' . $modelToSave);
$this->out(__d('cake_console', 'Saved record for %s', $modelToSave));
}
break;
case (preg_match("/^(\w+) columns/", $command, $tmp) == true):
Expand All @@ -284,17 +287,16 @@ public function main($command = null) {
}
}
} else {
$this->out("Please verify that you selected a valid model");
$this->out(__d('cake_console', "Please verify that you selected a valid model"));
}
break;
case (preg_match("/^routes\s+reload/i", $command, $tmp) == true):
$router = Router::getInstance();
if (!$this->_loadRoutes()) {
$this->out("There was an error loading the routes config. Please check that the file");
$this->out("exists and is free of parse errors.");
$this->out(__d('cake_console', "There was an error loading the routes config. Please check that the file exists and is free of parse errors."));
break;
}
$this->out("Routes configuration reloaded, " . count($router->routes) . " routes connected");
$this->out(__d('cake_console', "Routes configuration reloaded, %d routes connected", count($router->routes)));
break;
case (preg_match("/^routes\s+show/i", $command, $tmp) == true):
$router = Router::getInstance();
Expand All @@ -309,7 +311,8 @@ public function main($command = null) {
$this->out(var_export(Router::parse($tmp[1]), true));
break;
default:
$this->out("Invalid command\n");
$this->out(__d('cake_console', "Invalid command"));
$this->out();
break;
}
$command = '';
Expand Down

0 comments on commit 77788a9

Please sign in to comment.