You must be logged in.
// --- Static Config Options ---//
staticExt = 'html';
// Registered Dynamic Pages to Convert
pageUrls = [
'/error.cfm'
];
// --- End: Static Config Options ---//
// Url Param Defaults
enableStaticFileCreation = false;
enableStaticFileBackup = true;
cleanStaticFileBackups = true;
if ( StructKeyExists(request.params,"make") and IsBoolean(request.params.make) )
enableStaticFileCreation = request.params.make;
if ( StructKeyExists(request.params,"backup") and IsBoolean(request.params.backup) )
enableStaticFileBackup = request.params.backup;
if ( StructKeyExists(request.params,"clean") and IsBoolean(request.params.clean) )
cleanStaticFileBackups = request.params.clean;
createStaticFile = '';
if ( StructKeyExists(request.params,"file") )
createStaticFile = TRIM(request.params.file);
//WriteDump(var=pageUrls,label="pageUrls");writeOutput("
");
prtcl = 'http';
if ( cgi.HTTPS EQ 'on' AND TRIM(cgi.HTTPS_SERVER_ISSUER) NEQ '' )
prtcl = 'https';
//WriteDump(cgi);
Make Static Pages
Convert Dynamic (CFM) Pages to Static HTML Pages
processFile = false;
pg = Replace(pg,'\','/','ALL');
if ( createStaticFile EQ '' OR pg EQ createStaticFile )
processFile = true;
name = ListLast(pg,"/");
nameNoExt = ListFirst(name,'.');
path = ReplaceNoCase(pg,name,'','one');
dir = ExpandPath(path);
dir = Replace(dir,'\','/','ALL');
filePath = dir & nameNoExt & ".#staticExt#";
- Dynamic Page: #pg# [ View Source ]
if ( cleanStaticFileBackups )
{
dirArr = directoryList(dir, false, "path", "#nameNoExt#-*.#staticExt#", "Name", "file" );
//WriteDump(var=dirArr);
if ( ArrayLen(dirArr) )
{
WriteOutput("
- Previous Backup Found!");
for ( i=1; i <= ArrayLen(dirArr); i++ )
{
delPath = dirArr[i];
FileDelete(delPath);
WriteOutput("
>> Previous Backup cleaned! (#delPath#)");
}
}
}
// Create Backup file, if file exists
if ( FileExists(filePath) )
{
WriteOutput("
- Static File Exists...");
copyPath = dir & nameNoExt & "-" & DateTimeFormat(Now(),"yyyymmddHHnnss") & ".#staticExt#";
FileCopy(filePath, copyPath);
WriteOutput("
>> Backup created! (#copyPath#)");
}
- Processing #pg#...
>> getting page from: #prtcl#://#cgi.http_host##path##name#
>> writing to #filePath#
- Status: #cfhttp.statuscode#
[ View Static ]
Processing DISABLED!