Skip to main content
Inspiring
April 4, 2007
Question

CF5 File Purging

  • April 4, 2007
  • 1 reply
  • 505 views
I have a client's siet with 4200 .cfm files. There are multitudes of includes and custom tags called from every page.

I created a table in the database with a recursive listing of every template in the site and wanted to be able to update the table when a page got called. This way, within a month or so I would now which pages are never getting called anymore. After setting this up I realized that it was not going to log includes or custom tags.

Is there a way to query the stack of pages loaded during processing? I would imagine there would be a way to do it in MX7, but I need a solution for CF5...
    This topic has been closed for replies.

    1 reply

    April 5, 2007
    There's a handy little tool called SR32, available at www.funduc.com. It can do a search of file content and give you the names of files that have that content.

    So you could do a search for <CFINCLUDE and see if any of the files in your database that are marked as used show in the SR32 list. For each such file, SR32 will display the results like this:

    4/5/2007 7:35:30 AM
    Search String: <CFINCLUDE
    Path: C:\Inetpub\wwwroot\CFDOCS\Sample
    File Mask: *.cfm
    Search Subdirectories
    Processing file : C:\Inetpub\wwwroot\CFDOCS\Sample\doHTMLScorecard2.cfm
    Line 278 - <<CFINCLUDE> TEMPLATE="checkLimits.cfm">
    Line 284 - <<CFINCLUDE> TEMPLATE="checkLimits.cfm">

    So you can run this search and find the names of all the files that have a CFINCLUDE in them. If those files are activly used, keep them. If not, change their file extension to .bak.
    Inspiring
    April 5, 2007
    I tried that route somewhat by using dreamweaver to search on <cfinclude (found 2000 instances) and on <cfmodule (found 400)...

    Ideally I would like to capture all includes OnRequestEnd and then run a query to look them up in the database and marked them as active. It seems like a simpe solution in MX7 because I could call the ServiceFactory at the end of the page render and pull out a list of executed pages.

    Is there a way in CF5 to do something similar? To see the debug query? View executed file?
    April 6, 2007
    The page below, cfinclude.cfm, does a CFINCLUDE of the second page, testCFINCLUDE.cfm. Note the stack trace shows this results. I'm not sure how I'd capture this information programatically, but since they refer to two different pages, I can conclude the second page was CFINCLUDEed. Placing such code at the beginning of every page (temporarily) could give you sufficient information to know whether or not you are dealing with a CFINCLUDEed page. If so, you can update a database or whatever.