Yes. But to do so, you need to invoke a feature that I am willing to bet only 1% of the 1% knows about.
For a dataProvider
, you can disable groups of functionality. In your case you want to disable publishing
.
For completeness, I'm showing a few examples. All in your <dataProvider>
element:
<dataProvider ...>
<disable>*</disable>
<enable>GetItem</enable>
<enable>GetChildren</enable>
</dataProvider>
Disable everything on your dataProvider except methods GetItem
and GetChildren
.
But to make things easier, there are "method groups" you can disable. To disable publishing entirely for your dataProvider, do this:
<dataProvider ...>
<disableGroup>publishing</disableGroup>
</dataProvider>
For more information of this forgotten feature from the past, see: The dataProvider Element
If I recall correctly (it's been a very long while since I used this), Sitecore will not throw exceptions or anything when these disabled calls are invoked; rather just silently ignore them and move on.
Edited to add
So I did a bit of investigation. Sitecore has updated the flexibility around this a bit more, so it is possible that this method will be easier for you.
If you look in App_Config/Sitecore.config
for how the <database id="web">
is wired up, you will see an example of this. It states:
<dataProviders hint="list:AddDataProvider">
<dataProvider ref="dataProviders/main" param1="$(id)">
<disableGroup>publishing</disableGroup>
<prefetch hint="raw:AddPrefetch">
<sc.include file="/App_Config/Prefetch/Common.config" />
<sc.include file="/App_Config/Prefetch/Webdb.config" />
</prefetch>
</dataProvider>
</dataProviders>
Notice how it maps in the "main" data provider, and then tells it to <disableGroup>
publishing
. This is why the system doesn't break when you do a publish via the UI when you've switched to the "web" database - it simply gets ignored.
So you can either disable this group for your dataProvider entirely, or you can optionally disable it per-database for your provider.
If I recall correctly (as can be seen in a modern day Sitecore.config
) you can also just remove sections from this part of the configuration.
<methodGroups>
<copyMove>
<CopyItem />
<MoveItem />
</copyMove>
<create>
<AddVersion />
<CreateItem />
</create>
<delete>
<DeleteItem />
<RemoveVersion />
<RemoveVersions />
</delete>
<properties>
<GetProperty />
<RemoveProperty />
<SetProperty />
</properties>
<publishing>
<AddToPublishQueue />
<CleanupPublishQueue />
<GetPublishQueue />
</publishing>
<query>
<SelectIDs />
<SelectSingleID />
</query>
<read>
<BlobStreamExists />
<GetItemDefinition />
<GetItemFields />
<GetItemVersions />
</read>
<relations>
<GetChildIDs />
<GetParentID />
<GetRootID />
<HasChildren />
</relations>
<resolve>
<ResolvePath />
</resolve>
<templates>
<ChangeTemplate />
<GetTemplateItemIds />
<GetTemplates />
</templates>
<update>
<SaveItem />
</update>
<workflow>
<GetItemsInWorkflowState />
<GetWorkflowInfo />
<SetWorkflowInfo />
</workflow>
</methodGroups>
Removing the <publishing>
element should have the same effect as the above, which removes group publishing
.