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
e3b63283
Commit
e3b63283
authored
Aug 01, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Plain Diff
fix connector conflict.
parents
badc8a60
716a957e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
24 deletions
+41
-24
system/cache.php
+4
-11
system/db/connector.php
+2
-4
system/routing/loader.php
+34
-8
system/url.php
+1
-1
No files found.
system/cache.php
View file @
e3b63283
...
...
@@ -10,13 +10,6 @@ class Cache {
public
static
$drivers
=
array
();
/**
* All of the items retrieved by the cache drivers.
*
* @var array
*/
public
static
$items
=
array
();
/**
* Get a cache driver instance. If no driver name is specified, the default
* cache driver will be returned as defined in the cache configuration file.
*
...
...
@@ -66,9 +59,9 @@ class Cache {
*/
public
static
function
get
(
$key
,
$default
=
null
,
$driver
=
null
)
{
if
(
is
set
(
static
::
$items
[
$driver
][
$key
]
))
if
(
is
_null
(
$driver
))
{
return
static
::
$items
[
$driver
][
$key
]
;
$driver
=
Config
::
get
(
'cache.driver'
)
;
}
if
(
is_null
(
$item
=
static
::
driver
(
$driver
)
->
get
(
$key
)))
...
...
@@ -76,7 +69,7 @@ class Cache {
return
is_callable
(
$default
)
?
call_user_func
(
$default
)
:
$default
;
}
return
static
::
$items
[
$driver
][
$key
]
=
$item
;
return
$item
;
}
/**
...
...
@@ -91,7 +84,7 @@ class Cache {
*/
public
static
function
remember
(
$key
,
$default
,
$minutes
,
$driver
=
null
)
{
if
(
!
is_null
(
$item
=
static
::
get
(
$key
)))
if
(
!
is_null
(
$item
=
static
::
get
(
$key
,
null
,
$driver
)))
{
return
$item
;
}
...
...
system/db/connector.php
View file @
e3b63283
...
...
@@ -65,10 +65,8 @@ class Connector {
{
return
new
\PDO
(
'sqlite:'
.
$config
->
database
,
null
,
null
,
$this
->
options
);
}
else
{
throw
new
\Exception
(
"SQLite database ["
.
$config
->
database
.
"] could not be found."
);
}
throw
new
\Exception
(
"SQLite database ["
.
$config
->
database
.
"] could not be found."
);
}
/**
...
...
system/routing/loader.php
View file @
e3b63283
...
...
@@ -10,6 +10,24 @@ class Loader {
private
static
$routes
;
/**
* The path where the routes are located.
*
* @var string
*/
public
$path
;
/**
* Create a new route loader instance.
*
* @param string $path
* @return void
*/
public
function
__construct
(
$path
)
{
$this
->
path
=
$path
;
}
/**
* Load the appropriate routes for the request URI.
*
* @param string
...
...
@@ -17,9 +35,14 @@ class Loader {
*/
public
function
load
(
$uri
)
{
$base
=
require
APP_PATH
.
'routes'
.
EXT
;
$base
=
require
$this
->
path
.
'routes'
.
EXT
;
return
(
is_dir
(
APP_PATH
.
'routes'
)
and
$uri
!=
''
)
?
array_merge
(
$this
->
load_nested_routes
(
$uri
),
$base
)
:
$base
;
if
(
!
is_dir
(
$this
->
path
.
'routes'
)
or
$uri
==
''
)
{
return
$base
;
}
return
array_merge
(
$this
->
load_nested_routes
(
$uri
),
$base
);
}
/**
...
...
@@ -36,7 +59,7 @@ class Loader {
// matching route file in the routes directory.
foreach
(
array_reverse
(
$segments
,
true
)
as
$key
=>
$value
)
{
if
(
file_exists
(
$path
=
ROUTE_PATH
.
implode
(
'/'
,
array_slice
(
$segments
,
0
,
$key
+
1
))
.
EXT
))
if
(
file_exists
(
$path
=
$this
->
path
.
'routes/'
.
implode
(
'/'
,
array_slice
(
$segments
,
0
,
$key
+
1
))
.
EXT
))
{
return
require
$path
;
}
...
...
@@ -51,20 +74,23 @@ class Loader {
* To improve performance, this operation will only be performed once. The routes
* will be cached and returned on every subsequent call.
*
* @param bool $reload
* @param bool $reload
* @param string $path
* @return array
*/
public
static
function
everything
(
$reload
=
false
)
public
static
function
all
(
$reload
=
false
,
$path
=
null
)
{
if
(
!
is_null
(
static
::
$routes
)
and
!
$reload
)
return
static
::
$routes
;
$routes
=
require
APP_PATH
.
'routes'
.
EXT
;
if
(
is_null
(
$path
))
$path
=
APP_PATH
;
$routes
=
require
$path
.
'routes'
.
EXT
;
if
(
is_dir
(
APP_PATH
.
'routes'
))
if
(
is_dir
(
$path
.
'routes'
))
{
// Since route files can be nested deep within the route directory, we need to
// recursively spin through the directory to find every file.
$directoryIterator
=
new
\RecursiveDirectoryIterator
(
APP_PATH
.
'routes'
);
$directoryIterator
=
new
\RecursiveDirectoryIterator
(
$path
.
'routes'
);
$recursiveIterator
=
new
\RecursiveIteratorIterator
(
$directoryIterator
,
\RecursiveIteratorIterator
::
SELF_FIRST
);
...
...
system/url.php
View file @
e3b63283
...
...
@@ -71,7 +71,7 @@ class URL {
*/
public
static
function
to_route
(
$name
,
$parameters
=
array
(),
$https
=
false
)
{
if
(
!
is_null
(
$route
=
Routing\Finder
::
find
(
$name
,
Routing\Loader
::
everything
())))
if
(
!
is_null
(
$route
=
Routing\Finder
::
find
(
$name
,
Routing\Loader
::
all
())))
{
$uris
=
explode
(
', '
,
key
(
$route
));
...
...
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