插件数据优化

This commit is contained in:
Devil 2021-07-23 19:21:35 +08:00
parent c112313962
commit 58f1ad14ac
2 changed files with 8 additions and 7 deletions

View File

@ -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]);
}
}
// 钩子部署

View File

@ -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);
}
/**