Skip to content

Commit

Permalink
fix admin path
Browse files Browse the repository at this point in the history
  • Loading branch information
phpgao committed May 25, 2015
1 parent e89878a commit 7703018
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,14 @@ public static function C()
$pathInfo = self::P();
if(is_null($pathInfo)) return;


//判断是否需要路由
self::$key = md5(self::needCache($pathInfo));
self::$key = self::needCache($pathInfo);

//key非null则需要缓存
if (is_null(self::$key)) return;


self::$key = md5(self::$key);
try {
self::$cache = self::getCache();
$data = self::$cache->get(self::$key);
Expand Down Expand Up @@ -211,6 +212,13 @@ public static function P(){
*/
public static function needCache($pathInfo)
{
//后台数据不缓存
$pattern = '#^' . __TYPECHO_ADMIN_DIR__ . '#i';
if( preg_match($pattern, $pathInfo) ) return null;

//action不缓存
$pattern = '#^/action#i';
if( preg_match($pattern, $pathInfo) ) return null;

$_routingTable = self::$sys_config->routingTable;

Expand Down

0 comments on commit 7703018

Please sign in to comment.