Giter Site home page Giter Site logo

sensenet-preview-cleaner's Introduction

SenseNet-Preview-Cleaner

How it works

Preview cleaner tool for Sense/Net ECM. It is used to remove generated previews from the Content Repository (e.g. previews take up too much space or want to regenerate neccessary previews only). As preview images don't use lucene index, the tool can be used on running site and because of it connects to the database directly it's neither bothered if the site is stopped. As long as Sense/Net has the below specified stored procedure the tool will work quite safely.

Execution workflow

This is what the tool does, when you execute it:

  1. loads the top 100 contents with 'PreviewImage' type from the database
  2. iterate the contents and remove them from the db one by one using the product's own stored procedure: proc_Node_DeletePhysical
  3. sleep a certain time before continue
  4. starts from the beginning

As a result, the tool will delete all the preview images from db and generate some log files about the process.

Prerequisites

Connection string to the database have to be properly set in CleanSnPreviews.exe.config. You can use the setting just like in your site's web.config, for example:

 <add name="SnCrMsSql" connectionString="Persist Security Info=False;Initial Catalog=SenseNetContentRepository;Data Source=MySenseNetContentRepositoryDatasource;Integrated Security=true" providerName="System.Data.SqlClient" />

Usage

There are a couple of optional parameters by which you can define the behavior of the tool.

CleanSnPreviews.exe -MODE Delete -TOP 1000
Help

You can call the tool with a question mark for get some usage information.

CleanSnPreviews.exe -? 
Show Only

Gets first 100 preview content without removing them(a.k.a. run tool at Show Only mode):

CleanSnPreviews -MODE ShowOnly
Delete

In delete mode the tool will iterate through all the previews by 100 items and delete it. You can change the value of the number by iteration with the parameter below (e.g. delete all preview by 1000):

CleanSnPreviews -MODE Delete -TOP 1000
Config parameters

You can tweak some parameters in CleanSnPreviews.exe.config such as:

  • OperationSleep sets break time in milliseconds between iteration to protect sql server from high load, default value is 2000
  • LogMaxRowCount sets a maximum row number for log files (which is placed in the same directory as the program itself), the tool will create a new log if it exceeds. Default value is 100000
  • SqlCommandTimeout is in seconds and its default value is 120

Known issues:

  • Display usage shows the program can call with -help parameter, but it's not working and only will trigger the tool with default settings.
  • Display usage text format is a little dizzy because br tags are not handled.
  • There will be a log file even if we've started the tool for usage of information only (with -? parameter)

sensenet-preview-cleaner's People

Contributors

herflis avatar vargajoe avatar

Stargazers

 avatar

Watchers

 avatar  avatar

sensenet-preview-cleaner's Issues

Filter by Path

It would be useful if we could narrow the number of content items to a certain subtree by adding a path parameter, so that operators can clean up only a subset of the repository.

A more complex scenario would be to add an optional content query filter, but that is out of scope for now, and would require a bigger effort, because currently this tool does not require an index to operate.

Create a proper Readme.md

Please fill your Readme.md with more information about your component (What is it?, Why is it useful?, How can I install it?, How can I use it?, etc.)

Add a release

Please add a release to this repository, so that potential users know that it works and let them download a compiled binary version, without having to clone and compile the source code.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.