Skip to content

Commit

Permalink
Merge branch '1.3-misc' into 1.3-merger
Browse files Browse the repository at this point in the history
Conflicts:
	cake/tests/cases/libs/configure.test.php
  • Loading branch information
markstory committed Nov 16, 2009
2 parents e2c7cda + 0783176 commit acd2c15
Show file tree
Hide file tree
Showing 133 changed files with 1,694 additions and 933 deletions.
18 changes: 5 additions & 13 deletions app/config/core.php
Expand Up @@ -69,22 +69,12 @@
*/
//Configure::write('App.baseUrl', env('SCRIPT_NAME'));

/**
* Uncomment the define below to use CakePHP admin routes.
*
* The value of the define determines the name of the route
* and its associated controller actions:
*
* 'admin' -> admin_index() and /admin/controller/index
* 'superuser' -> superuser_index() and /superuser/controller/index
*
* [Note Routing.admin is deprecated in 1.3. Use Routing.prefixes instead]
*/
//Configure::write('Routing.admin', 'admin');

/**
* Uncomment the define below to use CakePHP prefix routes.
*
* The value of the define determines the names of the routes
* and their associated controller actions:
*
* Set to an array of prefixes you want to use in your application. Use for
* admin or other prefixed routes.
*
Expand All @@ -93,6 +83,8 @@
* Enables:
* `admin_index()` and `/admin/controller/index`
* `manager_index()` and `/manager/controller/index`
*
* [Note Routing.admin is deprecated in 1.3. Use Routing.prefixes instead]
*/
//Configure::write('Routing.prefixes', array('admin'));

Expand Down
22 changes: 22 additions & 0 deletions cake/basics.php
Expand Up @@ -212,6 +212,28 @@ function h($text, $charset = null) {
return htmlspecialchars($text, ENT_QUOTES, $charset);
}

/**
* Splits a dot syntax plugin name into its plugin and classname.
* If $name does not have a dot, then index 0 will be null.
*
* Commonly used like `list($plugin, $name) = pluginSplit($name);`
*
* @param string $name The name you want to plugin split.
* @param boolean $dotAppend Set to true if you want the plugin to have a '.' appended to it.
* @param string $plugin Optional default plugin to use if no plugin is found. Defaults to null.
* @return array Array with 2 indexes. 0 => plugin name, 1 => classname
*/
function pluginSplit($name, $dotAppend = false, $plugin = null) {
if (strpos($name, '.') !== false) {
$parts = explode('.', $name, 2);
if ($dotAppend) {
$parts[0] .= '.';
}
return $parts;
}
return array($plugin, $name);
}

/**
* Returns an array of all the given parameters.
*
Expand Down
9 changes: 2 additions & 7 deletions cake/console/cake.php
Expand Up @@ -317,13 +317,8 @@ function dispatch() {
$this->help();
return true;
}

if (strpos($arg, '.') !== false) {
list($plugin, $shell) = explode('.', $arg);
} else {
$plugin = null;
$shell = $arg;
}

list($plugin, $shell) = pluginSplit($arg);
$this->shell = $shell;
$this->shellName = Inflector::camelize($shell);
$this->shellClass = $this->shellName . 'Shell';
Expand Down
6 changes: 3 additions & 3 deletions cake/console/libs/acl.php
Expand Up @@ -236,7 +236,7 @@ function getPath() {
* @param integer $indent indent level.
* @return void
* @access protected
**/
*/
function _outputNode($class, $node, $indent) {
$indent = str_repeat(' ', $indent);
$data = $node[$class];
Expand Down Expand Up @@ -521,7 +521,7 @@ function nodeExists() {
*
* @param string $identifier Identifier to parse
* @return mixed a string for aliases, and an array for model.foreignKey
**/
*/
function parseIdentifier($identifier) {
if (preg_match('/^([\w]+)\.(.*)$/', $identifier, $matches)) {
return array(
Expand All @@ -539,7 +539,7 @@ function parseIdentifier($identifier) {
* @param string $class Class type you want (Aro/Aco)
* @param mixed $identifier A mixed identifier for finding the node.
* @return int Integer of NodeId. Will trigger an error if nothing is found.
**/
*/
function _getNodeId($class, $identifier) {
$node = $this->Acl->{$class}->node($identifier);
if (empty($node)) {
Expand Down
2 changes: 1 addition & 1 deletion cake/console/libs/bake.php
Expand Up @@ -57,7 +57,7 @@ function loadTasks() {
}
foreach($this->args as $i => $arg) {
if (strpos($arg, '.')) {
list($this->params['plugin'], $this->args[$i]) = explode('.', $arg);
list($this->params['plugin'], $this->args[$i]) = pluginSplit($arg);
break;
}
}
Expand Down
11 changes: 6 additions & 5 deletions cake/console/libs/schema.php
Expand Up @@ -63,9 +63,10 @@ function startup() {
} elseif (!empty($this->args[0])) {
$name = $this->params['name'] = $this->args[0];
}

if (strpos($name, '.')) {
list($this->params['plugin'], $this->params['name']) = explode('.', $name);
$name = $this->params['name'];
list($this->params['plugin'], $splitName) = pluginSplit($name);
$name = $this->params['name'] = $splitName;
}

if ($name) {
Expand Down Expand Up @@ -242,7 +243,7 @@ function dump() {
* Run database create commands. Alias for run create.
*
* @return void
**/
*/
function create() {
list($Schema, $table) = $this->_loadSchema();
$this->__create($Schema, $table);
Expand All @@ -252,7 +253,7 @@ function create() {
* Run database create commands. Alias for run create.
*
* @return void
**/
*/
function update() {
list($Schema, $table) = $this->_loadSchema();
$this->__update($Schema, $table);
Expand All @@ -262,7 +263,7 @@ function update() {
* Prepares the Schema objects for database operations.
*
* @return void
**/
*/
function _loadSchema() {
$name = $plugin = null;
if (isset($this->params['name'])) {
Expand Down
8 changes: 2 additions & 6 deletions cake/console/libs/shell.php
Expand Up @@ -254,11 +254,7 @@ function _loadModels() {
$this->modelClass = $modelClassName;

foreach ($uses as $modelClass) {
$plugin = null;
if (strpos($modelClass, '.') !== false) {
list($plugin, $modelClass) = explode('.', $modelClass);
$plugin = $plugin . '.';
}
list($plugin, $modelClass) = pluginSplit($modelClass, true);
if (PHP5) {
$this->{$modelClass} = ClassRegistry::init($plugin . $modelClass);
} else {
Expand Down Expand Up @@ -642,7 +638,7 @@ function _pluralHumanName($name) {
*
* @param string $pluginName Name of the plugin you want ie. DebugKit
* @return string $path path to the correct plugin.
**/
*/
function _pluginPath($pluginName) {
return App::pluginPath($pluginName);
}
Expand Down
12 changes: 6 additions & 6 deletions cake/console/libs/tasks/controller.php
Expand Up @@ -113,7 +113,7 @@ function execute() {
*
* @access public
* @return void
**/
*/
function all() {
$this->interactive = false;
$this->listAll($this->connection, false);
Expand Down Expand Up @@ -219,7 +219,7 @@ function __interactive() {
* Confirm a to be baked controller with the user
*
* @return void
**/
*/
function confirmController($controllerName, $useDynamicScaffold, $helpers, $components) {
$this->out();
$this->hr();
Expand Down Expand Up @@ -257,7 +257,7 @@ function confirmController($controllerName, $useDynamicScaffold, $helpers, $comp
* Interact with the user and ask about which methods (admin or regular they want to bake)
*
* @return array Array containing (bakeRegular, bakeAdmin) answers
**/
*/
function _askAboutMethods() {
$wannaBakeCrud = $this->in(
__("Would you like to create some basic class methods \n(index(), add(), view(), edit())?", true),
Expand Down Expand Up @@ -348,7 +348,7 @@ function bakeTest($className) {
* Interact with the user and get a list of additional helpers
*
* @return array Helpers that the user wants to use.
**/
*/
function doHelpers() {
return $this->_doPropertyChoices(
__("Would you like this controller to use other helpers\nbesides HtmlHelper and FormHelper?", true),
Expand All @@ -360,7 +360,7 @@ function doHelpers() {
* Interact with the user and get a list of additional components
*
* @return array Components the user wants to use.
**/
*/
function doComponents() {
return $this->_doPropertyChoices(
__("Would you like this controller to use any components?", true),
Expand All @@ -374,7 +374,7 @@ function doComponents() {
* @param string $prompt A yes/no question to precede the list
* @param sting $example A question for a comma separated list, with examples.
* @return array Array of values for property.
**/
*/
function _doPropertyChoices($prompt, $example) {
$proceed = $this->in($prompt, array('y','n'), 'n');
$property = array();
Expand Down
4 changes: 2 additions & 2 deletions cake/console/libs/tasks/db_config.php
Expand Up @@ -53,7 +53,7 @@ class DbConfigTask extends Shell {
* Used for testing.
*
* @var string
**/
*/
var $databaseClassName = 'DATABASE_CONFIG';

/**
Expand Down Expand Up @@ -351,7 +351,7 @@ function bake($configs) {
* Get a user specified Connection name
*
* @return void
**/
*/
function getConfig() {
App::import('Model', 'ConnectionManager', false);

Expand Down
18 changes: 9 additions & 9 deletions cake/console/libs/tasks/fixture.php
Expand Up @@ -54,14 +54,14 @@ class FixtureTask extends Shell {
* The db connection being used for baking
*
* @var string
**/
*/
var $connection = null;

/**
* Schema instance
*
* @var object
**/
*/
var $_Schema = null;

/**
Expand Down Expand Up @@ -103,7 +103,7 @@ function execute() {
*
* @access public
* @return void
**/
*/
function all() {
$this->interactive = false;
$this->Model->interactive = false;
Expand Down Expand Up @@ -140,7 +140,7 @@ function __interactive() {
*
* @param string $modelName Name of model you are dealing with.
* @return array Array of import options.
**/
*/
function importOptions($modelName) {
$options = array();
$doSchema = $this->in(__('Would you like to import schema for this fixture?', true), array('y', 'n'), 'n');
Expand Down Expand Up @@ -230,7 +230,7 @@ function bake($model, $useTable = false, $importOptions = array()) {
* @param string $fixture Contents of the fixture file.
* @access public
* @return void
**/
*/
function generateFixtureFile($model, $otherVars) {
$defaults = array('table' => null, 'schema' => null, 'records' => null, 'import' => null, 'fields' => null);
$vars = array_merge($defaults, $otherVars);
Expand All @@ -255,7 +255,7 @@ function generateFixtureFile($model, $otherVars) {
*
* @param array $table Table schema array
* @return string fields definitions
**/
*/
function _generateSchema($tableInfo) {
$schema = $this->_Schema->generateTable('f', $tableInfo);
return substr($schema, 10, -2);
Expand All @@ -266,7 +266,7 @@ function _generateSchema($tableInfo) {
*
* @param array $table Table schema array
* @return array Array of records to use in the fixture.
**/
*/
function _generateRecords($tableInfo, $recordCount = 1) {
$records = array();
for ($i = 0; $i < $recordCount; $i++) {
Expand Down Expand Up @@ -337,7 +337,7 @@ function _generateRecords($tableInfo, $recordCount = 1) {
*
* @param array $records Array of records to be converted to string
* @return string A string value of the $records array.
**/
*/
function _makeRecordString($records) {
$out = "array(\n";
foreach ($records as $record) {
Expand All @@ -360,7 +360,7 @@ function _makeRecordString($records) {
* @param string $modelName name of the model to take records from.
* @param string $useTable Name of table to use.
* @return array Array of records.
**/
*/
function _getRecordsFromTable($modelName, $useTable = null) {
if ($this->interactive) {
$condition = null;
Expand Down

0 comments on commit acd2c15

Please sign in to comment.