提交 58f1ad14 编写于 作者: D Devil

插件数据优化

上级 c1123139
......@@ -1427,7 +1427,11 @@ php;
$sql_file = APP_PATH.'plugins'.DS.$plugins.DS.'update.sql';
if(!empty($plugins) && file_exists($sql_file))
{
SqlconsoleService::Implement(['sql'=>file_get_contents($sql_file)]);
$sql = file_get_contents($sql_file);
if(!empty($sql))
{
SqlconsoleService::Implement(['sql'=>$sql]);
}
}
// 钩子部署
......
......@@ -37,11 +37,9 @@ class PluginsService
*/
public static function PluginsData($plugins, $attachment_field = [], $is_cache = true)
{
// 从缓存获取数据
// 从缓存获取数据、数据不存在则从数据库读取
$data = ($is_cache === true) ? self::PluginsCacheData($plugins) : [];
// 数据不存在则从数据库读取
if($data === null)
if($data === null || !$is_cache)
{
// 获取数据
$ret = self::PluginsField($plugins, 'data');
......@@ -204,8 +202,7 @@ class PluginsService
*/
public static function PluginsCacheData($plugins)
{
$data = MyCache(MyConfig('shopxo.cache_plugins_data_key').$plugins);
return empty($data) ? '' : $data;
return MyCache(MyConfig('shopxo.cache_plugins_data_key').$plugins);
}
/**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册