AI OnAI Off
Hi Claus,
These images should have been removed when the user was removed. But anyways... First run this SQL script:
DELETE FROM tblEPiServerCommunityImageGalleryImage
WHERE intUploaderID NOT IN (SELECT intID FROM tblEPiServerCommonUser)
This will delete all the images. Then you will probably have to update the counters on the image galleries as well. This is done with the following scripts:
UPDATE tblEPiServerCommunityImageGallery
SET intNumOfImagesTotal =
(SELECT COUNT(*) FROM tblEPiServerCommunityImageGalleryImage
WHERE intImageGalleryID = tblEPiServerCommunityImageGallery.intID)
UPDATE tblEPiServerCommunityImageGallery
SET intNumOfImagesPublished =
(SELECT COUNT(*) FROM tblEPiServerCommunityImageGalleryImage
WHERE intImageGalleryID = tblEPiServerCommunityImageGallery.intID
AND intPublishState = 1
)
UPDATE tblEPiServerCommunityImageGallery
SET intNumOfImagesNotPublished =
(SELECT COUNT(*) FROM tblEPiServerCommunityImageGalleryImage
WHERE intImageGalleryID = tblEPiServerCommunityImageGallery.intID
AND intPublishState = 2
)
Probably best to take a backup of database before you this, just in case ;)
Best regards,
Tom
In my development environment I have som images created by a now deleted user. These images causes exceptions to be thrown when I try to access the image gallery.
How can I get rid of these images without ruining the database?