+
+
+
\ No newline at end of file
diff --git a/application/logs/index.html b/application/logs/index.html
new file mode 100644
index 000000000..c942a79ce
--- /dev/null
+++ b/application/logs/index.html
@@ -0,0 +1,10 @@
+
+
+ 403 Forbidden
+
+
+
+
Directory access is forbidden.
+
+
+
\ No newline at end of file
diff --git a/system/cache/.htaccess b/system/cache/.htaccess
deleted file mode 100644
index 3418e55a6..000000000
--- a/system/cache/.htaccess
+++ /dev/null
@@ -1 +0,0 @@
-deny from all
\ No newline at end of file
diff --git a/system/cache/index.html b/system/cache/index.html
deleted file mode 100644
index c942a79ce..000000000
--- a/system/cache/index.html
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
- 403 Forbidden
-
-
-
-
Directory access is forbidden.
-
-
-
\ No newline at end of file
diff --git a/system/core/Output.php b/system/core/Output.php
index 0b708e110..c83b90f00 100644
--- a/system/core/Output.php
+++ b/system/core/Output.php
@@ -347,7 +347,7 @@ class CI_Output {
$CI =& get_instance();
$path = $CI->config->item('cache_path');
- $cache_path = ($path == '') ? BASEPATH.'cache/' : $path;
+ $cache_path = ($path == '') ? APPPATH.'cache/' : $path;
if ( ! is_dir($cache_path) OR ! is_really_writable($cache_path))
{
@@ -395,7 +395,7 @@ class CI_Output {
*/
function _display_cache(&$CFG, &$URI)
{
- $cache_path = ($CFG->item('cache_path') == '') ? BASEPATH.'cache/' : $CFG->item('cache_path');
+ $cache_path = ($CFG->item('cache_path') == '') ? APPPATH.'cache/' : $CFG->item('cache_path');
// Build the file path. The file name is an MD5 hash of the full URI
$uri = $CFG->item('base_url').
diff --git a/system/libraries/Log.php b/system/libraries/Log.php
index 6d44cfa4b..cb160a934 100644
--- a/system/libraries/Log.php
+++ b/system/libraries/Log.php
@@ -26,11 +26,11 @@
*/
class CI_Log {
- var $log_path;
- var $_threshold = 1;
- var $_date_fmt = 'Y-m-d H:i:s';
- var $_enabled = TRUE;
- var $_levels = array('ERROR' => '1', 'DEBUG' => '2', 'INFO' => '3', 'ALL' => '4');
+ protected $_log_path;
+ protected $_threshold = 1;
+ protected $_date_fmt = 'Y-m-d H:i:s';
+ protected $_enabled = TRUE;
+ protected $_levels = array('ERROR' => '1', 'DEBUG' => '2', 'INFO' => '3', 'ALL' => '4');
/**
* Constructor
@@ -39,9 +39,9 @@ class CI_Log {
{
$config =& get_config();
- $this->log_path = ($config['log_path'] != '') ? $config['log_path'] : BASEPATH.'logs/';
+ $this->_log_path = ($config['log_path'] != '') ? $config['log_path'] : APPPATH.'logs/';
- if ( ! is_dir($this->log_path) OR ! is_really_writable($this->log_path))
+ if ( ! is_dir($this->_log_path) OR ! is_really_writable($this->_log_path))
{
$this->_enabled = FALSE;
}
@@ -64,13 +64,12 @@ class CI_Log {
*
* Generally this function will be called using the global log_message() function
*
- * @access public
* @param string the error level
* @param string the error message
* @param bool whether the error is a native PHP error
* @return bool
*/
- function write_log($level = 'error', $msg, $php_error = FALSE)
+ public function write_log($level = 'error', $msg, $php_error = FALSE)
{
if ($this->_enabled === FALSE)
{
@@ -84,7 +83,7 @@ class CI_Log {
return FALSE;
}
- $filepath = $this->log_path.'log-'.date('Y-m-d').EXT;
+ $filepath = $this->_log_path.'log-'.date('Y-m-d').EXT;
$message = '';
if ( ! file_exists($filepath))
diff --git a/system/logs/index.html b/system/logs/index.html
deleted file mode 100644
index c942a79ce..000000000
--- a/system/logs/index.html
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
- 403 Forbidden
-
-
-
-
Directory access is forbidden.
-
-
-
\ No newline at end of file
diff --git a/user_guide/changelog.html b/user_guide/changelog.html
index 68abaff27..251f6fbd9 100644
--- a/user_guide/changelog.html
+++ b/user_guide/changelog.html
@@ -69,6 +69,7 @@ Hg Tag:
Plugins have been removed, in favor of Helpers. The CAPTCHA plugin has been converted to a Helper and documented. The JavaScript calendar plugin was removed due to the ready availability of great JavaScript calendars, particularly with jQuery.
Moved the application folder outside of the system folder.
+
Moved system/cache and system/logs directories to the application directory.
Added routing overrides to the main index.php file, enabling the normal routing to be overridden on a per "index" file basis.
Added the ability to set config values (or override config values) directly from data set in the main index.php file. This allows a single application to be used with multiple front controllers, each having its own config values.
Added $config['directory_trigger'] to the config file so that a controller sub-directory can be specified when running _GET strings instead of URI segments.
--
cgit v1.2.3-24-g4f1b
From 678256c2007b06452b581fb692d948b7c9c94a7b Mon Sep 17 00:00:00 2001
From: Greg Aker
Date: Tue, 21 Dec 2010 12:05:12 -0600
Subject: Fix #93 Updating postgres dbforge create table method. Thanks to
James Gifford for the patch. http://codeigniter.com/forums/viewthread/73392/
---
system/database/drivers/postgre/postgre_forge.php | 81 ++++++++++++++++++-----
user_guide/changelog.html | 1 +
2 files changed, 67 insertions(+), 15 deletions(-)
diff --git a/system/database/drivers/postgre/postgre_forge.php b/system/database/drivers/postgre/postgre_forge.php
index 41858f36e..16127ffd7 100644
--- a/system/database/drivers/postgre/postgre_forge.php
+++ b/system/database/drivers/postgre/postgre_forge.php
@@ -69,7 +69,10 @@ class CI_DB_postgre_forge extends CI_DB_forge {
if ($if_not_exists === TRUE)
{
- $sql .= 'IF NOT EXISTS ';
+ if ($this->db->table_exists($table))
+ {
+ return "SELECT * FROM $table"; // Needs to return innocous but valid SQL statement
+ }
}
$sql .= $this->db->_escape_identifiers($table)." (";
@@ -90,16 +93,55 @@ class CI_DB_postgre_forge extends CI_DB_forge {
$sql .= "\n\t".$this->db->_protect_identifiers($field);
- $sql .= ' '.$attributes['TYPE'];
+ $is_unsigned = (array_key_exists('UNSIGNED', $attributes) && $attributes['UNSIGNED'] === TRUE);
- if (array_key_exists('CONSTRAINT', $attributes))
+ // Convert datatypes to be PostgreSQL-compatible
+ switch (strtoupper($attributes['TYPE']))
{
- $sql .= '('.$attributes['CONSTRAINT'].')';
+ case 'TINYINT':
+ $attributes['TYPE'] = 'SMALLINT';
+ break;
+ case 'SMALLINT':
+ $attributes['TYPE'] = ($is_unsigned) ? 'INTEGER' : 'SMALLINT';
+ break;
+ case 'MEDIUMINT':
+ $attributes['TYPE'] = 'INTEGER';
+ break;
+ case 'INT':
+ $attributes['TYPE'] = ($is_unsigned) ? 'BIGINT' : 'INTEGER';
+ break;
+ case 'BIGINT':
+ $attributes['TYPE'] = ($is_unsigned) ? 'NUMERIC' : 'BIGINT';
+ break;
+ case 'DOUBLE':
+ $attributes['TYPE'] = 'DOUBLE PRECISION';
+ break;
+ case 'DATETIME':
+ $attributes['TYPE'] = 'TIMESTAMP';
+ break;
+ case 'LONGTEXT':
+ $attributes['TYPE'] = 'TEXT';
+ break;
+ case 'BLOB':
+ $attributes['TYPE'] = 'BYTEA';
+ break;
}
- if (array_key_exists('UNSIGNED', $attributes) && $attributes['UNSIGNED'] === TRUE)
+ // If this is an auto-incrementing primary key, use the serial data type instead
+ if (in_array($field, $primary_keys) && array_key_exists('AUTO_INCREMENT', $attributes)
+ && $attributes['AUTO_INCREMENT'] === TRUE)
+ {
+ $sql .= ' SERIAL';
+ }
+ else
{
- $sql .= ' UNSIGNED';
+ $sql .= ' '.$attributes['TYPE'];
+ }
+
+ // Modified to prevent constraints with integer data types
+ if (array_key_exists('CONSTRAINT', $attributes) && strpos($attributes['TYPE'], 'INT') === false)
+ {
+ $sql .= '('.$attributes['CONSTRAINT'].')';
}
if (array_key_exists('DEFAULT', $attributes))
@@ -116,9 +158,10 @@ class CI_DB_postgre_forge extends CI_DB_forge {
$sql .= ' NOT NULL';
}
- if (array_key_exists('AUTO_INCREMENT', $attributes) && $attributes['AUTO_INCREMENT'] === TRUE)
+ // Added new attribute to create unqite fields. Also works with MySQL
+ if (array_key_exists('UNIQUE', $attributes) && $attributes['UNIQUE'] === TRUE)
{
- $sql .= ' AUTO_INCREMENT';
+ $sql .= ' UNIQUE';
}
}
@@ -131,10 +174,17 @@ class CI_DB_postgre_forge extends CI_DB_forge {
if (count($primary_keys) > 0)
{
- $primary_keys = $this->db->_protect_identifiers($primary_keys);
+ // Something seems to break when passing an array to _protect_identifiers()
+ foreach ($primary_keys as $index => $key)
+ {
+ $primary_keys[$index] = $this->db->_protect_identifiers($key);
+ }
+
$sql .= ",\n\tPRIMARY KEY (" . implode(', ', $primary_keys) . ")";
}
+ $sql .= "\n);";
+
if (is_array($keys) && count($keys) > 0)
{
foreach ($keys as $key)
@@ -148,12 +198,13 @@ class CI_DB_postgre_forge extends CI_DB_forge {
$key = array($this->db->_protect_identifiers($key));
}
- $sql .= ",\n\tFOREIGN KEY (" . implode(', ', $key) . ")";
+ foreach ($key as $field)
+ {
+ $sql .= "CREATE INDEX " . $table . "_" . str_replace(array('"', "'"), '', $field) . "_index ON $table ($field); ";
+ }
}
}
- $sql .= "\n);";
-
return $sql;
}
@@ -162,12 +213,12 @@ class CI_DB_postgre_forge extends CI_DB_forge {
/**
* Drop Table
*
- * @access private
- * @return bool
+ * @access private
+ * @return bool
*/
function _drop_table($table)
{
- return "DROP TABLE ".$this->db->_escape_identifiers($table)." CASCADE";
+ return "DROP TABLE IF EXISTS ".$this->db->_escape_identifiers($table)." CASCADE";
}
// --------------------------------------------------------------------
diff --git a/user_guide/changelog.html b/user_guide/changelog.html
index 251f6fbd9..786b90269 100644
--- a/user_guide/changelog.html
+++ b/user_guide/changelog.html
@@ -124,6 +124,7 @@ Hg Tag:
Modified the database errors to show the filename and line number of the problematic query.
Removed the following deprecated functions: orwhere, orlike, groupby, orhaving, orderby, getwhere.
Removed deprecated _drop_database() and _create_database() functions from the db utility drivers.
+
Improved dbforge create_table() function for the Postgres driver.
Helpers
--
cgit v1.2.3-24-g4f1b
From 9730c75373afbb9b4c9310d3235bdb74adb5b1b2 Mon Sep 17 00:00:00 2001
From: Phil Sturgeon
Date: Wed, 15 Dec 2010 10:50:15 +0000
Subject: Package paths can now be auto-loaded in autoload.php.
---
application/config/autoload.php | 25 +++++++++++++++++++------
system/core/Loader.php | 9 +++++++++
2 files changed, 28 insertions(+), 6 deletions(-)
diff --git a/application/config/autoload.php b/application/config/autoload.php
index 5e9740844..90b1a808f 100644
--- a/application/config/autoload.php
+++ b/application/config/autoload.php
@@ -18,14 +18,28 @@
|
| These are the things you can load automatically:
|
-| 1. Libraries
-| 2. Helper files
-| 3. Custom config files
-| 4. Language files
-| 5. Models
+| 1. Packages
+| 2. Libraries
+| 3. Helper files
+| 4. Custom config files
+| 5. Language files
+| 6. Models
|
*/
+/*
+| -------------------------------------------------------------------
+| Auto-load Packges
+| -------------------------------------------------------------------
+| Prototype:
+|
+| $autoload['packages'] = array(APPPATH.'third_party', '/usr/local/shared');
+|
+*/
+
+$autoload['packages'] = array(APPPATH.'third_party');
+
+
/*
| -------------------------------------------------------------------
| Auto-load Libraries
@@ -98,6 +112,5 @@ $autoload['language'] = array();
$autoload['model'] = array();
-
/* End of file autoload.php */
/* Location: ./application/config/autoload.php */
\ No newline at end of file
diff --git a/system/core/Loader.php b/system/core/Loader.php
index 4b6b19eea..afbae6175 100644
--- a/system/core/Loader.php
+++ b/system/core/Loader.php
@@ -942,6 +942,15 @@ class CI_Loader {
return FALSE;
}
+ // Autoload packages
+ if (isset($autoload['packages']))
+ {
+ foreach ($autoload['packages'] as $package_path)
+ {
+ $this->add_package_path($package_path);
+ }
+ }
+
// Load any custom config file
if (count($autoload['config']) > 0)
{
--
cgit v1.2.3-24-g4f1b
From 6c1d3fa35198c54c69e37aa74fa80723209c1d1e Mon Sep 17 00:00:00 2001
From: Pascal Kriete
Date: Wed, 15 Dec 2010 10:51:37 -0500
Subject: Small tweak to the _remap documentation (see #208).
---
user_guide/general/controllers.html | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/user_guide/general/controllers.html b/user_guide/general/controllers.html
index 1d9cd0328..3a85ca38a 100644
--- a/user_guide/general/controllers.html
+++ b/user_guide/general/controllers.html
@@ -243,9 +243,17 @@ allowing you to define your own function routing rules.
}
}
-
An array of leftover segments are passed into _remap() as an optional second parameter.
-
+
Any extra segments after the method name are passed into _remap() as an optional second parameter. This array can be used in combination with PHP's call_user_func_array to emulate CodeIgniter's default behavior.
+function _remap($method, $params = array())
+{
+ $method = 'process_'.$method;
+ if (method_exists($this, $method)
+ {
+ return call_user_func_array(array($this, $method), $params);
+ }
+ show_404();
+}
--
cgit v1.2.3-24-g4f1b
From 790ebf3a77677dd6d7473bb14f8e9c5594ddcb46 Mon Sep 17 00:00:00 2001
From: Pascal Kriete
Date: Wed, 15 Dec 2010 10:53:35 -0500
Subject: Changing the router to support any number of segments in the default
route. Closes #261.
---
system/core/Router.php | 2 +-
user_guide/changelog.html | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/system/core/Router.php b/system/core/Router.php
index 9276800c3..e21519329 100644
--- a/system/core/Router.php
+++ b/system/core/Router.php
@@ -144,7 +144,7 @@ class CI_Router {
$this->set_class($x[0]);
$this->set_method($x[1]);
- $this->_set_request(array($x[0], $x[1]));
+ $this->_set_request($x);
}
else
{
diff --git a/user_guide/changelog.html b/user_guide/changelog.html
index c3693e5f9..80d830d9d 100644
--- a/user_guide/changelog.html
+++ b/user_guide/changelog.html
@@ -160,6 +160,7 @@ Hg Tag: