core icon indicating copy to clipboard operation
core copied to clipboard

Copied FileAssets not being indexed on copy

Open DeanGonzalez opened this issue 13 years ago • 2 comments

This is follow up fix task to: https://github.com/dotCMS/dotCMS/issues/1603

I took the /resources/images folder and copied it into the /images/icons folder. Then I created template with this code:

set($showSubgalleryTitle=false)

set($showPhotoTitle = false)

set ($thumbnailWidth = "150")

set ($thumbnailHeight = "150")

< h1> EXISTING assets

photoGallery("/resources/images")


< h1> COPIED assets

photoGallery("/images/icons/images")

and when I created a new html page with this template, only the existing assets showed but not the copied assets. I had to do a re-index to get them to show. I tested twice... second time on clean dotCMS... clean starter

Here is complete screencast: http://screencast.com/t/6WatHXhja

DeanGonzalez avatar Dec 07 '12 15:12 DeanGonzalez

Oddly enough the fix as implemented works fine on dotcms 2.2 main although to be honest I did use :+1: APILocator.getContentletAPI().refreshContentUnderFolder(newFolder); instead of reindex(structure)....

maybe you could try it with that change and see if it works? and similar logic for BrowserAjax.java: using:

APILocator.getContentletAPI().refreshContentUnderFolder(parent);

I assume that BrowserAjax.java's move() function suffers from the same problems, so I propose adding code to refresh both src and dest folders: @line 707, new code would be like: Folder srcFolder = APILocator.getFolderAPI().find(file.getParent(),user,false); // issues/1603 - refresh index for src Folder if (srcFolder!=null){ APILocator.getContentletAPI().refreshContentUnderFolder(srcFolder);
} if ( parent != null ) { // if copied to a folder, refresh index for that target folder. APILocator.getContentletAPI().refreshContentUnderFolder(parent); return APILocator.getFileAPI().moveFile( file, parent, user, false ); } else { // otherwise refresh content under host APILocator.getContentletAPI().refreshContentUnderHost(host); return APILocator.getFileAPI().moveFile( file, host, user, false ); } .... Don't quote me on this, but it looks logically correct - probably missing something... like refreshing host if srcFolder.getParent() is null... but not sure when/how/if that would occur....

rosselet avatar Dec 10 '12 22:12 rosselet

After following the exact same steps, this is stilll not working... created another task here: https://github.com/dotCMS/dotCMS/issues/1736

DeanGonzalez avatar Dec 19 '12 15:12 DeanGonzalez