mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-02 01:52:10 +09:00
Fix unnecessary cache file refresh in menu module
This commit is contained in:
parent
40adc7f6dc
commit
d3b78d1d47
2 changed files with 16 additions and 15 deletions
|
|
@ -1027,22 +1027,18 @@ class ModuleHandler extends Handler
|
|||
$oMenuAdminController = getAdminController('menu');
|
||||
$homeMenuCacheFile = $oMenuAdminController->getHomeMenuCacheFile();
|
||||
|
||||
$homeMenuSrl = 0;
|
||||
if(FileHandler::exists($homeMenuCacheFile))
|
||||
{
|
||||
include($homeMenuCacheFile);
|
||||
}
|
||||
|
||||
|
||||
$menu->xml_file = './files/cache/menu/' . $homeMenuSrl . '.xml.php';
|
||||
$menu->php_file = './files/cache/menu/' . $homeMenuSrl . '.php';
|
||||
if(!$menu->menu_srl)
|
||||
{
|
||||
$menu->xml_file = str_replace('.xml.php', $homeMenuSrl . '.xml.php', $menu->xml_file);
|
||||
$menu->php_file = str_replace('.php', $homeMenuSrl . '.php', $menu->php_file);
|
||||
$layout_info->menu->{$menu_id}->menu_srl = $homeMenuSrl;
|
||||
}
|
||||
else
|
||||
{
|
||||
$menu->xml_file = str_replace($menu->menu_srl, $homeMenuSrl, $menu->xml_file);
|
||||
$menu->php_file = str_replace($menu->menu_srl, $homeMenuSrl, $menu->php_file);
|
||||
}
|
||||
}
|
||||
|
||||
$php_file = FileHandler::exists($menu->php_file);
|
||||
|
|
|
|||
|
|
@ -1763,11 +1763,20 @@ class menuAdminController extends menu
|
|||
{
|
||||
// Return if there is no information when creating the xml file
|
||||
if(!$menu_srl) return;
|
||||
// Specify the name of the cache file
|
||||
$xml_file = sprintf(_XE_PATH_ . "files/cache/menu/%s.xml.php", $menu_srl);
|
||||
$php_file = sprintf(_XE_PATH_ . "files/cache/menu/%s.php", $menu_srl);
|
||||
// Get menu informaton
|
||||
$args = new stdClass();
|
||||
$args->menu_srl = $menu_srl;
|
||||
$output = executeQuery('menu.getMenu', $args);
|
||||
if(!$output->toBool() || !$output->data) return $output;
|
||||
if(!$output->toBool()) return $output;
|
||||
if(!$output->data)
|
||||
{
|
||||
FileHandler::writeFile($xml_file, '<root />');
|
||||
FileHandler::writeFile($php_file, '<?php if(!defined("__XE__")) exit(); ?>');
|
||||
return $xml_file;
|
||||
}
|
||||
$site_srl = (int)$output->data->site_srl;
|
||||
|
||||
if($site_srl)
|
||||
|
|
@ -1781,16 +1790,12 @@ class menuAdminController extends menu
|
|||
$args->menu_srl = $menu_srl;
|
||||
$args->sort_index = 'listorder';
|
||||
$output = executeQuery('menu.getMenuItems', $args);
|
||||
if(!$output->toBool()) return;
|
||||
// Specify the name of the cache file
|
||||
$xml_file = sprintf(_XE_PATH_ . "files/cache/menu/%s.xml.php", $menu_srl);
|
||||
$php_file = sprintf(_XE_PATH_ . "files/cache/menu/%s.php", $menu_srl);
|
||||
if(!$output->toBool()) return $output;
|
||||
// If no data found, generate an XML file without node data
|
||||
$list = $output->data;
|
||||
if(!$list)
|
||||
{
|
||||
$xml_buff = "<root />";
|
||||
FileHandler::writeFile($xml_file, $xml_buff);
|
||||
FileHandler::writeFile($xml_file, '<root />');
|
||||
FileHandler::writeFile($php_file, '<?php if(!defined("__XE__")) exit(); ?>');
|
||||
return $xml_file;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue