<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>How to publish from staging to live programmatically</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=121018830" />
  <subtitle>How to publish from staging to live programmatically</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=121018830</id>
  <updated>2026-04-04T02:08:31Z</updated>
  <dc:date>2026-04-04T02:08:31Z</dc:date>
  <entry>
    <title>RE: How to publish from staging to live programmatically</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121146016" />
    <author>
      <name>Carlos Barreiro</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121146016</id>
    <updated>2021-09-14T07:04:53Z</updated>
    <published>2021-09-14T07:04:52Z</published>
    <summary type="html">&lt;p&gt;Hello Zsigmond, sorry for the delay, I couldn't try it until last
  week :) &lt;/p&gt;
&lt;p&gt;It seems that it's the way for creating the checksum, but, I don't
  know why, it was creating a large file, probably to publish all files
  instead of only the last uploaded files. The publish template is
  configured to only upload the last files so probably there is
  something that needs to be done before calling the
  !exportLayoutsAsFile&amp;quot; method so it takes into account the
  configuration of the template.&lt;/p&gt;
&lt;p&gt;Anyways, I followed other path and it worked. I created a
  BackgroundTask pointing to the exportimportconfigurationid of the
  publish template, and finally it is publishing the files in the live
  environment without problems :)&lt;/p&gt;
&lt;p&gt;Thanks and regards!&lt;/p&gt;</summary>
    <dc:creator>Carlos Barreiro</dc:creator>
    <dc:date>2021-09-14T07:04:52Z</dc:date>
  </entry>
  <entry>
    <title>RE: How to publish from staging to live programmatically</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121036576" />
    <author>
      <name>Zsigmond Rab</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121036576</id>
    <updated>2021-08-11T14:09:18Z</updated>
    <published>2021-08-11T14:09:17Z</published>
    <summary type="html">&lt;p&gt;Hi Carlos,&lt;/p&gt;
&lt;p&gt;Have you tried something like this already?&lt;/p&gt;
&lt;pre&gt;
&lt;code class="language-java"&gt;File file = exportLayoutsAsFile(exportImportConfiguration);

String checksum = FileUtil.getMD5Checksum(file);

long stagingRequestId =
    StagingLocalService.createStagingRequest(userId, targetGroupId, checksum);

StagingLocalService.publishStagingRequest(userId, stagingRequestId, exportImportConfiguration);&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I haven't tried this by myself, but there is similar logic in the
    source: &lt;a href="https://github.com/liferay/liferay-portal/blob/master/modules/apps/export-import/export-import-service/src/main/java/com/liferay/exportimport/internal/background/task/LayoutRemoteStagingBackgroundTaskExecutor.java#L128-L144"&gt;https://github.com/liferay/liferay-portal/blob/master/modules/apps/export-import/export-import-service/src/main/java/com/liferay/exportimport/internal/background/task/LayoutRemoteStagingBackgroundTaskExecutor.java#L128-L144&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Zsigmond&lt;/p&gt;</summary>
    <dc:creator>Zsigmond Rab</dc:creator>
    <dc:date>2021-08-11T14:09:17Z</dc:date>
  </entry>
  <entry>
    <title>How to publish from staging to live programmatically</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121018829" />
    <author>
      <name>Carlos Barreiro</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121018829</id>
    <updated>2021-08-16T20:16:32Z</updated>
    <published>2021-08-05T13:27:58Z</published>
    <summary type="html">&lt;p&gt;Hello, I have a staging and a live environments in two separate
  servers. I've defined a &amp;quot;publish template&amp;quot; and I want to
  make publications programmatically from staging to live with that
  template, but i'm having some problems.&lt;/p&gt;
&lt;p&gt;I'm following &lt;a
    href="https://help.liferay.com/hc/es/articles/360017889172-Initiating-New-Export-Import-Processes"&gt;this
  article&lt;/a&gt;, and it seems that i've got the ExportImportConfiguration
  instance properly. In the last step, it states that I should use the
  ExportImportLocalService or the StagingLocalService depending on what
  process I want to do, and that it only requires the
  ExportImportConfiguration as a parameter. The problem is that the
  example only covers the &amp;quot;ExportImportLocalService&amp;quot; case, and
  I should use the StagingLocalService one, using the &lt;a
    href="https://docs.liferay.com/dxp/portal/7.1-latest/javadocs/portal-kernel/com/liferay/exportimport/kernel/service/StagingLocalService.html#publishStagingRequest-long-long-com.liferay.exportimport.kernel.model.ExportImportConfiguration-"&gt;publishStagingRequest
  method&lt;/a&gt;, which is requiring one more parameter, the
  stagingRequestId, but I dont know what is it.&lt;/p&gt;
&lt;p&gt;I've seen in the same service that there is a &lt;a
  href="https://docs.liferay.com/dxp/portal/7.1-latest/javadocs/portal-kernel/com/liferay/exportimport/kernel/service/StagingLocalService.html#createStagingRequest-long-long-java.lang.String-"&gt;createStagingRequest&lt;/a&gt;
  method, I guess that I should use it, but it requires a
  &amp;quot;checksum&amp;quot; parameter that I don't know where it comes from&lt;/p&gt;
&lt;p&gt;If you could bring me some light i'd be pretty grateful&lt;/p&gt;
&lt;p&gt;Regards!&lt;/p&gt;</summary>
    <dc:creator>Carlos Barreiro</dc:creator>
    <dc:date>2021-08-05T13:27:58Z</dc:date>
  </entry>
</feed>
