Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remote publish fixes #1939

Merged
merged 1 commit into from
Jan 25, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2080,10 +2080,6 @@ private Contentlet checkin(Contentlet contentlet, ContentletRelationships conten
String contentPushExpireTime = contentlet.getStringProperty("wfExpireTime");
String contentPushNeverExpire = contentlet.getStringProperty("wfNeverExpire");

if(saveWithExistingID)
contentlet = conFac.save(contentlet, existingInode);
else
contentlet = conFac.save(contentlet);

if (!InodeUtils.isSet(contentlet.getIdentifier())) {
Treeable parent = null;
Expand All @@ -2099,7 +2095,7 @@ private Contentlet checkin(Contentlet contentlet, ContentletRelationships conten
else
ident = APILocator.getIdentifierAPI().createNew(contPar, parent);
contentlet.setIdentifier(ident.getId());
contentlet = conFac.save(contentlet);
//contentlet = conFac.save(contentlet);
} else {
Identifier ident = APILocator.getIdentifierAPI().find(contentlet);

Expand All @@ -2126,6 +2122,11 @@ private Contentlet checkin(Contentlet contentlet, ContentletRelationships conten
}
APILocator.getIdentifierAPI().save(ident);
}

if(saveWithExistingID)
contentlet = conFac.save(contentlet, existingInode);
else
contentlet = conFac.save(contentlet);


APILocator.getVersionableAPI().setWorking(contentlet);
Expand Down
9 changes: 2 additions & 7 deletions src/com/dotcms/publisher/pusher/bundler/ContentBundler.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,8 @@ public void generate(File bundleRoot, BundlerStatus status)
if(UtilMethods.isSet(contentsIds) && !contentsIds.isEmpty()) { // this content set is a dependency of other assets, like htmlpages
Set<Contentlet> contents = new HashSet<Contentlet>();
for (String contentIdentifier : contentsIds) {
try{
contents.add(APILocator.getContentletAPI().findContentletByIdentifier(contentIdentifier, true, APILocator.getLanguageAPI().getDefaultLanguage().getId(), systemUser, false));
}catch (Exception e) {
try{
contents.add(APILocator.getContentletAPI().findContentletByIdentifier(contentIdentifier, false, APILocator.getLanguageAPI().getDefaultLanguage().getId(), systemUser, false));
}catch (Exception e1) { }
}
contents.addAll(conAPI.search("+identifier:"+contentIdentifier+" +live:true +deleted:false", 0, -1, null, systemUser, false));
contents.addAll(conAPI.search("+identifier:"+contentIdentifier+" +working:true +deleted:false", 0, -1, null, systemUser, false));
}

//Delete duplicate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ private void publish(Contentlet content, File folderOut, User userToUse, Content
if(binaryFolder != null && binaryFolder.exists() && binaryFolder.listFiles().length > 0)
content.setBinary(ff.getVelocityVarName(), binaryFolder.listFiles()[0]);
}

}

content = conAPI.checkin(content, userToUse, false);
Expand Down
4 changes: 2 additions & 2 deletions src/com/dotcms/publisher/util/DependencyManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -352,14 +352,14 @@ private void setContentDependencies(List<String> luceneQueries) throws DotBundle

//Getting all related content
for (Contentlet con : cs) {
contentsToProcess.add(con);

Map<Relationship, List<Contentlet>> contentRel =
APILocator.getContentletAPI().findContentRelationships(con, user);

for (Relationship rel : contentRel.keySet()) {
contentsToProcess.addAll(contentRel.get(rel));
}

contentsToProcess.add(con);
}

// Adding the Contents (including related) and adding filesAsContent
Expand Down
13 changes: 8 additions & 5 deletions src/com/dotmarketing/business/VersionableFactoryImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,14 @@ private VersionInfo refreshVersionInfoFromDb(VersionInfo info) throws DotDataExc

Identifier ident = APILocator.getIdentifierAPI().find(info.getIdentifier());
Class clazz = UtilMethods.getVersionInfoType(ident.getAssetType());
HibernateUtil dh = new HibernateUtil(clazz);
dh.setQuery("from "+clazz.getName()+" where identifier=?");
dh.setParam(info.getIdentifier());
Logger.debug(this.getClass(), "getVersionInfo query: "+dh.getQuery());
VersionInfo vi=(VersionInfo)dh.load();
VersionInfo vi= null;
if(clazz != null) {
HibernateUtil dh = new HibernateUtil(clazz);
dh.setQuery("from "+clazz.getName()+" where identifier=?");
dh.setParam(info.getIdentifier());
Logger.debug(this.getClass(), "getVersionInfo query: "+dh.getQuery());
vi=(VersionInfo)dh.load();
}
if(vi ==null || !UtilMethods.isSet(vi.getIdentifier())) {
try {
vi = (VersionInfo) clazz.newInstance();
Expand Down