Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
UserAdminV2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
庄欣
UserAdminV2
Commits
1cf44316
Commit
1cf44316
authored
Jul 26, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added a few more path constants.
parent
d8cab0a7
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
11 deletions
+15
-11
public/index.php
+5
-2
system/cache/driver/file.php
+5
-4
system/db/connector.php
+1
-1
system/session/driver/file.php
+4
-4
No files found.
public/index.php
View file @
1cf44316
...
@@ -12,18 +12,21 @@
...
@@ -12,18 +12,21 @@
// Define the core framework paths.
// Define the core framework paths.
// --------------------------------------------------------------
// --------------------------------------------------------------
define
(
'APP_PATH'
,
realpath
(
'../application'
)
.
'/'
);
define
(
'APP_PATH'
,
realpath
(
'../application'
)
.
'/'
);
define
(
'BASE_PATH'
,
realpath
(
'../'
)
.
'/'
);
define
(
'PUBLIC_PATH'
,
realpath
(
__DIR__
.
'/'
));
define
(
'SYS_PATH'
,
realpath
(
'../system'
)
.
'/'
);
define
(
'SYS_PATH'
,
realpath
(
'../system'
)
.
'/'
);
define
(
'PUBLIC_PATH'
,
realpath
(
__DIR__
.
'/'
));
define
(
'BASE_PATH'
,
realpath
(
'../'
)
.
'/'
);
// --------------------------------------------------------------
// --------------------------------------------------------------
// Define various other framework paths.
// Define various other framework paths.
// --------------------------------------------------------------
// --------------------------------------------------------------
define
(
'CACHE_PATH'
,
APP_PATH
.
'storage/cache/'
);
define
(
'CONFIG_PATH'
,
APP_PATH
.
'config/'
);
define
(
'CONFIG_PATH'
,
APP_PATH
.
'config/'
);
define
(
'DATABASE_PATH'
,
APP_PATH
.
'storage/db/'
);
define
(
'LIBRARY_PATH'
,
APP_PATH
.
'libraries/'
);
define
(
'LIBRARY_PATH'
,
APP_PATH
.
'libraries/'
);
define
(
'MODEL_PATH'
,
APP_PATH
.
'models/'
);
define
(
'MODEL_PATH'
,
APP_PATH
.
'models/'
);
define
(
'PACKAGE_PATH'
,
APP_PATH
.
'packages/'
);
define
(
'PACKAGE_PATH'
,
APP_PATH
.
'packages/'
);
define
(
'ROUTE_PATH'
,
APP_PATH
.
'routes/'
);
define
(
'ROUTE_PATH'
,
APP_PATH
.
'routes/'
);
define
(
'SESSION_PATH'
,
APP_PATH
.
'storage/sessions/'
);
define
(
'SYS_VIEW_PATH'
,
SYS_PATH
.
'views/'
);
define
(
'SYS_VIEW_PATH'
,
SYS_PATH
.
'views/'
);
define
(
'VIEW_PATH'
,
APP_PATH
.
'views/'
);
define
(
'VIEW_PATH'
,
APP_PATH
.
'views/'
);
...
...
system/cache/driver/file.php
View file @
1cf44316
...
@@ -22,12 +22,12 @@ class File implements \System\Cache\Driver {
...
@@ -22,12 +22,12 @@ class File implements \System\Cache\Driver {
*/
*/
public
function
get
(
$key
)
public
function
get
(
$key
)
{
{
if
(
!
file_exists
(
APP_PATH
.
'storage/cache/'
.
$key
))
if
(
!
file_exists
(
CACHE_PATH
.
$key
))
{
{
return
null
;
return
null
;
}
}
$cache
=
file_get_contents
(
APP_PATH
.
'storage/cache/'
.
$key
);
$cache
=
file_get_contents
(
CACHE_PATH
.
$key
);
if
(
time
()
>=
substr
(
$cache
,
0
,
10
))
if
(
time
()
>=
substr
(
$cache
,
0
,
10
))
{
{
...
@@ -49,7 +49,7 @@ class File implements \System\Cache\Driver {
...
@@ -49,7 +49,7 @@ class File implements \System\Cache\Driver {
*/
*/
public
function
put
(
$key
,
$value
,
$minutes
)
public
function
put
(
$key
,
$value
,
$minutes
)
{
{
file_put_contents
(
APP_PATH
.
'storage/cache/'
.
$key
,
(
time
()
+
(
$minutes
*
60
))
.
serialize
(
$value
),
LOCK_EX
);
file_put_contents
(
CACHE_PATH
.
$key
,
(
time
()
+
(
$minutes
*
60
))
.
serialize
(
$value
),
LOCK_EX
);
}
}
/**
/**
...
@@ -60,7 +60,7 @@ class File implements \System\Cache\Driver {
...
@@ -60,7 +60,7 @@ class File implements \System\Cache\Driver {
*/
*/
public
function
forget
(
$key
)
public
function
forget
(
$key
)
{
{
@
unlink
(
APP_PATH
.
'storage/cache/'
.
$key
);
@
unlink
(
CACHE_PATH
.
$key
);
}
}
}
}
\ No newline at end of file
system/db/connector.php
View file @
1cf44316
...
@@ -54,7 +54,7 @@ class Connector {
...
@@ -54,7 +54,7 @@ class Connector {
*/
*/
private
static
function
connect_to_sqlite
(
$config
)
private
static
function
connect_to_sqlite
(
$config
)
{
{
if
(
file_exists
(
$path
=
APP_PATH
.
'storage/db/'
.
$config
->
database
.
'.sqlite'
))
if
(
file_exists
(
$path
=
DATABASE_PATH
.
$config
->
database
.
'.sqlite'
))
{
{
return
new
\PDO
(
'sqlite:'
.
$path
,
null
,
null
,
static
::
$options
);
return
new
\PDO
(
'sqlite:'
.
$path
,
null
,
null
,
static
::
$options
);
}
}
...
...
system/session/driver/file.php
View file @
1cf44316
...
@@ -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
.
'storage/sessions/'
.
$id
))
if
(
file_exists
(
$path
=
SESSION_PATH
.
$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
.
'storage/sessions/'
.
$session
[
'id'
],
serialize
(
$session
),
LOCK_EX
);
file_put_contents
(
SESSION_PATH
.
$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
.
'storage/sessions/'
.
$id
);
@
unlink
(
SESSION_PATH
.
$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
.
'storage/sessions/
*'
)
as
$file
)
foreach
(
glob
(
SESSION_PATH
.
'
*'
)
as
$file
)
{
{
if
(
filetype
(
$file
)
==
'file'
and
filemtime
(
$file
)
<
$expiration
)
if
(
filetype
(
$file
)
==
'file'
and
filemtime
(
$file
)
<
$expiration
)
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment