MCPcopy Index your code
hub / github.com/writefreely/writefreely / handleViewAdminUpdates

Function handleViewAdminUpdates

admin.go:659–693  ·  view source on GitHub ↗
(app *App, u *User, w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

657}
658
659func handleViewAdminUpdates(app *App, u *User, w http.ResponseWriter, r *http.Request) error {
660 check := r.URL.Query().Get("check")
661
662 if check == "now" && app.cfg.App.UpdateChecks {
663 app.updates.CheckNow()
664 }
665
666 p := struct {
667 *UserPage
668 *AdminPage
669 CurReleaseNotesURL string
670 LastChecked string
671 LastChecked8601 string
672 LatestVersion string
673 LatestReleaseURL string
674 LatestReleaseNotesURL string
675 CheckFailed bool
676 }{
677 UserPage: NewUserPage(app, r, u, "Updates", nil),
678 AdminPage: NewAdminPage(app),
679 }
680 p.CurReleaseNotesURL = wfReleaseNotesURL(p.Version)
681 if app.cfg.App.UpdateChecks {
682 p.LastChecked = app.updates.lastCheck.Format("January 2, 2006, 3:04 PM")
683 p.LastChecked8601 = app.updates.lastCheck.Format("2006-01-02T15:04:05Z")
684 p.LatestVersion = app.updates.LatestVersion()
685 p.LatestReleaseURL = app.updates.ReleaseURL()
686 p.LatestReleaseNotesURL = app.updates.ReleaseNotesURL()
687 p.UpdateAvailable = app.updates.AreAvailable()
688 p.CheckFailed = app.updates.checkError != nil
689 }
690
691 showUserPage(w, "app-updates", p)
692 return nil
693}

Callers

nothing calls this directly

Calls 10

NewUserPageFunction · 0.85
NewAdminPageFunction · 0.85
wfReleaseNotesURLFunction · 0.85
showUserPageFunction · 0.85
CheckNowMethod · 0.80
FormatMethod · 0.80
LatestVersionMethod · 0.80
ReleaseURLMethod · 0.80
ReleaseNotesURLMethod · 0.80
AreAvailableMethod · 0.80

Tested by

no test coverage detected