Browse Source

Merge branch '2.0' into 2.1

Conflicts:
	lib/Cake/Model/CakeSchema.php
mark_story 14 years ago
parent
commit
0568746bfd

+ 2 - 10
app/Console/cake.php

@@ -19,16 +19,8 @@
  */
 $ds = DIRECTORY_SEPARATOR;
 $dispatcher = 'Cake' . $ds . 'Console' . $ds . 'ShellDispatcher.php';
-$found = false;
-$paths = explode(PATH_SEPARATOR, ini_get('include_path'));
 
-foreach ($paths as $path) {
-	if (file_exists($path . $ds . $dispatcher)) {
-		$found = $path;
-	}
-}
-
-if (!$found && function_exists('ini_set')) {
+if (function_exists('ini_set')) {
 	$root = dirname(dirname(dirname(__FILE__)));
 	ini_set('include_path', $root . $ds. 'lib' . PATH_SEPARATOR . ini_get('include_path'));
 }
@@ -36,6 +28,6 @@ if (!$found && function_exists('ini_set')) {
 if (!include($dispatcher)) {
 	trigger_error('Could not locate CakePHP core files.', E_USER_ERROR);
 }
-unset($paths, $path, $found, $dispatcher, $root, $ds);
+unset($paths, $path, $dispatcher, $root, $ds);
 
 return ShellDispatcher::run($argv);

+ 2 - 2
lib/Cake/Console/Command/ConsoleShell.php

@@ -47,11 +47,11 @@ class ConsoleShell extends AppShell {
 	public $models = array();
 
 /**
- * Override initialize of the Shell
+ * Override startup of the Shell
  *
  * @return void
  */
-	public function initialize() {
+	public function startup() {
 		App::uses('Dispatcher', 'Routing');
 		$this->Dispatcher = new Dispatcher();
 		$this->models = App::objects('Model');

+ 4 - 11
lib/Cake/Console/Command/SchemaShell.php

@@ -50,22 +50,15 @@ class SchemaShell extends AppShell {
 	protected $_dry = null;
 
 /**
- * Override initialize
- *
- * @return string
- */
-	public function initialize() {
-		$this->_welcome();
-		$this->out('Cake Schema Shell');
-		$this->hr();
-	}
-
-/**
  * Override startup
  *
  * @return void
  */
 	public function startup() {
+		$this->_welcome();
+		$this->out('Cake Schema Shell');
+		$this->hr();
+	
 		$name = $path = $connection = $plugin = null;
 		if (!empty($this->params['name'])) {
 			$name = $this->params['name'];

+ 3 - 11
lib/Cake/Console/Templates/skel/Console/cake.php

@@ -19,23 +19,15 @@
  */
 $ds = DIRECTORY_SEPARATOR;
 $dispatcher = 'Cake' . $ds . 'Console' . $ds . 'ShellDispatcher.php';
-$found = false;
-$paths = explode(PATH_SEPARATOR, ini_get('include_path'));
 
-foreach ($paths as $path) {
-	if (file_exists($path . $ds . $dispatcher)) {
-		$found = $path;
-	}
-}
-
-if (!$found && function_exists('ini_set')) {
+if (function_exists('ini_set')) {
 	$root = dirname(dirname(dirname(__FILE__)));
-	ini_set('include_path', __CAKE_PATH__ . PATH_SEPARATOR . ini_get('include_path'));
+	ini_set('include_path', $root . PATH_SEPARATOR . __CAKE_PATH__ . PATH_SEPARATOR . ini_get('include_path'));
 }
 
 if (!include($dispatcher)) {
 	trigger_error('Could not locate CakePHP core files.', E_USER_ERROR);
 }
-unset($paths, $path, $found, $dispatcher, $root, $ds);
+unset($paths, $path, $dispatcher, $root, $ds);
 
 return ShellDispatcher::run($argv);

+ 3 - 3
lib/Cake/Model/CakeSchema.php

@@ -384,9 +384,9 @@ class CakeSchema extends Object {
 		}
 		$out .= "}\n";
 
-		$file = new SplFileObject($path . DS . $file, 'w+');
-		$content = "<?php\n{$out}";
-		if ($file->fwrite($content)) {
+		$file = new File($path . DS . $file, true);
+		$content = "<?php \n{$out}";
+		if ($file->write($content)) {
 			return $content;
 		}
 		return false;

+ 1 - 1
lib/Cake/Network/CakeRequest.php

@@ -559,7 +559,7 @@ class CakeRequest implements ArrayAccess {
 	public function here($base = true) {
 		$url = $this->here;
 		if (!empty($this->query)) {
-			$url .= '?' . http_build_query($this->query);
+			$url .= '?' . http_build_query($this->query, null, '&');
 		}
 		if (!$base) {
 			$url = preg_replace('/^' . preg_quote($this->base, '/') . '/', '', $url, 1);

+ 1 - 1
lib/Cake/Test/Case/Console/Command/SchemaShellTest.php

@@ -188,7 +188,7 @@ class SchemaShellTest extends CakeTestCase {
 		$this->Shell->args = array('TestPlugin.schema');
 		$this->Shell->startup();
 		$this->Shell->expects($this->exactly(2))->method('_stop');
-		$this->Shell->expects($this->exactly(2))->method('out');
+		$this->Shell->expects($this->atLeastOnce())->method('out');
 		$this->Shell->view();
 
 		$this->Shell->args = array();