This was very much just thrown together, but if any of it is usefull here it is:I have a table like this:
CLIENT C 10
UPDATE_DIR C 60
MAIN_DIR C 60
LACTIVE L
Then in the form.Init
WITH THISFORMSELECT update_ver5COUNTFOR lactive AND NOT DELETED() TO lnRecDIMENSION .aproj[lnRec,3] AS CHARACTERCOPYTOarray thisform.aproj FIELDS client, update_dir, main_dir FOR lactive = .t. FOR j = 1 TOALEN(.aproj, 1)
.aproj[j,1] = ALLTRIM(.aproj[j,1])
.aproj[j,2] = ALLTRIM(.aproj[j,2])
.aproj[j,3] = ALLTRIM(.aproj[j,3])endforENDWITH
=AGETFILEVERSION(aTempFile, "vman5.exe")
thisform.vmctxt6.value = ALLTRIM(aTempFile[11])
Button to distribute updated exe's .Click
LPARAMETERS nButton, nShift, nXcoord, nYcoordFOR j = 1 TOALEN(thisform.aproj,1)CD c:\vman5
z = thisform.aproj[j,1] + ".exe"
q = thisform.aproj[j,2] + zWAITWINDOW'copying ' + z + ' to ' + q nowaitCOPYFILE&z TO&q WAITclearENDFOR
Button to distribute updates .css etc .click
LPARAMETERS nButton, nShift, nXcoord, nYcoordFOR j = 1 TOALEN(thisform.aproj,1)CD c:\vman5
r = STRTRAN(thisform.aproj[j,2], "update\", "site\*.*")WAITWINDOW'copying css files to' + r nowaitCOPYFILE c:\vman5\site\awdefault*.css to&rCOPYFILE c:\vman5\site\vm5*.css to&rCOPYFILE c:\vman5\site\*.inc to&rCOPYFILE c:\vman5\site\men*.css to&rCOPYFILE c:\vman5\site\vm5*.js to&rWAITclearENDFOR
Button to compare copied files and validate:
LPARAMETERS nButton, nShift, nXcoord, nYcoordLOCAL oXML
lOK = ALEN(thisform.aproj,1)FOR j = 1 TOALEN(thisform.aproj,1)CD c:\vman5
=ADIR(aold, "c:\vman5\update_site\*.*")
=ADIR(anew, STRTRAN(thisform.aproj[j,2], "update\", "site\*.*"))
lOK2 = ALEN(aold,1)FOR i = 1 TOALEN(aold,1)
w1 = ASCAN(anew, aold[i,1],-1,-1,1,9) IF w1 > 0
d1 = FILETOSTR("c:\vman5\update_site\" + aold[i,1])
d2 = FILETOSTR(STRTRAN(thisform.aproj[j,2], "update\", "site\" + aold[i,1]))if d1 == d2
lok2= lok2 -1ELSE
=MESSAGEBOX('File mismatch: ' + thisform.aproj[j,1],0)ENDIFRELEASE d1, d2ENDIFENDFORIF lOK2 > 0LOOPENDIF
z = thisform.aproj[j,1] + ".exe"
q = thisform.aproj[j,2] + zWAITWINDOW'checking ' + q nowait
a = FILETOSTR(z)
b = FILETOSTR(q)CD c:\vman5
m1 = STRTRAN(thisform.aproj[j,2], "update\", "vmancloud\data\vman4.dbc")
m2 = STRTRAN(thisform.aproj[j,2], "update\", "vmancloud\data\vman4.dct")
m3 = STRTRAN(thisform.aproj[j,2], "update\", "vmancloud\data\vman4.dcx")IF'vman5' $ LOWER(thisform.aproj[j,1])
m1 = STRTRAN(thisform.aproj[j,2], "update\", "data\vman4.dbc")
m2 = STRTRAN(thisform.aproj[j,2], "update\", "data\vman4.dct")
m3 = STRTRAN(thisform.aproj[j,2], "update\", "data\vman4.dcx")ENDIF
a1 = FILETOSTR("c:\vman5\update_data\vman4.dbc")
a2 = FILETOSTR("c:\vman5\update_data\vman4.dct")
a3 = FILETOSTR("c:\vman5\update_data\vman4.dcx")
b1 = FILETOSTR(m1)
b2 = FILETOSTR(m2)
b3 = FILETOSTR(m3)IF a == b AND a1 == b1 AND a2 == b2 AND a3 == b3
lOK = lOK -1endifRELEASE a1, a2, a3, b1, b2, b3, m1, m2, m3 , a, bWAITclearENDFORWAITclear
=MESSAGEBOX(STR(lOK) + " bad comparisons")
Button to update sites:
LPARAMETERS nButton, nShift, nXcoord, nYcoordLOCAL oXMLFOR j = 1 TOALEN(thisform.aproj,1)
lcURL = tcURL + '/bin/wc.dll?_maintain~UpdateExe'
oXml = CreateObject("Microsoft.XMLHTTP")
oxml.open( "POST", lcURL , .f., "login", "password")
oxml.send()IF oxml.status<> 200 OR oxml.statustext <> "OK" OR NOT ("the exe file has been update" $ LOWER(oxml.responsetext))
=MESSAGEBOX(STR(oXml.Status) + oXML.Statustext + oXml.Responsetext)ENDIFrelease oXMLENDFORWAITclear
Button to validate that site exe's were really updated:
LPARAMETERS nButton, nShift, nXcoord, nYcoordLOCAL oXML
lOK = ALEN(thisform.aproj,1)FOR j = 1 TOALEN(thisform.aproj,1)CD c:\vman5
z = thisform.aproj[j,1] + ".exe"
q = thisform.aproj[j,2] + z
x = "c:\vman5\" + z
p = STRTRAN(q, "\update\", "\vmancloud\")WAITWINDOW'checking ' + q nowait
a = FILETOSTR(x)
b = FILETOSTR(q)
c = FILETOSTR(p)IF a == b AND b == c
lOK = lOK -1ELSE
=MESSAGEBOX(thisform.aproj[j,1] + "mismatch")endifRELEASE A RELEASE BRELEASE C WAITclearENDFORWAITclear
=MESSAGEBOX(STR(lOK) + " bad comparisons")
Hi Tuvia
Can you, please, provide us with a copy of the source code?
I can adapt, with your agreement and that of Thierry, the general needs of users FoxInCloud.
best regard
Gilles
We actually created a form that does all this with various options. It is set to our specific needs but probably could be more generalized.
![]()
In this way i update the exe file, but how can i update the wwwroot folder where i have all js and html files ?
Ciao Michele,
This is documented in <VFP9>\tools\ab\aw\app\site\bin\wc.ini:
ExeFile=
; {en} Full path to your xxx[Test|Prod].exe
; {en} wc.dll uses this key to:
; {en} - DEVELOPMENT: launch your xxx[Test|Prod].exe in file mode
; {en} (not really useful in development as you can simply double click your .exe in Windows Explorer)
; {en} - PRODUCTION: update your xxx[Test|Prod].exe with a new version specified in the 'UpdateFile' key below.
; {en} Crucial when using awStart.prg!awServerUpload() to upload a your FoxInCloud server to a production server.
UpdateFile=
; {en} Full path to the new version of your xxx[Test|Prod].exe
; {en} This path usually points to a secured directory shared on FTP where you upload
; {en} new versions after full testing in your development environment.
; {en} We encourage developers to use awStart.prg!awServerUpload which fully
; {en} automates this update process.
so, in short, you need to:
- create a secured FTP directory on your production server
- fill UpdateFile= with the physical address of your update exe in this folder
- fill ExeFile= with the physical address of your live exe
- complete the settings in xxx[Test|Prod]ServerUpdate.prg (derived from awStart.prg!awServerUpload())
- run xxx[Test|Prod]ServerUpdate.prg from your development machine
Sorry, but i don't understand the correct procedure.
In the Ini file whic data i have to insert into these parameters ?
ExeFile=c:\program files (x86)\Abaque\ttWeb\TTWeb.exe
UpdateFile=C:\temp\Upload\TTWeb.exe
Make an example if, like in my case, i have these params:
AppName = MobTest.Exe
App Folder Name = c:\program files (x86)\AcutMobile\Mobtest.Exe
Web Folder Name = C:\inetpub\wwwroot\Acutmobile
AdminAccount = Fic
Password = 1234
The app that makes the update is called "WebUpdate.Exe" and it is positioned in c:\temp\upload\
Ciao Michele,
in VFP9/Tools/AB/AW/App/ you'll will find a program named xxxTestUpdate.prg:
LPARAMETERS tlBuildExe IFPCOUNT() = 0CLEAR ALLLOCAL tlBuildExe
tlBuildExe = .T.ELSE
tlBuildExe = VARTYPE(m.tlBuildExe) == 'L' AND m.tlBuildExeENDIF
AW()
LOCAL loDefault
loDefault = CreateObject('abSet', 'DEFAULT', ADDBS(JustPath(Sys(16))))RETURN awServerUpload(;[xxxTest.exe];
, [http://(xxxTest.)<IP or domain of your production server>/(xxxTest/)];
, m.tlBuildExe;
, [yourAdminAccountInWC.ini];
, [yourAdminAccountPassWord];
, [/Upload/];
)
you need to adapt this program to you server(s)
You can either have one program per server, or have a loop inside your program to address all servers, and maybe have an additional parameter to update only one server.
on your server's wc.ini, you need to set these 2 parameters (eg on our server):
ExeFile=c:\program files (x86)\Abaque\ttWeb\TTWeb.exe
UpdateFile=C:\temp\Upload\TTWeb.exe
C:\temp\Upload\ is the physical directory on the server where the /Upload/ ftp virtual directory is mapped to.
Hi. Now that i begin to have a good number of foxincloud app installed i have a new problem.
How to update my app. Or better how to automatically update my app.
Normally i have a zip that contains my .Exe some other files to install in my program files folder and the i have the web files, those files that i have to copy in wwwroot folder. Finally sometimes i have even the awscripts folder to update and so i have also these folder..All these things in one zip file....
Normally i manually stop the server and then always manually i copy new files in all requested folders and then i restart the server.
Is it possible to automate this operation ? In the Ini file of my app i have sseen a key for update, but i don't understand how it works and if it can solve my problem.
Some suggests
Thanks