oh boy. container table clean up help?

View: New views
4 Messages — Rating Filter:   Alert me  

oh boy. container table clean up help?

by Chris Roth-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Okay well boy did I do it. In an attempt to automagically output some
container content, I put the code below in a primary DHTML webskin...
The request.cscd.home check in the code below  is new to "prevent" the
issue I describe below...

        <!--- Dynamically Generate Containers --->
            <!--- get the ancestors of the current node from the tree
--->
            <cfset qNodeAncestors  =
application.factory.oTree.getAncestors(objectid=request.navid,
bIncludeSelf="true") />
            <!--- filter query to nodes under the home node, 2 levels
deep --->
            <cfquery dbtype="query" name="qNodeList" maxrows="2">
            SELECT * FROM qNodeAncestors
            WHERE nLevel > 1
            ORDER BY nLevel
            </cfquery>

            <!--- This display method is Not used on home so we should
have atleast 1 record --->
            <cfif qNodeList.recordcount GT 0>

               <!--- create a sidebar container dynamically based on
the second level node name --->
               <cfif len(qNodeList.ObjectName[1]) AND
request.cscd.home EQ "home">
               <cfset request.dynCon1Name = ReplaceNoCase
(qNodeList.ObjectName[1], " ","-","ALL")>
               <con:container
label="#stobj.objectID#_#request.dynCon1Name#-sidebar"
defaultMirrorLabel="#request.dynCon1Name#-sidebar">

                   <cfif len(qNodeList.ObjectName[2]) AND
request.cscd.home EQ "home">
                   <cfset request.dynCon2Name = request.dynCon1Name &
"-" & ReplaceNoCase(qNodeList.ObjectName[2], " ","-","ALL")>
                   <con:container
label="#stobj.objectID#_#request.dynCon2Name#-sidebar"
defaultMirrorLabel="#request.dynCon2Name#-sidebar">
                  </cfif>
               </cfif>

            </cfif>

This has been working beautifully... but then.... we decided to have
multiple versions of our site... Japanse / Chinese..

I opted for home nodes at the root level and control what site gets
loaded with a request var..

that was working beautifully... but then...


I was looking to update an old container that our DMNews types use for
the boilerplate message and..

OMG..

I have exploed my container tables...

dbo.container: 142008 records
dbo.refContainers: 72939

It appears that the japanese characters used in the nodes for:

<cfset request.dynCon1Name = ReplaceNoCase(qNodeList.ObjectName[1], "
","-","ALL")>
<con:container label="#stobj.objectID#_#request.dynCon1Name#-sidebar"
defaultMirrorLabel="#request.dynCon1Name#-sidebar">

are created multiple times.. as in every time...

I have since put the home node check above and do dynamic containers
only on the English site, but container management is now impossible
from the webtop due to the number of records.

any idea how I can clean up these tables programatically? 142008
records is not something I want to clean up by hand.

Help me.

Chris


--~--~---------~--~----~------------~-------~--~----~
You received this message cos you are subscribed to "farcry-dev" Google group.
To post, email: farcry-dev@...
To unsubscribe, email: farcry-dev+unsubscribe@...
For more options: http://groups.google.com/group/farcry-dev
--------------------------------
Follow us on Twitter: http://twitter.com/farcry
-~----------~----~----~----~------~----~------~--~---


Re: oh boy. container table clean up help?

by Chris Kent-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


You probably have the vast majority of records in table container that
do not have any publishing rules.

What you might want to try doing is to delete all records from table
container that do not have related records in  container_arules

DELETE
FROM container
WHERE container.objectID  not in
(SELECT DISTINCT parentid FROM container_arules)

Any required containers records with publishing rules will stay.
Any required containers records without publishing rules will be re-
created automatically when the pages are next hit.

My last bit of advice, and the most important is to BACKUP the
database before running the delete script above.

Chris.


On Nov 5, 10:46 pm, Chris Roth <chris.r...@...> wrote:

> Okay well boy did I do it. In an attempt to automagically output some
> container content, I put the code below in a primary DHTML webskin...
> The request.cscd.home check in the code below  is new to "prevent" the
> issue I describe below...
>
>         <!--- Dynamically Generate Containers --->
>             <!--- get the ancestors of the current node from the tree
> --->
>             <cfset qNodeAncestors  =
> application.factory.oTree.getAncestors(objectid=request.navid,
> bIncludeSelf="true") />
>             <!--- filter query to nodes under the home node, 2 levels
> deep --->
>             <cfquery dbtype="query" name="qNodeList" maxrows="2">
>             SELECT * FROM qNodeAncestors
>             WHERE nLevel > 1
>             ORDER BY nLevel
>             </cfquery>
>
>             <!--- This display method is Not used on home so we should
> have atleast 1 record --->
>             <cfif qNodeList.recordcount GT 0>
>
>                <!--- create a sidebar container dynamically based on
> the second level node name --->
>                <cfif len(qNodeList.ObjectName[1]) AND
> request.cscd.home EQ "home">
>                <cfset request.dynCon1Name = ReplaceNoCase
> (qNodeList.ObjectName[1], " ","-","ALL")>
>                <con:container
> label="#stobj.objectID#_#request.dynCon1Name#-sidebar"
> defaultMirrorLabel="#request.dynCon1Name#-sidebar">
>
>                    <cfif len(qNodeList.ObjectName[2]) AND
> request.cscd.home EQ "home">
>                    <cfset request.dynCon2Name = request.dynCon1Name &
> "-" & ReplaceNoCase(qNodeList.ObjectName[2], " ","-","ALL")>
>                    <con:container
> label="#stobj.objectID#_#request.dynCon2Name#-sidebar"
> defaultMirrorLabel="#request.dynCon2Name#-sidebar">
>                   </cfif>
>                </cfif>
>
>             </cfif>
>
> This has been working beautifully... but then.... we decided to have
> multiple versions of our site... Japanse / Chinese..
>
> I opted for home nodes at the root level and control what site gets
> loaded with a request var..
>
> that was working beautifully... but then...
>
> I was looking to update an old container that our DMNews types use for
> the boilerplate message and..
>
> OMG..
>
> I have exploed my container tables...
>
> dbo.container: 142008 records
> dbo.refContainers: 72939
>
> It appears that the japanese characters used in the nodes for:
>
> <cfset request.dynCon1Name = ReplaceNoCase(qNodeList.ObjectName[1], "
> ","-","ALL")>
> <con:container label="#stobj.objectID#_#request.dynCon1Name#-sidebar"
> defaultMirrorLabel="#request.dynCon1Name#-sidebar">
>
> are created multiple times.. as in every time...
>
> I have since put the home node check above and do dynamic containers
> only on the English site, but container management is now impossible
> from the webtop due to the number of records.
>
> any idea how I can clean up these tables programatically? 142008
> records is not something I want to clean up by hand.
>
> Help me.
>
> Chris
--~--~---------~--~----~------------~-------~--~----~
You received this message cos you are subscribed to "farcry-dev" Google group.
To post, email: farcry-dev@...
To unsubscribe, email: farcry-dev+unsubscribe@...
For more options: http://groups.google.com/group/farcry-dev
--------------------------------
Follow us on Twitter: http://twitter.com/farcry
-~----------~----~----~----~------~----~------~--~---


Re: oh boy. container table clean up help?

by Chris Kent-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Another suggestion on the dynamic container naming:
You could remove the need for the getAncestors and get the dynCon1Name
and dynCon2Name from the furl for the page.
e.g. your furl is /section1/section2/something-else/the-page get the
first and second list elements from the furl. The first 2 parts of the
furl should equate to the object names that are returned in the
getAncestors and have already been cleaned to remove spaces and other
non-alphanumeric characters as part of the furl generation.

There are some small risks if you have multiple furls and entry points
to any of these pages.

Chris.

On Nov 5, 10:46 pm, Chris Roth <chris.r...@...> wrote:

> Okay well boy did I do it. In an attempt to automagically output some
> container content, I put the code below in a primary DHTML webskin...
> The request.cscd.home check in the code below  is new to "prevent" the
> issue I describe below...
>
>         <!--- Dynamically Generate Containers --->
>             <!--- get the ancestors of the current node from the tree
> --->
>             <cfset qNodeAncestors  =
> application.factory.oTree.getAncestors(objectid=request.navid,
> bIncludeSelf="true") />
>             <!--- filter query to nodes under the home node, 2 levels
> deep --->
>             <cfquery dbtype="query" name="qNodeList" maxrows="2">
>             SELECT * FROM qNodeAncestors
>             WHERE nLevel > 1
>             ORDER BY nLevel
>             </cfquery>
>
>             <!--- This display method is Not used on home so we should
> have atleast 1 record --->
>             <cfif qNodeList.recordcount GT 0>
>
>                <!--- create a sidebar container dynamically based on
> the second level node name --->
>                <cfif len(qNodeList.ObjectName[1]) AND
> request.cscd.home EQ "home">
>                <cfset request.dynCon1Name = ReplaceNoCase
> (qNodeList.ObjectName[1], " ","-","ALL")>
>                <con:container
> label="#stobj.objectID#_#request.dynCon1Name#-sidebar"
> defaultMirrorLabel="#request.dynCon1Name#-sidebar">
>
>                    <cfif len(qNodeList.ObjectName[2]) AND
> request.cscd.home EQ "home">
>                    <cfset request.dynCon2Name = request.dynCon1Name &
> "-" & ReplaceNoCase(qNodeList.ObjectName[2], " ","-","ALL")>
>                    <con:container
> label="#stobj.objectID#_#request.dynCon2Name#-sidebar"
> defaultMirrorLabel="#request.dynCon2Name#-sidebar">
>                   </cfif>
>                </cfif>
>
>             </cfif>
>
> This has been working beautifully... but then.... we decided to have
> multiple versions of our site... Japanse / Chinese..
>
> I opted for home nodes at the root level and control what site gets
> loaded with a request var..
>
> that was working beautifully... but then...
>
> I was looking to update an old container that our DMNews types use for
> the boilerplate message and..
>
> OMG..
>
> I have exploed my container tables...
>
> dbo.container: 142008 records
> dbo.refContainers: 72939
>
> It appears that the japanese characters used in the nodes for:
>
> <cfset request.dynCon1Name = ReplaceNoCase(qNodeList.ObjectName[1], "
> ","-","ALL")>
> <con:container label="#stobj.objectID#_#request.dynCon1Name#-sidebar"
> defaultMirrorLabel="#request.dynCon1Name#-sidebar">
>
> are created multiple times.. as in every time...
>
> I have since put the home node check above and do dynamic containers
> only on the English site, but container management is now impossible
> from the webtop due to the number of records.
>
> any idea how I can clean up these tables programatically? 142008
> records is not something I want to clean up by hand.
>
> Help me.
>
> Chris
--~--~---------~--~----~------------~-------~--~----~
You received this message cos you are subscribed to "farcry-dev" Google group.
To post, email: farcry-dev@...
To unsubscribe, email: farcry-dev+unsubscribe@...
For more options: http://groups.google.com/group/farcry-dev
--------------------------------
Follow us on Twitter: http://twitter.com/farcry
-~----------~----~----~----~------~----~------~--~---


Re: oh boy. container table clean up help?

by Jeff Coughlin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Keep in mind that all the information relating these joined tables (for both content types and rules) is contained in metadata for the objects.  For the past few years I've written my own way to automate the cleanup of these items upon content item deletion, however it's time consuming to write.  I had to do this because I had a data feed updating and deleting hundreds of records per day in a table.  If I didn't delete data from the 15 joining tables, I'd have millions of useless records by now.  So a couple years ago I posted an Enhancement Request to have this feature automated upon record deletion (and Geoff suggested to make it optional upon record deletion which is fine by me).

If you'd like to see this feature added so that you have clean join tables as well, vote for it at http://bugs.farcrycms.org/browse/FC-1063

Regards,

--
Jeff Coughlin


On Fri, Nov 6, 2009 at 6:36 AM, Chris Kent wrote:

Another suggestion on the dynamic container naming:
You could remove the need for the getAncestors and get the dynCon1Name
and dynCon2Name from the furl for the page.
e.g. your furl is /section1/section2/something-else/the-page get the
first and second list elements from the furl. The first 2 parts of the
furl should equate to the object names that are returned in the
getAncestors and have already been cleaned to remove spaces and other
non-alphanumeric characters as part of the furl generation.

There are some small risks if you have multiple furls and entry points
to any of these pages.

Chris.

On Nov 5, 10:46 pm, Chris Roth <chris.r...@...> wrote:
> Okay well boy did I do it. In an attempt to automagically output some
> container content, I put the code below in a primary DHTML webskin...
> The request.cscd.home check in the code below  is new to "prevent" the
> issue I describe below...
>
>         <!--- Dynamically Generate Containers --->
>             <!--- get the ancestors of the current node from the tree
> --->
>             <cfset qNodeAncestors  =
> application.factory.oTree.getAncestors(objectid=request.navid,
> bIncludeSelf="true") />
>             <!--- filter query to nodes under the home node, 2 levels
> deep --->
>             <cfquery dbtype="query" name="qNodeList" maxrows="2">
>             SELECT * FROM qNodeAncestors
>             WHERE nLevel > 1
>             ORDER BY nLevel
>             </cfquery>
>
>             <!--- This display method is Not used on home so we should
> have atleast 1 record --->
>             <cfif qNodeList.recordcount GT 0>
>
>                <!--- create a sidebar container dynamically based on
> the second level node name --->
>                <cfif len(qNodeList.ObjectName[1]) AND
> request.cscd.home EQ "home">
>                <cfset request.dynCon1Name = ReplaceNoCase
> (qNodeList.ObjectName[1], " ","-","ALL")>
>                <con:container
> label="#stobj.objectID#_#request.dynCon1Name#-sidebar"
> defaultMirrorLabel="#request.dynCon1Name#-sidebar">
>
>                    <cfif len(qNodeList.ObjectName[2]) AND
> request.cscd.home EQ "home">
>                    <cfset request.dynCon2Name = request.dynCon1Name &
> "-" & ReplaceNoCase(qNodeList.ObjectName[2], " ","-","ALL")>
>                    <con:container
> label="#stobj.objectID#_#request.dynCon2Name#-sidebar"
> defaultMirrorLabel="#request.dynCon2Name#-sidebar">
>                   </cfif>
>                </cfif>
>
>             </cfif>
>
> This has been working beautifully... but then.... we decided to have
> multiple versions of our site... Japanse / Chinese..
>
> I opted for home nodes at the root level and control what site gets
> loaded with a request var..
>
> that was working beautifully... but then...
>
> I was looking to update an old container that our DMNews types use for
> the boilerplate message and..
>
> OMG..
>
> I have exploed my container tables...
>
> dbo.container: 142008 records
> dbo.refContainers: 72939
>
> It appears that the japanese characters used in the nodes for:
>
> <cfset request.dynCon1Name = ReplaceNoCase(qNodeList.ObjectName[1], "
> ","-","ALL")>
> <con:container label="#stobj.objectID#_#request.dynCon1Name#-sidebar"
> defaultMirrorLabel="#request.dynCon1Name#-sidebar">
>
> are created multiple times.. as in every time...
>
> I have since put the home node check above and do dynamic containers
> only on the English site, but container management is now impossible
> from the webtop due to the number of records.
>
> any idea how I can clean up these tables programatically? 142008
> records is not something I want to clean up by hand.
>
> Help me.
>
> Chris



--~--~---------~--~----~------------~-------~--~----~
You received this message cos you are subscribed to "farcry-dev" Google group.
To post, email: farcry-dev@...
To unsubscribe, email: farcry-dev+unsubscribe@...
For more options: http://groups.google.com/group/farcry-dev
--------------------------------
Follow us on Twitter: http://twitter.com/farcry
-~----------~----~----~----~------~----~------~--~---