How to find references to a javascript file in Kentico objects

Matt Newby asked on July 6, 2015 16:03

Looking at a Kentico site we had built for us a couple years ago, and recently had some more work contracted out, and I'm finding that there are now no less than three JavaScript files in various directories with the same name -- one in /scripts/, one in /CMSScripts/ and one in /CMSScripts/Custom/. The code is somewhat divergent, so it's probably something where the file started in one place, then the dev thought better of it and instead of moving it, copied it to the new location, and kept modifying it there. At this point, I'm not sure which is the "right" place, nor whether all references to the old location have been changed. For code files sitting in the directories, it's pretty easy to grep for where the references to a file are found, but I'm not sure how to do that in the Kentico UI. I know there's a reference on the Master Page template, but without manually searching through each page template and any other place that HTML might appear in a widget, I don't know how to find all the other places where there might be a SCRIPT tag pointing at an obsolete file. Any tools available in Kentico or third-party to find stuff like this? This is on an old version of Kentico as well - v7.0.39.

Thanks!

Recent Answers


Virgil Carroll answered on July 6, 2015 22:48

Matt,

Easiest would be to do a string search via the SQL database. you could do a wildcard search or whatever variation you needed. I would look into the View_CMS_Tree_Joined which is a pretty good cross section of content, and the CMS_PageTemplate table which should store all the templates including the master page. This each has either a content field or layout field where you could look for the right string in it.

You could also write something programmatically against the TreeProvider or DocumentEngine to grab this information and search, but if you are comfortable with SQL it would be the easiest way.

Tx, Virgil

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on July 7, 2015 05:37

On top of what Virgil mentioned, the first two references are incorrect from a best practice standpoint. If the newer contractor knew what they were doing and knew Kentico best practices, then my guess is they created the /CMSScripts/Custom/

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.