Login

Recycle bin issues

Versions: n/a, FAQ number: 42, Old FAQ number: 1018

Q: Recycle bin issues

A: Below we have collected solutions to some common issues that has to do with the Recycle bin .

What ways are there to empty the Recycle bin ?

There are two ways to emtpy the Recycle bin :

  1. Choose Empty recycle bin in edit mode.
  2. Execute the following SQL statement in the database to delete pages that are older than a given number of days, in this example 30 days:

                   exec sp_DeleteOldPages @MaxDays=30

    Note: Pages deleted with sp_DeleteOldPages do not end up in the Recycle bin - they are removed entirely from the database.
  3. Or, execute the following SQL statement to delete a specific page, in this case pageID 42:

                   editDeletePage 42

    Note: Pages deleted with editDeletePage do not end up in the Recycle bin - they are removed entirely from the database.

    If editDeletePage should fail for some reason, you can provide a second argument called the ForceDelete parameter and set it to true. This will delete the page including all its children and all pagereferences to the page will be cleared.
    For example:

                   editDeletePage 42, true

    If you need to delete several pages at once, based on some criteria, you can base your query on the following SQL code:

    declare @DeletePageID int

    while(1=1)
    begin
      select top 1 @DeletePageID=pkID
      from tblPage
      where (fkparentID = 4711)   -- modify this where-statement...
      and   StartPublish is null
      and   Created< dateadd(day,-60,getdate())

      if (@@ROWCOUNT = 0)
        break

      exec editDeletePage @DeletePageID, 1 
      print 'Page ' + convert(char,@DeletePageID) + ' deleted'
    end

 


When I try to empty the Recycle bin I get a time out error, what should I do?

First an explanation why this error occurs: if not specified otherwise, when EPiServer runs database queries it uses the default query timeout value in ADO.NET which is 30 seconds. If a query takes longer than 30 seconds to execute the query will halt in a timeout error. This error can occur if, for example, the Recycle bin contains a large number of deleted pages.

The solution: increase the query timeout value. Add the following line to web.config, under the appSettings key (if it does not already exist):

<add key="EPnQueryTimeout" value="60"/>

The value parameter is the number of seconds the query is allowed to run before it timeouts. In the example above the value is set to 60 seconds, which is twice as long as the ADO.NET default value.

Note: the EPnQueryTimeout key only works with version 4.10 and later.

 

EPiTrace logger