Skip to content

Commit ca7ce40

Browse files
committed
Settings
1 parent 56971ef commit ca7ce40

File tree

13 files changed

+30
-31
lines changed

13 files changed

+30
-31
lines changed

src/JR.Cms.App/JR.Cms.App.csproj

+6-6
Original file line numberDiff line numberDiff line change
@@ -477,12 +477,12 @@
477477
<Content Include="templates\default\css\default\tit-bar-03.png" />
478478
<Content Include="templates\default\css\default\tit-bar-mult.png" />
479479
<Content Include="templates\default\css\default\ver-split.png" />
480-
<Content Include="templates\default\include\flash_banner.part.html" />
481-
<Content Include="templates\default\include\footer.backup.part.html" />
482-
<Content Include="templates\default\include\footer.part.html" />
483-
<Content Include="templates\default\include\header.part.html" />
484-
<Content Include="templates\default\include\share_control.part.html" />
485-
<Content Include="templates\default\include\side_bar.part.html" />
480+
<Content Include="templates\default\include\flash_banner.html" />
481+
<Content Include="templates\default\include\footer.backup.html" />
482+
<Content Include="templates\default\include\footer.html" />
483+
<Content Include="templates\default\include\header.html" />
484+
<Content Include="templates\default\include\share_control.html" />
485+
<Content Include="templates\default\include\side_bar.html" />
486486
<Content Include="templates\default\index.html" />
487487
<Content Include="templates\default\not_found.html" />
488488
<Content Include="templates\default\search.html" />

src/JR.Cms.App/public/mui/html/cms.config.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
<span class="red">*</span>内存回收:
118118
</div>
119119
<div class="in">
120-
<input type="text" class="tb_normal ui-box ui-validate" required="true" isnumber="true" field="opti_gc_collect_interval" style="width: 40px" />分钟/次&nbsp;&nbsp;
120+
<input type="text" class="tb_normal ui-box ui-validate" required="true" isnumber="true" field="opti_gc_collect_interval" style="width: 80px" />分钟/次&nbsp;&nbsp;
121121
<div>(设置为0则不回收,修改重启网站后生效!)</div>
122122
</div>
123123
</div>
@@ -126,7 +126,7 @@
126126
<span class="red">*</span>首页缓存:
127127
</div>
128128
<div class="in">
129-
<input type="text" class="tb_normal ui-box ui-validate" required="true" isnumber="true" field="opti_index_cache_seconds" style="width: 40px" />
129+
<input type="text" class="tb_normal ui-box ui-validate" required="true" isnumber="true" field="perm_index_cache_second" style="width: 80px" />
130130
分钟(0表示不缓存)
131131
</div>
132132
</div>
@@ -135,7 +135,7 @@
135135
<span class="red">*</span>客户端缓存:
136136
</div>
137137
<div class="in">
138-
<input type="text" class="tb_normal ui-box ui-validate" required="true" isnumber="true" field="opti_client_cache_seconds" style="width: 40px" />
138+
<input type="text" class="tb_normal ui-box ui-validate" required="true" isnumber="true" field="opti_client_cache_seconds" style="width: 80px" />
139139
分钟(0表示不缓存)
140140
</div>
141141
</div>

src/JR.Cms.App/root/5383.wav

-19.6 KB
Binary file not shown.

src/JR.Cms/Conf/Configuration.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ private static string Load(string filePath)
7676

7777
Settings.TPL_FULL_URL_PATH = !sf.Contains("tpl_full_url_path") || sf["tpl_full_url_path"] == "true";
7878
Settings.TPL_USE_COMPRESS = sf.Contains("tpl_use_compress") && sf["tpl_use_compress"] == "true";
79-
Settings.TPL_USE_CACHE = sf.Contains("tpl_use_cache") && sf["tpl_use_cache"] == "true";
79+
Settings.TPL_USE_CACHE = !sf.Contains("tpl_use_cache") || sf["tpl_use_cache"] == "true";
8080

8181
#endregion
8282

@@ -91,9 +91,9 @@ private static string Load(string filePath)
9191
Settings.OPTI_DEBUG_MODE = WebConfig.IsDebug();
9292

9393
//缓存项
94-
if (sf.Contains("opti_index_cache_seconds"))
94+
if (sf.Contains("perm_index_cache_second"))
9595
{
96-
Int32.TryParse(sf["opti_index_cache_seconds"], out Settings.Opti_IndexCacheSeconds);
96+
Int32.TryParse(sf["perm_index_cache_second"], out Settings.PERM_INDEX_CACHE_SECOND);
9797
}
9898

9999
if (sf.Contains("opti_client_cache_seconds"))
@@ -270,7 +270,7 @@ private static void UpdateKeys(string prefix)
270270
//优化
271271
case "opti":
272272
//缓存项
273-
sf.Set("opti_index_cache_seconds", Settings.Opti_IndexCacheSeconds.ToString());
273+
sf.Set("perm_index_cache_second", Settings.PERM_INDEX_CACHE_SECOND.ToString());
274274
sf.Set("opti_gc_collect_interval", Settings.opti_gc_collect_interval.ToString());
275275
sf.Set("opti_client_cache_seconds", Settings.Opti_ClientCacheSeconds.ToString());
276276
break;

src/JR.Cms/Conf/Settings.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ static Settings()
116116
/// <summary>
117117
/// 是否使用压缩
118118
/// </summary>
119-
public static bool TPL_USE_COMPRESS;
119+
public static bool TPL_USE_COMPRESS = true;
120120

121121
/// <summary>
122122
/// 多模板公享模式
@@ -186,7 +186,7 @@ static Settings()
186186
/// <summary>
187187
/// 首页缓存秒数
188188
/// </summary>
189-
public static int Opti_IndexCacheSeconds = 0;
189+
public static int PERM_INDEX_CACHE_SECOND = 0;
190190

191191
/// <summary>
192192
/// GC回收间隔(默认30分钟回收一次)

src/JR.Cms/Web/CmsTask.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ public static void Init()
4242
box.OnTaskExecuting += taskClient.Execute;
4343
});
4444

45-
RegistDropMemoryTask();
45+
RegisterDropMemoryTask();
4646
}
4747

48-
private static void RegistDropMemoryTask()
48+
private static void RegisterDropMemoryTask()
4949
{
5050
if (Settings.opti_gc_collect_interval <= 0)
5151
return;

src/JR.Cms/Web/Manager/EachClass.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ public static void IterTemplateFiles2(DirectoryInfo dir, int subLen, IList<Templ
215215
if (!dir.Exists || dir.Name == ".backup") return;
216216
foreach (var file in dir.GetFiles())
217217
if ((file.Attributes & FileAttributes.Hidden) != FileAttributes.Hidden
218-
&& CheckExtension(file, ".html|.part.html"))
218+
&& CheckExtension(file, ".html|.html"))
219219
{
220220
var path = file.FullName.Substring(subLen).Replace("\\", "/");
221221
nameDictionary.TryGetValue(path, out var value);

src/JR.Cms/Web/Manager/FileExplor.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ private static string CreateFile(string filePath)
244244
private static void CheckReloadTemplate(string filePath, bool isDir)
245245
{
246246
if (filePath.IndexOf("/templates/") == -1) return;
247-
if (isDir || filePath.EndsWith(".html") || filePath.EndsWith(".part.html"))
247+
if (isDir || filePath.EndsWith(".html") || filePath.EndsWith(".html"))
248248
{
249249
Cms.Template.Reload();
250250
}

src/JR.Cms/Web/Manager/Handle/SystemHandler.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ public void Config()
351351
sys_admin_tag = Settings.SYS_ADMIN_TAG,
352352
sys_encode_conf = Settings.SYS_ENCODE_CONF_FILE,
353353
db_prefix = Settings.DB_PREFIX,
354-
opti_index_cache_seconds = (Settings.Opti_IndexCacheSeconds / 60).ToString(),
354+
perm_index_cache_second = (Settings.PERM_INDEX_CACHE_SECOND / 60).ToString(),
355355
opti_client_cache_seconds = (Settings.Opti_ClientCacheSeconds / 60).ToString(),
356356
opti_gc_collect_interval = Settings.opti_gc_collect_interval / 3600000,
357357
opti_debug = Settings.OPTI_DEBUG_MODE,
@@ -393,7 +393,7 @@ public void Config_POST()
393393
Settings.SYS_ADMIN_TAG = req.Form("sys_admin_tag");
394394

395395
//缓存
396-
Settings.Opti_IndexCacheSeconds = int.Parse(req.Form("opti_index_cache_seconds")) * 60;
396+
Settings.PERM_INDEX_CACHE_SECOND = int.Parse(req.Form("perm_index_cache_second")) * 60;
397397
Settings.Opti_ClientCacheSeconds = int.Parse(req.Form("opti_client_cache_seconds")) * 60;
398398
Settings.opti_gc_collect_interval = int.Parse(req.Form("opti_gc_collect_interval")) * 3600000;
399399

src/JR.Cms/Web/Portal/Comm/CmsInstallWiz.cs

-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ private InstallCode Process(ICompatibleHttpContext context)
171171
file.Set("license_name", licenceName);
172172
file.Set("server_static", "");
173173
file.Set("server_static_enabled", "false");
174-
175174
file.Set("db_type", dbType);
176175
file.Set("db_conn", dbStr);
177176
file.Set("db_prefix", dbPrefix);

src/JR.Cms/Web/Portal/Comm/PortalController.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ private bool CheckSiteUrl(ICompatibleHttpContext ctx, SiteDto site)
7070
public Task Index(ICompatibleHttpContext context)
7171
{
7272
// 如果启用了静态文件缓存
73-
if (Settings.Opti_IndexCacheSeconds > 0)
73+
if (Settings.PERM_INDEX_CACHE_SECOND > 0)
7474
{
75-
var task = this.CheckStaticIndex(context, Settings.Opti_IndexCacheSeconds);
75+
var task = this.CheckStaticIndex(context, Settings.PERM_INDEX_CACHE_SECOND);
7676
if (task != null) return task;
7777
}
7878

src/JR.Stand.Core/Template/Impl/TemplateRegistry.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public static bool Exists(String templatePath)
5454
private static void RegisterTemplates(DirectoryInfo dir, Options options)
5555
{
5656
// tml 为模板文件,防止可以被直接浏览
57-
Regex allowExt = new Regex("(.html|.part.html)$", RegexOptions.IgnoreCase);
57+
Regex allowExt = new Regex("(.html|.html)$", RegexOptions.IgnoreCase);
5858
foreach (FileInfo file in dir.GetFiles())
5959
{
6060
if (allowExt.IsMatch(file.Extension))

src/JR.Stand.Core/Template/Impl/TemplateUtility.cs

+6-6
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ internal static string GetTemplateId(string filePath, TemplateNames nameType)
5959
if (String.IsNullOrEmpty(match.Value)) throw new Exception("模版页文件名:" + filePath + "不合法");
6060
string fileName = match.Groups[2].Value;
6161
String lowerFileName = fileName.ToLower();
62-
if (lowerFileName.EndsWith(".part.html") || nameType == TemplateNames.ID)
62+
if (lowerFileName.EndsWith(".html") || nameType == TemplateNames.ID)
6363
{
6464
//return MD5.EncodeTo16(Regex.Replace(fileName, "/|\\\\", String.Empty).ToLower());
6565
}
@@ -91,7 +91,7 @@ internal static string GetPartialTemplateId(string partPath, string filePath, ou
9191
DirectoryInfo dPar = null;
9292
DirectoryInfo dCurr = new FileInfo(walkFilePath).Directory;
9393

94-
//example path: ../../inc/top.part.html
94+
//example path: ../../inc/top.html
9595
if (Regex.IsMatch(partPath, "^\\.\\./"))
9696
{
9797
Regex pathRegex = new Regex("\\.\\./");
@@ -122,7 +122,7 @@ internal static string GetPartialTemplateId(string partPath, string filePath, ou
122122
else
123123
{
124124
//
125-
//example path: inc/top.part.html
125+
//example path: inc/top.html
126126
//
127127

128128
do
@@ -212,9 +212,9 @@ function dynamicTable(table) {
212212

213213
sb.Append(@"<tr><td colspan=""6"" align=""center"" style=""background:#f0f0f0;color:#333"">
214214
部分视图扩展名为“.phtml”,可允许格式如:
215-
&nbsp;&nbsp;A:${include:""inc/header.part.html""}
216-
&nbsp;&nbsp;B:${include:""/tmpdir/inc/header.part.html""}
217-
&nbsp;&nbsp;C:${include:""../../inc/header.part.html""}
215+
&nbsp;&nbsp;A:${include:""inc/header.html""}
216+
&nbsp;&nbsp;B:${include:""/tmpdir/inc/header.html""}
217+
&nbsp;&nbsp;C:${include:""../../inc/header.html""}
218218
</td></tr>");
219219

220220
sb.Append(

0 commit comments

Comments
 (0)