Commit 739068b0 by Taylor Otwell

moved cache, db, logs, and sessions to the storage directory.

parent 3985a98f
...@@ -34,12 +34,12 @@ class File implements \System\Cache\Driver { ...@@ -34,12 +34,12 @@ class File implements \System\Cache\Driver {
return $this->items[$key]; return $this->items[$key];
} }
if ( ! file_exists(APP_PATH.'cache/'.$key)) if ( ! file_exists(APP_PATH.'storage/cache/'.$key))
{ {
return $default; return $default;
} }
$cache = file_get_contents(APP_PATH.'cache/'.$key); $cache = file_get_contents(APP_PATH.'storage/cache/'.$key);
// -------------------------------------------------- // --------------------------------------------------
// Has the cache expired? The UNIX expiration time // Has the cache expired? The UNIX expiration time
...@@ -65,7 +65,7 @@ class File implements \System\Cache\Driver { ...@@ -65,7 +65,7 @@ class File implements \System\Cache\Driver {
*/ */
public function put($key, $value, $minutes) public function put($key, $value, $minutes)
{ {
file_put_contents(APP_PATH.'cache/'.$key, (time() + ($minutes * 60)).serialize($value), LOCK_EX); file_put_contents(APP_PATH.'storage/cache/'.$key, (time() + ($minutes * 60)).serialize($value), LOCK_EX);
} }
/** /**
...@@ -76,7 +76,7 @@ class File implements \System\Cache\Driver { ...@@ -76,7 +76,7 @@ class File implements \System\Cache\Driver {
*/ */
public function forget($key) public function forget($key)
{ {
@unlink(APP_PATH.'cache/'.$key); @unlink(APP_PATH.'storage/cache/'.$key);
} }
} }
\ No newline at end of file
...@@ -33,7 +33,7 @@ class Connector { ...@@ -33,7 +33,7 @@ class Connector {
// If the database doesn't exist there, maybe the full // If the database doesn't exist there, maybe the full
// path was specified as the database name? // path was specified as the database name?
// ----------------------------------------------------- // -----------------------------------------------------
if (file_exists($path = APP_PATH.'db/'.$config->database.'.sqlite')) if (file_exists($path = APP_PATH.'storage/db/'.$config->database.'.sqlite'))
{ {
return new \PDO('sqlite:'.$path, null, null, static::$options); return new \PDO('sqlite:'.$path, null, null, static::$options);
} }
......
...@@ -47,7 +47,7 @@ class Log { ...@@ -47,7 +47,7 @@ class Log {
// ----------------------------------------------------- // -----------------------------------------------------
// Create the yearly and monthly directories if needed. // Create the yearly and monthly directories if needed.
// ----------------------------------------------------- // -----------------------------------------------------
static::make_directory($directory = APP_PATH.'logs/'.date('Y')); static::make_directory($directory = APP_PATH.'storage/logs/'.date('Y'));
static::make_directory($directory .= '/'.date('m')); static::make_directory($directory .= '/'.date('m'));
// ----------------------------------------------------- // -----------------------------------------------------
......
...@@ -10,7 +10,7 @@ class File implements \System\Session\Driver { ...@@ -10,7 +10,7 @@ class File implements \System\Session\Driver {
*/ */
public function load($id) public function load($id)
{ {
if (file_exists($path = APP_PATH.'sessions/'.$id)) if (file_exists($path = APP_PATH.'storage/sessions/'.$id))
{ {
return unserialize(file_get_contents($path)); return unserialize(file_get_contents($path));
} }
...@@ -24,7 +24,7 @@ class File implements \System\Session\Driver { ...@@ -24,7 +24,7 @@ class File implements \System\Session\Driver {
*/ */
public function save($session) public function save($session)
{ {
file_put_contents(APP_PATH.'sessions/'.$session['id'], serialize($session), LOCK_EX); file_put_contents(APP_PATH.'storage/sessions/'.$session['id'], serialize($session), LOCK_EX);
} }
/** /**
...@@ -35,7 +35,7 @@ class File implements \System\Session\Driver { ...@@ -35,7 +35,7 @@ class File implements \System\Session\Driver {
*/ */
public function delete($id) public function delete($id)
{ {
@unlink(APP_PATH.'sessions/'.$id); @unlink(APP_PATH.'storage/sessions/'.$id);
} }
/** /**
...@@ -46,7 +46,7 @@ class File implements \System\Session\Driver { ...@@ -46,7 +46,7 @@ class File implements \System\Session\Driver {
*/ */
public function sweep($expiration) public function sweep($expiration)
{ {
foreach (glob(APP_PATH.'sessions/*') as $file) foreach (glob(APP_PATH.'storage/sessions/*') as $file)
{ {
if (filetype($file) == 'file' and filemtime($file) < $expiration) if (filetype($file) == 'file' and filemtime($file) < $expiration)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment