ASP online Upgrade class files

Source: Internet
Author: User
Tags exit empty trim
Online <%
Rem #####################################################################################
Rem # Online Upgrade class declaration
Class cls_oupdate
Rem #################################################################
Rem # Description: ASP Online Upgrade class
Rem # Version: 1.0.0
Rem # # Author: Xiao Moon scar
Rem # Msn:xiaoyuehen (at) msn.com
Rem # Please replace (at) with @
Rem # Copyright: Since sharing, it does not matter copyright. But must be limited to the network dissemination, cannot use in the traditional media!
Rem # If you can keep these explanatory information, I am more grateful!
Rem # If you have better code optimization, related improvements, please remember to tell me, thank you very much!
Rem #################################################################
Public Localversion, Lastversion, FileType
Public Urlversion, Urlupdate, Updatelocalpath, Info
Public urlhistory
Private sstrversionlist, Sarrversionlist, Sintlocalversion, sstrlocalversion
Private sstrlogcontent, Sstrhistorycontent, Sstrurlupdate, sstrurllocal
Rem #################################################################
Private Sub Class_Initialize ()
Rem # version information full URL to http://head
Rem # # Example: http://localhost/software/Version.htm
Urlversion = ""

Rem # Upgrade URL to http://head,/end
Rem # # Example: http://localhost/software/
Urlupdate = ""

Rem # Local Update directory, to/start,/end. The/Start is updated for the current site. Prevents writing to other directories.
REM # Program detects whether a directory exists, does not exist automatically creates
Updatelocalpath = "/"

Rem # generated software history files
Urlhistory = "History.htm"

Rem # The last hint message
Info = ""

Rem # Current Version
Localversion = "1.0.0"

Rem # Latest Version
Lastversion = "1.0.0"

REM # All versions information file suffix name
FileType = ". asp"
End Sub
Rem #################################################################

Rem #################################################################
Private Sub Class_Terminate ()

End Sub
Rem #################################################################
Rem # performs an upgrade action
Rem #################################################################
Public Function DoUpdate ()
DoUpdate = False

Urlversion = Trim (urlversion)
Urlupdate = Trim (urlupdate)

Rem # Upgrade URL detection
If (Left (urlversion, 7) <> "http://") Or (left (urlupdate, 7) <> "http://") Then
Info = "version detect URL is empty, upgrade URL is empty or malformed (#1)"
Exit function
End If

If Right (urlupdate, 1) <> "/" Then
Sstrurlupdate = urlupdate & "/"
Else
Sstrurlupdate = Urlupdate
End If

If Right (Updatelocalpath, 1) <> "/" Then
sstrurllocal = Updatelocalpath & "/"
Else
Sstrurllocal = Updatelocalpath
End If

REM # Current version information (number)
Sstrlocalversion = Localversion
Sintlocalversion = Replace (Sstrlocalversion, ".", "")
Sintlocalversion = Tonum (sintlocalversion, 0)

Rem # Version Detection (initialize version information and compare)
If islastversion Then Exit function

Rem # Starts the upgrade
DoUpdate = Nowupdate ()
Lastversion = Sstrlocalversion
End Function
Rem #################################################################

Rem # Detects whether it is the latest version
Rem #################################################################
Private function Islastversion ()
Rem # Initialize version information (initialize sarrversionlist array)
If iniversionlist Then
Rem # If successful, compare version
Dim I
Islastversion = True
For i = 0 to UBound (sarrversionlist)
If sarrversionlist (i) > Sintlocalversion Then
Rem # If the latest version, then exit the loop
Islastversion = False
Info = "Already the latest version!"
Exit for
End If
Next
Else
Rem # otherwise return error message
Islastversion = True
info = "Error getting version information!" (#2) "
End If
End Function
Rem #################################################################
Rem # Detects whether it is the latest version
Rem #################################################################
Private function Iniversionlist ()
Iniversionlist = False

Dim strversion
Strversion = Getversionlist ()

Rem # If the return value is NULL, initialization fails
If strversion = "" Then
Info = "Error ..."
Exit function
End If

Sstrversionl



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.