mirror of
https://github.com/QB64-Phoenix-Edition/QB64pe.git
synced 2024-09-07 08:20:18 +00:00
Wiki update refactoring
Some changes/fixes in the update flow.
This commit is contained in:
parent
87a234b45b
commit
81d4983219
1 changed files with 38 additions and 31 deletions
|
@ -5464,7 +5464,7 @@ FUNCTION ide2 (ignore)
|
||||||
|
|
||||||
IF menu$(m, s) = "Update All #Pages..." THEN
|
IF menu$(m, s) = "Update All #Pages..." THEN
|
||||||
PCOPY 2, 0
|
PCOPY 2, 0
|
||||||
q$ = ideyesnobox("Update Help", "This can take up to 20 minutes.\nRedownload all cached help content from the wiki?")
|
q$ = ideyesnobox("Update Help", "This can take up to 15 minutes.\nRedownload all cached help content from the wiki?")
|
||||||
PCOPY 2, 0
|
PCOPY 2, 0
|
||||||
IF q$ = "Y" THEN
|
IF q$ = "Y" THEN
|
||||||
Help_Recaching = 1: Help_IgnoreCache = 1
|
Help_Recaching = 1: Help_IgnoreCache = 1
|
||||||
|
@ -18820,6 +18820,7 @@ FUNCTION ideupdatehelpbox
|
||||||
'update steps
|
'update steps
|
||||||
SELECT CASE UpdateStep
|
SELECT CASE UpdateStep
|
||||||
CASE 1
|
CASE 1
|
||||||
|
FullMessage$(1) = "Preparing help update..."
|
||||||
FullMessage$(2) = "Generating list of cached content..."
|
FullMessage$(2) = "Generating list of cached content..."
|
||||||
CASE 2
|
CASE 2
|
||||||
FullMessage$(2) = "Adding core help pages to list..."
|
FullMessage$(2) = "Adding core help pages to list..."
|
||||||
|
@ -18844,7 +18845,6 @@ FUNCTION ideupdatehelpbox
|
||||||
maxprogresswidth = 52 'arbitrary
|
maxprogresswidth = 52 'arbitrary
|
||||||
percentage = INT(n / c * 100)
|
percentage = INT(n / c * 100)
|
||||||
percentagechars = INT(maxprogresswidth * n / c)
|
percentagechars = INT(maxprogresswidth * n / c)
|
||||||
'percentageMsg$ = "[" + STRING$(percentagechars, 254) + SPACE$(maxprogresswidth - percentagechars) + "]" + STR$(percentage) + "%"
|
|
||||||
percentageMsg$ = STRING$(percentagechars, 219) + STRING$(maxprogresswidth - percentagechars, 176) + STR$(percentage) + "%"
|
percentageMsg$ = STRING$(percentagechars, 219) + STRING$(maxprogresswidth - percentagechars, 176) + STR$(percentage) + "%"
|
||||||
_PRINTSTRING (p.x + (p.w \ 2 - LEN(percentageMsg$) \ 2) + 1, p.y + 4), percentageMsg$
|
_PRINTSTRING (p.x + (p.w \ 2 - LEN(percentageMsg$) \ 2) + 1, p.y + 4), percentageMsg$
|
||||||
ELSEIF UpdateStep = 6 THEN
|
ELSEIF UpdateStep = 6 THEN
|
||||||
|
@ -18908,29 +18908,44 @@ FUNCTION ideupdatehelpbox
|
||||||
SELECT CASE UpdateStep
|
SELECT CASE UpdateStep
|
||||||
CASE 1
|
CASE 1
|
||||||
'Create a list of all files to be recached
|
'Create a list of all files to be recached
|
||||||
|
st# = TIMER(0.001)
|
||||||
IF Help_Recaching < 2 THEN
|
IF Help_Recaching < 2 THEN
|
||||||
f$ = CHR$(0) + idezfilelist$("internal/help", 2, "*.txt") + CHR$(0)
|
f$ = CHR$(0) + idezfilelist$("internal/help", 2, "*.txt") + CHR$(0)
|
||||||
IF LEN(f$) = 2 THEN f$ = CHR$(0)
|
IF LEN(f$) = 2 THEN f$ = CHR$(0)
|
||||||
ELSE
|
ELSE
|
||||||
f$ = CHR$(0) 'no dir scan for 'qb64pe -u' (build time update)
|
f$ = CHR$(0) 'no dir scan for 'qb64pe -u' (build time update)
|
||||||
END IF
|
END IF
|
||||||
|
et# = TIMER(0.001) - st#: IF et# < 0 THEN et# = et# + 86400
|
||||||
'Prepend core pages to list
|
IF 1.25 - et# > 0 THEN _DELAY 1.25 - et#
|
||||||
f$ = CHR$(0) + "Keyword_Reference_-_By_usage.txt" + f$
|
|
||||||
f$ = CHR$(0) + "QB64_Help_Menu.txt" + f$
|
|
||||||
f$ = CHR$(0) + "QB64_FAQ.txt" + f$
|
|
||||||
UpdateStep = UpdateStep + 1
|
UpdateStep = UpdateStep + 1
|
||||||
CASE 2
|
CASE 2
|
||||||
|
'Prepend core pages to list (if not already in list)
|
||||||
|
st# = TIMER(0.001)
|
||||||
|
PageName2$ = "QB64_FAQ.txt"
|
||||||
|
IF INSTR(f$, CHR$(0) + PageName2$ + CHR$(0)) = 0 THEN f$ = CHR$(0) + PageName2$ + f$
|
||||||
|
PageName2$ = "QB64_Help_Menu.txt"
|
||||||
|
IF INSTR(f$, CHR$(0) + PageName2$ + CHR$(0)) = 0 THEN f$ = CHR$(0) + PageName2$ + f$
|
||||||
|
PageName2$ = "ERROR_Codes.txt"
|
||||||
|
IF INSTR(f$, CHR$(0) + PageName2$ + CHR$(0)) = 0 THEN f$ = CHR$(0) + PageName2$ + f$
|
||||||
|
PageName2$ = "Keywords_currently_not_supported_by_QB64.txt"
|
||||||
|
IF INSTR(f$, CHR$(0) + PageName2$ + CHR$(0)) = 0 THEN f$ = CHR$(0) + PageName2$ + f$
|
||||||
|
PageName2$ = "Keyword_Reference_-_By_usage.txt"
|
||||||
|
IF INSTR(f$, CHR$(0) + PageName2$ + CHR$(0)) = 0 THEN f$ = CHR$(0) + PageName2$ + f$
|
||||||
|
et# = TIMER(0.001) - st#: IF et# < 0 THEN et# = et# + 86400
|
||||||
|
IF 1.25 - et# > 0 THEN _DELAY 1.25 - et#
|
||||||
UpdateStep = UpdateStep + 1
|
UpdateStep = UpdateStep + 1
|
||||||
CASE 3
|
CASE 3
|
||||||
'Download and PARSE alphabetical index to build required F1 help links
|
'Download and PARSE alphabetical index to build required F1 help links
|
||||||
FullMessage$(1) = "Regenerating keyword list..."
|
st# = TIMER(0.001)
|
||||||
a$ = Wiki$("Keyword Reference - Alphabetical")
|
a$ = Wiki$("Keyword Reference - Alphabetical")
|
||||||
IF INSTR(a$, "{{PageInternalError}}") > 0 THEN ideupdatehelpbox = 1: EXIT DO
|
IF INSTR(a$, "{{PageInternalError}}") > 0 THEN ideupdatehelpbox = 1: EXIT DO
|
||||||
WikiParse a$ 'update links.bin and check for plugin templates
|
WikiParse a$ 'update links.bin and check for plugin templates
|
||||||
|
et# = TIMER(0.001) - st#: IF et# < 0 THEN et# = et# + 86400
|
||||||
|
IF 1.25 - et# > 0 THEN _DELAY 1.25 - et#
|
||||||
UpdateStep = UpdateStep + 1
|
UpdateStep = UpdateStep + 1
|
||||||
CASE 4
|
CASE 4
|
||||||
'Add all linked pages to download list (if not already in list)
|
'Add all linked pages to download list (if not already in list)
|
||||||
|
st# = TIMER(0.001)
|
||||||
fh = FREEFILE
|
fh = FREEFILE
|
||||||
OPEN "internal\help\links.bin" FOR INPUT AS #fh
|
OPEN "internal\help\links.bin" FOR INPUT AS #fh
|
||||||
DO UNTIL EOF(fh)
|
DO UNTIL EOF(fh)
|
||||||
|
@ -18952,39 +18967,32 @@ FUNCTION ideupdatehelpbox
|
||||||
END SELECT
|
END SELECT
|
||||||
NEXT
|
NEXT
|
||||||
PageName2$ = PageName2$ + ".txt"
|
PageName2$ = PageName2$ + ".txt"
|
||||||
IF INSTR(f$, CHR$(0) + PageName2$ + CHR$(0)) = 0 THEN
|
IF INSTR(f$, CHR$(0) + PageName2$ + CHR$(0)) = 0 THEN f$ = f$ + PageName2$ + CHR$(0)
|
||||||
f$ = f$ + PageName2$ + CHR$(0)
|
|
||||||
END IF
|
|
||||||
END IF
|
END IF
|
||||||
END IF
|
END IF
|
||||||
LOOP
|
LOOP
|
||||||
CLOSE #fh
|
CLOSE #fh
|
||||||
|
'count all listed files to download
|
||||||
'Redownload all listed files
|
c = 0
|
||||||
IF f$ <> CHR$(0) THEN
|
FOR x = 2 TO LEN(f$)
|
||||||
c = 0 'count files to download
|
IF ASC(f$, x) = 0 THEN c = c + 1
|
||||||
FOR x = 2 TO LEN(f$)
|
NEXT
|
||||||
IF ASC(f$, x) = 0 THEN c = c + 1
|
'set start conditions
|
||||||
NEXT
|
f$ = RIGHT$(f$, LEN(f$) - 1)
|
||||||
c = c - 1
|
n = 0
|
||||||
|
|
||||||
f$ = RIGHT$(f$, LEN(f$) - 1)
|
|
||||||
z$ = CHR$(0)
|
|
||||||
n = 0
|
|
||||||
ELSE
|
|
||||||
GOTO stoprecache
|
|
||||||
END IF
|
|
||||||
FullMessage$(2) = ""
|
FullMessage$(2) = ""
|
||||||
|
et# = TIMER(0.001) - st#: IF et# < 0 THEN et# = et# + 86400
|
||||||
|
IF 1.25 - et# > 0 THEN _DELAY 1.25 - et#
|
||||||
UpdateStep = UpdateStep + 1
|
UpdateStep = UpdateStep + 1
|
||||||
CASE 5
|
CASE 5
|
||||||
|
'Redownload all listed files
|
||||||
IF LEN(f$) > 0 THEN
|
IF LEN(f$) > 0 THEN
|
||||||
x2 = INSTR(f$, z$)
|
x2 = INSTR(f$, CHR$(0))
|
||||||
f2$ = LEFT$(f$, x2 - 1): f$ = RIGHT$(f$, LEN(f$) - x2)
|
f2$ = LEFT$(f$, x2 - 1): f$ = MID$(f$, x2 + 1)
|
||||||
|
|
||||||
IF RIGHT$(f2$, 4) = ".txt" THEN
|
IF RIGHT$(f2$, 4) = ".txt" THEN
|
||||||
f2$ = LEFT$(f2$, LEN(f2$) - 4)
|
f2$ = LEFT$(f2$, LEN(f2$) - 4)
|
||||||
n = n + 1
|
n = n + 1
|
||||||
FullMessage$(2) = "Page title: " + f2$
|
FullMessage$(2) = "Page: " + f2$
|
||||||
ignore$ = Wiki$(f2$)
|
ignore$ = Wiki$(f2$)
|
||||||
WikiParse ignore$ 'just check for plugin templates
|
WikiParse ignore$ 'just check for plugin templates
|
||||||
END IF
|
END IF
|
||||||
|
@ -18992,7 +19000,6 @@ FUNCTION ideupdatehelpbox
|
||||||
UpdateStep = UpdateStep + 1
|
UpdateStep = UpdateStep + 1
|
||||||
END IF
|
END IF
|
||||||
CASE 6
|
CASE 6
|
||||||
stoprecache:
|
|
||||||
IF Help_Recaching = 2 THEN EXIT DO
|
IF Help_Recaching = 2 THEN EXIT DO
|
||||||
FullMessage$(1) = "All pages updated."
|
FullMessage$(1) = "All pages updated."
|
||||||
FullMessage$(2) = ""
|
FullMessage$(2) = ""
|
||||||
|
|
Loading…
Reference in a new issue