Skip to content

Commit

Permalink
Merge branch '2.0' into 2.0-api-doc
Browse files Browse the repository at this point in the history
Conflicts:
	lib/Cake/Test/Case/View/Helper/CacheHelperTest.php
	lib/Cake/Utility/Debugger.php
  • Loading branch information
jrbasso committed Aug 15, 2011
2 parents 895c10a + 182b13f commit 620a65b
Show file tree
Hide file tree
Showing 74 changed files with 1,172 additions and 354 deletions.
17 changes: 11 additions & 6 deletions app/Config/core.php
Expand Up @@ -247,7 +247,6 @@
* 'serialize' => true, [optional]
* ));
*
*
* APC (http://pecl.php.net/package/APC)
*
* Cache::config('default', array(
Expand All @@ -263,12 +262,11 @@
* 'engine' => 'Xcache', //[required]
* 'duration'=> 3600, //[optional]
* 'probability'=> 100, //[optional]
* 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string
* 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string
* 'user' => 'user', //user from xcache.admin.user settings
* 'password' => 'password', //plaintext password (xcache.admin.pass)
* 'password' => 'password', //plaintext password (xcache.admin.pass)
* ));
*
*
* Memcache (http://www.danga.com/memcached/)
*
* Cache::config('default', array(
Expand All @@ -281,9 +279,16 @@
* ), //[optional]
* 'persistent' => true, // [optional] set this to false for non-persistent connections
* 'compress' => false, // [optional] compress data in Memcache (slower, but uses less memory)
* 'persistent' => true, // [optional] set this to false for non-persistent connections
* ));
*
* Wincache (http://php.net/wincache)
*
* Cache::config('default', array(
* 'engine' => 'Wincache', //[required]
* 'duration'=> 3600, //[optional]
* 'probability'=> 100, //[optional]
* 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string
* ));
*/

/**
Expand Down Expand Up @@ -315,7 +320,7 @@
));

/**
* Configure the cache for model, and datasource caches. This cache configuration
* Configure the cache for model and datasource caches. This cache configuration
* is used to store schema descriptions, and table listings in connections.
*/
Cache::config('_cake_model_', array(
Expand Down
2 changes: 2 additions & 0 deletions app/Config/database.php.default
Expand Up @@ -66,6 +66,7 @@ class DATABASE_CONFIG {
'password' => 'password',
'database' => 'database_name',
'prefix' => '',
//'encoding' => 'utf8',
);

public $test = array(
Expand All @@ -76,5 +77,6 @@ class DATABASE_CONFIG {
'password' => 'password',
'database' => 'test_database_name',
'prefix' => '',
//'encoding' => 'utf8',
);
}
27 changes: 22 additions & 5 deletions app/Console/cake.php
Expand Up @@ -3,8 +3,6 @@
/**
* Command-line code generation utility to automate programmer chores.
*
* Shell dispatcher class
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
Expand All @@ -15,10 +13,29 @@
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package app.console
* @since CakePHP(tm) v 1.2.0.5012
* @package app.Console
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
require_once(dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'lib'. DIRECTORY_SEPARATOR . 'Cake' . DIRECTORY_SEPARATOR . 'Console' . DIRECTORY_SEPARATOR . 'ShellDispatcher.php');
$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')) {
$root = dirname(dirname(dirname(__FILE__)));
ini_set('include_path', $root . $ds. 'lib' . 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);

return ShellDispatcher::run($argv);
29 changes: 22 additions & 7 deletions app/webroot/index.php
Expand Up @@ -44,13 +44,19 @@
if (!defined('APP_DIR')) {
define('APP_DIR', basename(dirname(dirname(__FILE__))));
}

/**
* The absolute path to the "cake" directory, WITHOUT a trailing DS.
*
* Un-comment this line to specify a fixed path to CakePHP.
* This should point at the directory containg `Cake`.
*
* For ease of development CakePHP uses PHP's include_path. If you
* cannot modify your include_path set this value.
*
* Leaving this constant undefined will result in it being defined in Cake/bootstrap.php
*/
if (!defined('CAKE_CORE_INCLUDE_PATH')) {
define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . 'lib');
}
//define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . 'lib');

/**
* Editing below this line should NOT be necessary.
Expand All @@ -63,11 +69,20 @@
if (!defined('WWW_ROOT')) {
define('WWW_ROOT', dirname(__FILE__) . DS);
}
if (!defined('CORE_PATH')) {
define('APP_PATH', ROOT . DS . APP_DIR . DS);
define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS);

if (!defined('CAKE_CORE_INCLUDE_PATH')) {
if (function_exists('ini_set')) {
ini_set('include_path', ROOT . DS . 'lib' . PATH_SEPARATOR . ini_get('include_path'));
}
if (!include('Cake' . DS . 'bootstrap.php')) {
$failed = true;
}
} else {
if (!include(CAKE_CORE_INCLUDE_PATH . DS . 'Cake' . DS . 'bootstrap.php')) {
$failed = true;
}
}
if (!include(CORE_PATH . 'Cake' . DS . 'bootstrap.php')) {
if (!empty($failed)) {
trigger_error("CakePHP core could not be found. Check the value of CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php. It should point to the directory containing your " . DS . "cake core directory and your " . DS . "vendors root directory.", E_USER_ERROR);
}

Expand Down
26 changes: 19 additions & 7 deletions app/webroot/test.php
Expand Up @@ -44,13 +44,16 @@
if (!defined('APP_DIR')) {
define('APP_DIR', basename(dirname(dirname(__FILE__))));
}

/**
* The absolute path to the "Cake" directory, WITHOUT a trailing DS.
*
* For ease of development CakePHP uses PHP's include_path. If you
* need to cannot modify your include_path, you can set this path.
*
* Leaving this constant undefined will result in it being defined in Cake/bootstrap.php
*/
if (!defined('CAKE_CORE_INCLUDE_PATH')) {
define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . 'lib');
}
//define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . 'lib');

/**
* Editing below this line should not be necessary.
Expand All @@ -63,11 +66,20 @@
if (!defined('WWW_ROOT')) {
define('WWW_ROOT', dirname(__FILE__) . DS);
}
if (!defined('CORE_PATH')) {
define('APP_PATH', ROOT . DS . APP_DIR . DS);
define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS);

if (!defined('CAKE_CORE_INCLUDE_PATH')) {
if (function_exists('ini_set')) {
ini_set('include_path', ROOT . DS . 'lib' . PATH_SEPARATOR . ini_get('include_path'));
}
if (!include('Cake' . DS . 'bootstrap.php')) {
$failed = true;
}
} else {
if (!include(CAKE_CORE_INCLUDE_PATH . DS . 'Cake' . DS . 'bootstrap.php')) {
$failed = true;
}
}
if (!include(CORE_PATH . 'Cake' . DS . 'bootstrap.php')) {
if (!empty($failed)) {
trigger_error("CakePHP core could not be found. Check the value of CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php. It should point to the directory containing your " . DS . "cake core directory and your " . DS . "vendors root directory.", E_USER_ERROR);
}

Expand Down
6 changes: 0 additions & 6 deletions index.php
Expand Up @@ -37,10 +37,4 @@
define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . 'lib');
}

/**
* Set the include path or define app and core path
*/
define('APP_PATH', ROOT . DS . APP_DIR . DS);
define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS);

require APP_DIR . DS . WEBROOT_DIR . DS . 'index.php';
3 changes: 2 additions & 1 deletion lib/Cake/Cache/Cache.php
Expand Up @@ -82,14 +82,15 @@ class Cache {
*
* `Cache::config('default');`
*
* There are 4 built-in caching engines:
* There are 5 built-in caching engines:
*
* - `FileEngine` - Uses simple files to store content. Poor performance, but good for
* storing large objects, or things that are not IO sensitive.
* - `ApcEngine` - Uses the APC object cache, one of the fastest caching engines.
* - `MemcacheEngine` - Uses the PECL::Memcache extension and Memcached for storage.
* Fast reads/writes, and benefits from memcache being distributed.
* - `XcacheEngine` - Uses the Xcache extension, an alternative to APC.
* - `WincacheEngine` - Uses Windows Cache Extension for PHP. Supports wincache 1.1.0 and higher.
*
* The following keys are used in core cache engines:
*
Expand Down
17 changes: 11 additions & 6 deletions lib/Cake/Cache/Engine/FileEngine.php
Expand Up @@ -121,19 +121,24 @@ public function write($key, $data, $duration) {
}
}

$expires = time() + $duration;
$contents = $expires . $lineBreak . $data . $lineBreak;

if (!$handle = fopen($this->_File->getPathName(), 'c')) {
return false;
}

if ($this->settings['lock']) {
$this->_File->flock(LOCK_EX);
flock($handle, LOCK_EX);
}

$expires = time() + $duration;
$contents = $expires . $lineBreak . $data . $lineBreak;
$success = $this->_File->ftruncate(0) && $this->_File->fwrite($contents);
$success = ftruncate($handle, 0) && fwrite($handle, $contents) && fflush($handle);

if ($this->settings['lock']) {
$this->_File->flock(LOCK_UN);
flock($handle, LOCK_UN);
}
$this->_File = null;

fclose($handle);
return $success;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Console/Command/CommandListShell.php
Expand Up @@ -46,7 +46,7 @@ public function main() {
if (empty($this->params['xml'])) {
$this->out(__d('cake_console', "<info>Current Paths:</info>"), 2);
$this->out(" -app: ". APP_DIR);
$this->out(" -working: " . rtrim(APP_PATH, DS));
$this->out(" -working: " . rtrim(APP, DS));
$this->out(" -root: " . rtrim(ROOT, DS));
$this->out(" -core: " . rtrim(CORE_PATH, DS));
$this->out("");
Expand Down
9 changes: 7 additions & 2 deletions lib/Cake/Console/Command/Task/ExtractTask.php
Expand Up @@ -390,7 +390,12 @@ protected function _processValidationRules($field, $rules, $file, $domain) {

foreach ($rules as $rule => $validateProp) {
if (isset($validateProp['message'])) {
$this->_strings[$domain][$validateProp['message']][$file][] = 'validation for field ' . $field;
if (is_array($validateProp['message'])) {
$message = $validateProp['message'][0];
} else {
$message = $validateProp['message'];
}
$this->_strings[$domain][$message][$file][] = 'validation for field ' . $field;
}
}
}
Expand Down Expand Up @@ -507,7 +512,7 @@ protected function _writeHeader() {
$output .= "\"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\\n\"\n\n";
return $output;
}

/**
* Get the strings from the position forward
*
Expand Down

0 comments on commit 620a65b

Please sign in to comment.