From 7703018e2a32c0542c32f48d3999985ea449f8d7 Mon Sep 17 00:00:00 2001 From: endoffight Date: Mon, 25 May 2015 17:19:03 +0800 Subject: [PATCH] fix admin path --- Plugin.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Plugin.php b/Plugin.php index efeb5b3..6adc91d 100644 --- a/Plugin.php +++ b/Plugin.php @@ -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); @@ -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;