plainblack.com
Username Password
search
Bookmark and Share

    

Purging invalid asset

User knowmad
Date 8/4/2010 7:01 pm
Views 358
Rating 0    Rate [
|
]
Previous · Next
User Message
knowmad

I have an error in my asset table due to an invalid asset class (WebGUI::Asset::Ticket). No idea where it came from but I'd like to eliminate it.

I've found the offending record in the 'asset' table. However, I'm concerned about only deleting that row and leaving other collateral lying around in my database. Is there a programmatic way to eliminate this invalid asset? Perhaps via the wgd?

 

Thanks,
William

----
Knowmad Technologies
http://www.knowmad.com



Back to Top
Rate [
|
]
 
 
perlDreamer
On 08/04/2010 05:01 PM, dev@webgui.org wrote:
> knowmad wrote:
>
> I have an error in my asset table due to an invalid asset class
> (WebGUI::Asset::Ticket). No idea where it came from but I'd like to
> eliminate it.
>
> I've found the offending record in the 'asset' table. However, I'm
> concerned about only deleting that row and leaving other collateral
> lying around in my database. Is there a programmatic way to eliminate
> this invalid asset? Perhaps via the wgd?

Assets have entries in at least 3 tables.

asset, for invariant information (state, lineage, creationDate, etc)
assetData, for per-version asset information
Asset specific tables like wobject, Artice, MapPoint, etc.

Recent versions of WebGUI have a script called findBrokenAssets, which will:

1) Tell you about broken assets
2) Offer to fix them (if it can)
3) Offer to delete them

Since the specific asset class isn't available (WebGUI::Asset::Ticket),
I don't know think that findBrokenAssets will work, but you can try.

Here's how I would do it:

MAKE BACKUPS, VERY GOOD BACKUPS FIRST!

See if the Ticket table exists.  If it does, then do this:

delete from assetData where assetId in (select distinct(assetId) from
Ticket);
delete from asset where assetId in (select distinct(assetId) from Ticket);
drop table ticket.

If it doesn't exist, then:

delete from assetData where assetId in (select assetId from asset where
className='WebGUI::Asset::Ticket');
delete from asset where className='WebGUI::Asset::Ticket';



Back to Top
Rate [
|
]
 
 
martink
Hi William,

On 08/05/2010 02:01 AM, dev@webgui.org wrote:
knowmad wrote:

I have an error in my asset table due to an invalid asset class (WebGUI::Asset::Ticket). No idea where it came from but I'd like to eliminate it.

I've found the offending record in the 'asset' table. However, I'm concerned about only deleting that row and leaving other collateral lying around in my database. Is there a programmatic way to eliminate this invalid asset? Perhaps via the wgd?


I'd guess that that asset belongs to the Helpdesk system. See http://github.com/plainblack/helpdesk/blob/master/lib/WebGUI/Asset/Ticket.pm

To safely remove the asset, you could try the following:

 + Clone the repo.
 + Add the lib dir of the repo to preload.custom
 + You might need to run the install script. Maybe not (since you apparently already installed the Helpdesk)
 + I don't think you need the WG::A::Ticket asset to be added to you config file though.
 + Restart mod_perl

Now you should be able to find all WG::A::Ticket assets through the asset manager's search option. Purging should also be possible.

Note that the Ticket assets need to instanciate correctly, so do a 'tail -f /data/wre/var/logs/*' while trying to edit/delete the assets.

If this doesn't work, you can probably find out which tables you need to clean from the code. That would be at the very least asset and assetData, but there might be more. Best place to look for those is in the purge method of the Ticket asset (if it has one at all).

Martin



Back to Top
Rate [
|
]
 
 
knowmad

Excellent! Thanks for the advice guys. Martin, I think you hit on exactly how that asset got into the system. I found another invalid asset in my logs last night for the HelpSystem so I've a couple of these to clean out.

I'll test your ideas on a dev server and write-up a wiki entry for future reference.

 

William

----
Knowmad Technologies
http://www.knowmad.com



Back to Top
Rate [
|
]
 
 
    



© 2012 Plain Black Corporation | All Rights Reserved