Publishing and deleting personalization rules using a script
We can use a HCL WebSphere Portal
Personalization provided script, pznload, to export, publish, and
delete Personalization rules on local or remote servers.
We can script the delivery of rules and campaigns from staging to production, or the offline
publishing between disconnected systems (such as when production servers are secured behind a
firewall). We can use this function to quickly revert production servers to an earlier
state.
To run the pznload script, first run the setupCmdLine batch file to set up the WebSphere Application Server parameters. The setupCmdLine.bat file is in
the wp_profile\bin directory.
Publishing through the command line is a two-step process. First, you export the personalization rules that we want to transfer from the authoring environment to a remote system.
After we are done exporting and saving the required objects, we use the pznload
script to send this data to the appropriate server.
Tip: For extra help on using the pznload script, run the --help
command.
We can export the personalization rules on the site or we can run
the pznload command. Select one of the following methods to export
personalization objects from the site:
Click More Actions > Export in the Personalization Navigator. You are prompted for a location to save a nodes
file. This file contains an XML representation of all the currently selected personalization
objects. We can export entire folders.Figure 1. Exporting a folder to the file system
Open a command prompt and run, where out designates the location of the exported data on your local system and
targetpath is the object (and child) that is
exported:
Choose the appropriate option to send this data to the appropriate server:
The pznload script
is in the PortalServer_root/pzn/prereq.pzn/publish/ directory.
Tip: This program accepts a number of
command-line options and a set of nodes files to publish. Start pznload with
the --help option to see a list of all options. The most important arguments are
described here:
serverurl
The URL of the remote publish servlet. If we do not specify a value, the program attempts to connect to a HCL WebSphere Portal server that is running on the local
machine. If we do specify a value, it must follow the format of
http(s)://localhost:{port}/{WpsContextRootPath}/pznpublish/pznpublishtarget.
Where it's either http or https, the port is
the port of the particular Portal server we want to connect to and
WpsContextRootPath is the root context path for that Portal server. For example,
http://localhost:10039/wps/pznpublish/pznpublishtarget.
targetworkspace
The name of the workspace to publish to. The default workspace name on all IBM Content Manager runtime edition installations is
ROOTWORKSPACE.
targetpath
The location in the target workspace, which is the parent for the published nodes. The target
path must exist before publishing. For example, if the export function was used on the folder
/Projects/HR website, then the target path is specified as
/Projects. So that the published resources are in
/Projects/HR website.
username
A valid user on the target system with sufficient access rights.
Note: To force the deletion of a personalization rule without having to respond to a confirmation
message, insert the --force flag after the delete command. For
example, pznload --delete --username username --password
password --targetpath path --force
After a publish is started, you see status messages in the command console.