Skip to content

Commit 3c25cc9

Browse files
authored
[0512] 清理旧更新器配置与死代码 (#4319)
1 parent 58b443e commit 3c25cc9

11 files changed

Lines changed: 17 additions & 142 deletions

File tree

TeXmacs/progs/kernel/texmacs/pref-keys.scm

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,6 @@
220220
(define-public (pref-security) "security")
221221
(define-public (pref-scripting-language) "scripting language")
222222
(define-public (pref-document-update-times) "document update times")
223-
(define-public (pref-updater-interval) "updater:interval")
224223

225224
;; ---- Other / Experimental toggles ----
226225
(define-public (pref-experimental-fast-environments) "fast environments")

TeXmacs/progs/prog/glue-symbols.scm

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,8 @@
2626
'("texmacs-version-release"
2727
"version-before?"
2828
"use-plugin-updater?"
29-
"updater-running?"
3029
"updater-check-background"
31-
"updater-check-foreground"
3230
"updater-last-check"
33-
"updater-set-interval"
3431
"updater-state"
3532
"updater-download"
3633
"updater-apply"

TeXmacs/progs/texmacs/menus/preferences-tools.scm

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -124,29 +124,6 @@
124124
) ;let*
125125
) ;define
126126

127-
;; updater last check:info 行显示上次检查更新时间(updater 插件注入)。
128-
129-
(define (updater-last-check-formatted)
130-
"Time since last update check formatted for use in the preferences dialog"
131-
(with c
132-
(updater-last-check)
133-
(if (<= c 0)
134-
"Never"
135-
(with h
136-
(ceiling (/ (- (current-time) c) 3600))
137-
(cond ((< h 24) (replace "Less than %1 hour(s) ago" h))
138-
((< h 720) (replace "%1 days ago" (ceiling (/ h 24))))
139-
(else (translate "More than 1 month ago"))
140-
) ;cond
141-
) ;with
142-
) ;if
143-
) ;with
144-
) ;define
145-
146-
(define (last-check-string)
147-
(if (use-plugin-updater?) (updater-last-check-formatted) "Never (unsupported)")
148-
) ;define
149-
150127
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
151128
;; QML facade 纯函数族:紧凑字段格式 (key label options options-pretty
152129
;; editable? . flags) -> assoc-list field-descriptor(供 C++ bridge 消费)。
@@ -276,7 +253,6 @@
276253
((== (cdr pf) 'macos-only) (os-macos?))
277254
((== (cdr pf) 'native-pdf-only) (supports-native-pdf?))
278255
((== (cdr pf) 'qt-only) (qt-gui?))
279-
((== (cdr pf) 'updater-only) (use-plugin-updater?))
280256
(else #t)
281257
) ;cond
282258
) ;let*
@@ -304,8 +280,6 @@
304280
((== key "latex:transparent-source-tracking")
305281
(if (get-latex-transparent-source-tracking) "on" "off")
306282
) ;
307-
;; Last check info:非真实 preference,显示上次检查更新时间(updater 插件注入)。
308-
((== key "updater:last-check") (last-check-string))
309283
((== kind "toggle") (if (get-boolean-preference key) "on" "off"))
310284
(else "")
311285
) ;cond

TeXmacs/progs/texmacs/menus/preferences-widgets.scm

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -202,14 +202,6 @@
202202
("accept all scripts" "Accept all scripts")
203203
) ;define-preference-names
204204

205-
(define-preference-names "updater:interval"
206-
("0" "Never")
207-
("0" "Unsupported")
208-
("24" "Once a day")
209-
("168" "Once a week")
210-
("720" "Once a month")
211-
) ;define-preference-names
212-
213205
(define-preference-names "document update times"
214206
("1" "Once")
215207
("2" "Twice")
@@ -952,27 +944,6 @@
952944
'("Once" "Twice" "Three times")
953945
#f
954946
) ;list
955-
;; updater 字段仅启用插件更新器时可见(use-plugin-updater?)。
956-
(list (pref-updater-interval)
957-
"Check for automatic updates"
958-
'("0" "24" "168" "720")
959-
'("Never" "Once a day" "Once a week" "Once a month")
960-
#f
961-
'platform-filter
962-
'updater-only
963-
) ;list
964-
;; Last check:info 只读行,显示上次检查更新时间(updater 插件启用时)。
965-
;; 'info flag 显式标 info kind(key 非空但无 setter、不入 diff)。
966-
(list "updater:last-check"
967-
"Last check"
968-
'()
969-
'()
970-
#f
971-
'info
972-
#t
973-
'platform-filter
974-
'updater-only
975-
) ;list
976947
) ;list
977948
) ;define
978949

TeXmacs/progs/utils/misc/updater.scm

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@
1515

1616
(texmacs-module (utils misc updater))
1717

18-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
19-
;; Preference management
20-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
21-
2218
(tm-define (updater-initialize)
2319
(when (use-plugin-updater?)
2420
(updater-check-background)
@@ -27,8 +23,6 @@
2723
) ;when
2824
) ;tm-define
2925

30-
(define-preferences ("updater:interval" "null" noop))
31-
3226
;; 下载已可用更新(非更新器平台或未到 available 状态返回 #f)。
3327
;; 返回是否已启动下载。
3428

devel/0512.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,28 @@ Velopack:以 Velopack 作为安装/更新事务的唯一所有者,产出 `Se
4747
下载就绪(ready)后不再动作,下次启动由 `VelopackApp::Build().Run()` 自动应用;
4848
下载失败(failed)不立即重试,等下一次定时检查(1 小时)重新发现更新后再试。
4949
自动下载默认启用、不提供独立配置入口(后续统一入口统一管理)。
50+
6. **旧代码清理(本次)**:删除旧 WinSparkle 时代的 `updater:interval` 偏好骨架——
51+
`define-preferences``pref-updater-interval`、preferences 的 "Check for automatic
52+
updates" 字段与 `updater:last-check` 显示行、`updater-last-check-formatted`/
53+
`last-check-string` helper、`updater-only` 平台过滤;同时删除无人消费的 glue 与
54+
C++ 死代码:`updater-running?`/`updater-check-foreground`/`updater-set-interval`
55+
(含 `isRunning`/`checkInForeground`/`setCheckInterval`/`getCheckInterval`/
56+
`setAppcast``appcast`/`interval` 成员)。检查节奏已由 scheme 硬编码 1 小时,
57+
interval 配置不再需要。
58+
5. **测试期望回归修复(本次)**:清理提交把 `preferences-widgets-test.scm`
59+
`"other"` tab 字段数期望从 `(if (os-macos?) 17 15)` 误改为 `15 13`。但测试环境
60+
`use-plugin-updater?``#f`,旧代码 `updater-only` 平台过滤本就把两个 updater
61+
字段滤掉,测试计数从未包含它们——从字段列表删除它们不改变计数。实际计数
62+
macOS 仍为 17(misc 5 + experimental 12)、Debian 为 15;Windows CI
63+
`ci-xmake-windows.yml`)不运行 scheme 单元测试,静态同为 15。恢复期望为
64+
`(if (os-macos?) 17 15)``xmake r preferences-widgets-test` 426 checks 全过。
5065

5166
### 涉及文件
5267

5368
- `src/Mogan/Research/research.cpp``xmake/targets/stem.lua``xmake/targets/libmogan.lua`
5469
- `src/Plugins/Updater/tm_updater.*``tm_velopack.*`(新增)、`src/Scheme/Plugins/glue_updater.lua`
5570
- `TeXmacs/progs/utils/misc/updater.scm``TeXmacs/progs/prog/glue-symbols.scm`
71+
- `TeXmacs/progs/texmacs/menus/tests/preferences-widgets-test.scm`(期望值回归修复)
5672

5773
### 如何测试
5874

src/Plugins/Updater/tm_updater.cpp

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -37,30 +37,12 @@ tm_updater::instance () {
3737
* Scheme interface
3838
******************************************************************************/
3939

40-
bool
41-
updater_is_running () {
42-
tm_updater* updater= tm_updater::instance ();
43-
return updater && updater->isRunning ();
44-
}
45-
4640
bool
4741
updater_check_background () {
4842
tm_updater* updater= tm_updater::instance ();
4943
return updater && updater->checkInBackground ();
5044
}
5145

52-
bool
53-
updater_check_foreground () {
54-
tm_updater* updater= tm_updater::instance ();
55-
return updater && updater->checkInForeground ();
56-
}
57-
58-
bool
59-
updater_set_interval (int hours) {
60-
tm_updater* updater= tm_updater::instance ();
61-
return updater && updater->setCheckInterval (hours);
62-
}
63-
6446
time_t
6547
updater_last_check () {
6648
tm_updater* updater= tm_updater::instance ();

src/Plugins/Updater/tm_updater.hpp

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,7 @@ enum tm_updater_state {
3232

3333
class tm_updater {
3434
protected:
35-
static const int MinimumCheckInterval= 24; //<! in hours
36-
static const int MaximumCheckInterval= 24 * 31; //<! in hours
37-
38-
url appcast;
39-
int interval;
40-
41-
tm_updater () : interval (0) {}
35+
tm_updater () {}
4236
tm_updater (const tm_updater&);
4337
void operator= (const tm_updater&);
4438
virtual ~tm_updater () {};
@@ -47,15 +41,8 @@ class tm_updater {
4741
static tm_updater* instance ();
4842

4943
virtual bool checkInBackground () { return false; } // non-blocking
50-
virtual bool checkInForeground () { return false; } // non-blocking
51-
virtual bool isRunning () const { return false; }
5244

5345
virtual time_t lastCheck () const { return 0; }
54-
virtual bool getCheckInterval () const { return interval; }
55-
virtual bool setCheckInterval (int hours) {
56-
(void) hours;
57-
return false;
58-
}
5946

6047
virtual tm_updater_state state () const { return UPDATER_IDLE; }
6148
virtual string availableVersion () const { return string (); }
@@ -64,20 +51,13 @@ class tm_updater {
6451
virtual string errorCode () const { return string (); }
6552
virtual bool downloadUpdate () { return false; }
6653
virtual bool applyUpdate () { return false; }
67-
virtual bool setAppcast (url _url) {
68-
appcast= _url;
69-
return true;
70-
}
7154
};
7255

7356
/******************************************************************************
7457
* Scheme interface
7558
******************************************************************************/
7659

77-
bool updater_is_running ();
7860
bool updater_check_background ();
79-
bool updater_check_foreground ();
80-
bool updater_set_interval (int hours);
8161
time_t updater_last_check ();
8262

8363
int updater_state ();

src/Plugins/Updater/tm_velopack.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -159,29 +159,12 @@ tm_velopack::checkInBackground () {
159159
return true;
160160
}
161161

162-
bool
163-
tm_velopack::checkInForeground () {
164-
return checkInBackground ();
165-
}
166-
167-
bool
168-
tm_velopack::isRunning () const {
169-
std::lock_guard<std::mutex> lk (rep->mtx);
170-
return rep->running;
171-
}
172-
173162
time_t
174163
tm_velopack::lastCheck () const {
175164
std::lock_guard<std::mutex> lk (rep->mtx);
176165
return rep->last;
177166
}
178167

179-
bool
180-
tm_velopack::setCheckInterval (int hours) {
181-
interval= hours;
182-
return true;
183-
}
184-
185168
void
186169
tm_velopack::do_check () {
187170
try {

src/Plugins/Updater/tm_velopack.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,7 @@ class tm_velopack : public tm_updater {
3838

3939
public:
4040
bool checkInBackground ();
41-
bool checkInForeground ();
42-
bool isRunning () const;
4341
time_t lastCheck () const;
44-
bool setCheckInterval (int hours);
4542

4643
tm_updater_state state () const;
4744
string availableVersion () const;

0 commit comments

Comments
 (0)