Description
Logically marks one or more objects for deletion from the database. Note that objects remain in the database with the spike status until purged.
Parameters (* denotes an optional parameter)
Ids* (Mandatory if no Conditions specified)
A comma-separated list of database ids of the objects to spike.
Conditions* (Mandatory if no Ids specified)
This optional string parameter contains the name of a search configuration object (loaded in the database) which is used to select the objects to spike. If not specified, the ids of the objects to spike must be specified directly using the Ids parameter.
Pars*
Optional parameters used to replace variable parts in the search conditions and passed to the XSL transformation used to generate the objects XML (if any). Parameters are constructed as a list of name-value pairs in the format 'name1:value1;name2:value2...'; For example, 'folderId:30;author:smith' defines a 'folderId' parameter with value 30 and a 'author' parameter with value 'smith'.
Code
A valid spike code used to specify the type of spike action. Allowed values are: normal, black, auto.
Extend*
This optional parameter defines how to handle objects which reference the objects that are to be spiked. It specifies if the spike should 'extend' to the referencing objects. For example, when spiking a folder, it is necessary to specify whether to spike the objects which reference (are contained in) the folder. The spike operation fails if this parameter is not present, and there are objects with a mandatory attribute which reference the objects to be spiked. When used, it consists of a comma-separated list attributes (using the full attribute name) that are the referencing attributes. See examples below.
Recurse*
This optional parameter specifies how to handle the objects that indirectly reference the objects to be spiked. For example, when spiking a parent folder, how to handle the folders that are children of the child folders, and their contents. The spike operation fails if this parameter is not present, and there are objects with a mandatory attribute which indirectly reference the objects to be spiked.
NOTE: use this parameter carefully! When present, and extend attributes are defined, it can spike a large amount of objects, for example, an entire tree of folders and their contents.
Unref*
This optional parameter is used when the objects to be spiked are referenced by another object, but are not referenced as a mandatory attribute, for example, a story object that references one or more images. When present, this parameter removes the reference before setting the objects to the spiked state. It works with single as well as multiple reference attributes. For example, a story object can reference multiple image objects. It is possible to spike a single image, removing only that reference, while the remaining image references remain in place with the story. This parameter is defined as a comma separated list of referencing attributes, using the full attribute name. See examples below.
NOTE: This parameter can not be used with mandatory attributes.
purge*
This optional parameter is an time-span type (e.g. 4:30 for 4 hours and 30 minutes, 2.06:00 for 2 days and 6 hours). The parameter is used to compute a ‘purge date-time’ for the objects – equal to the spike date- time plus the time-span – that is stored in the database. The purge time-span cannot be negative. The ‘purge date-time’ is saved into DB in gn_PurgeTime, a column of gn_SpikedTable (in DBSchema.xml). This parameter is optional, if not specified in the table the spiked object has a null gn_PurgeTime.
Examples:
cmd4 spike -ids 1814 -purge 25.06:13
if the operation is carried out at “20/04/2009 15.45.44” the gn_PurgeTime is: “15/05/2009 21.57.44”
cmd4 spike -ids 1813 -purge -12
Throw an InvalidOption Exception
cmd4 spike -ids 1812
In the DB the gn_PurgeTime is null.
The other programs that use the "spike" operation into the DB don't set the gn_PurgeTime.
Examples
Example 1: This command spikes the (image) object with id=27958, first removing any references from story objects that reference this image object:
http://demo.teradp.com/Tark4/do.ashx?Cmd=spike&ids=27958&code=normal&unref=story.images
Successfully spiked object(s) 27958 with code 'Normal'. Modified objects(s) 28165
In this example, there was one story object, with id=28165, referencing the spiked image.
Example 2: This command to spike a folder with id=28012 fails because it is referenced by 1 folder object (with a mandatory reference):
http://demo.teradp.com/Tark4/do.ashx?Cmd=spike&ids=28012&code=normal
Server error in '/tark4' Application
It is not possible to delete folder '/system/users/Laura/Ready'
(id: 28012) because it is referenced by 1 folder object (ERR0230)
A possible solution is to extend the spike to the referenced folder objects, however, the command fails again because the object is referenced by a publishing destination:
http://demo.teradp.com/Tark4/do.ashx?Cmd=spike&ids=28012&code=normal&extend=folderObject.folderRef
Server error in '/tark4' Application
It is not possible to delete image 'image_09100223225787'
(id: 45978) because it is referenced by 1 destination (ERR0230)
Now the command to spike a folder with id=28012 is successful because it specifies to extend the spike to the referenced folder objects, and to unreference the (referencing) object from the publishing destination:
http://demo.teradp.com/Tark4/do.ashx?Cmd=spike&ids=28012&code=normal&extend=folderObject.folderRef&Unref=pubDest.objs
Successfully spiked object(s) 28012, 45978 with code 'Normal'.
IMPORTANT:
There are two possible solutions to handle the reference to the publishing destination, 1/ Execute an Unpublish call before the spike, or 2/ Use the Unref option in the Spike call. In the first case, if there is a workflow associated to the Unpublish it will be executed. In the second case, the reference is removed WITHOUT running the associated unpublish workflow.
Remarks
One of the important issues related to spiking is how to handle objects which reference the objects to be spiked. There are two ways to handle referencing objects, 1.) delete the referencing object as well, or 2.) break the reference before spiking the object. Which method to use depends on how the referencing is defined, and the intended result.
When a reference is defined using a mandatory attribute, it is not possible to simply 'break' the reference. This is the case with a folder object and it's folder reference. Every folder object has a mandatory attribute, which is a reference to the folder where the object is stored (folderObject.folderRef). When a folder is marked to be spiked, it is necessary to first decide how to handle the objects in that folder. It is not possible for the folder objects to have an empty reference and the system will not automatically reassign the folder reference in any way. The options in this case are to spike the referencing objects as well, or to have the spiking of the folder fail if it has referencing objects, i.e., it is not empty. The Extend, Recurse and Unref parameters described below are used to control how referencing objects are handled.
See also