Skip to the content
Documentation
Help Start
Reading in:
  • German: 9,155 of 9,155 pages
About the help in other languages
All help pages

Lesson 5.3: Packages on the command line with ezpm

Learners list, inspect, create, fill, export, validate and import packages with ezpm, package a content subtree from the second site, and explain the lock, the batched commits and what to do after a large install. 55…

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/help/trainers/multisite-and-packages/module-05-site-packages/packages-on-the-command-line.md

On this page

Lesson 5.3: Packages on the command line with ezpm

ezpm.php is the package manager on the command line. It does what the packages pages do, and more: it packages a whole content subtree, exports in the JSON format and installs large packages without a browser that might time out. In this lesson learners package the content of Site B and look at the result without installing it anywhere.

At a glance

CourseMultisite and site packages
ModuleModule 5: Site packages
Duration55 minutes (20 presenting, 35 exercise)
LevelAdvanced
AudienceAdministrators and developers
PrerequisitesLesson 5.2; Site B with some content (modules 1 and 2)

Learning objectives

After this lesson, learners can:

  • run ezpm.php directly and through the console, and read its help per command;
  • create a package and add a content subtree with chosen options;
  • export a package as .ezpkg in the classic or the JSON format, and validate an archive;
  • explain the lock, the batched commits and the delayed indexing of install;
  • name the steps after a large install (search index, caches).

Trainer's notes

How to present it

Source: ezpm: the package manager on the command line.

  1. Running it (3 minutes). php ezpm.php help lists the commands: create, install, import, export, convert, validate, check, add, set, delete, list, info. php ezpm.php help <command> explains one. php bin/php/console list ezpm shows the console's entry. Global options include -s (siteaccess), -r (repository), -q (quiet) and -l/-p (log in as a user).

  2. A content subtree package (6 minutes). Three steps: create, add, export.

    php ezpm.php create mypackage 'My package summary' 1.0.1 install
    php ezpm.php add mypackage ezcontentsubtree /content/my-page --exclude-classes --siteaccess=site
    php ezpm.php export mypackage -d var/tmp

    ezcontentsubtree is an alias of ezcontentobject; it takes a node ID or a URL path. Options include --include-classes/--exclude-classes, --include-templates/--exclude-templates, --language=, --current-version/--all-versions and --minimal-template-set.

  3. Formats and checks (3 minutes). export --format=json writes the JSON format with checksums; validate <archive, directory or name> checks a package in either format without importing it.

  4. Installing (6 minutes). install <name> [-d <node id>] puts content objects under a parent node (default 2). One run at a time: install and add take a lock (ezpm.lock in the var directory). View and template caches are off and search indexing is delayed for the run; the content handler commits every 50 objects; dependencies are installed first. --as-drafts writes content objects as drafts and installs nothing else. Afterwards: php bin/php/updatesearchindex.php and a cache clear.

Common questions

Do I need --allow-root-user? The check that wrote the feature page found that ezpm.php ran as root without it, while other scripts ask for it. Run as the site user and the question does not arise.

Can I install the package on the same installation? You can, but it writes content. In this course we export and validate only; installing is lesson 5.6, on a copy.

What does "Another ezpm process is currently running" mean? A second install or add started while the first holds the lock. Wait for the first.

Where do exports go without -d? Into the current directory.

Pitfalls

  • Exporting into the web root. An .ezpkg in a public directory can be downloaded by anyone who guesses its name. Use var/tmp or a directory outside the document root, and remove it after the course.
  • Classes in content packages. Without --exclude-classes the package carries the content classes; installing it elsewhere then meets existing classes. Decide on purpose.
  • Templates. By default the template overrides go with the content; use --exclude-templates when only content should move.

Hands-on exercise

Use your training installation. Commands run in its root directory as the site user.

  1. Read the help: php ezpm.php help, then php ezpm.php help add and php ezpm.php help export.

  2. List the packages: php ezpm.php list.

  3. Create a package for the content of Site B:

    php ezpm.php create clubb_content 'Content of Site B' 1.0.0 install
  4. Add the folder Site B and everything below it, without classes and templates (replace NNN with its node ID):

    php ezpm.php add clubb_content ezcontentsubtree NNN --exclude-classes --exclude-templates

    Watch the status line name its phases.

  5. Show the package: php ezpm.php info clubb_content.

  6. Export it in both formats:

    mkdir -p var/tmp/course
    php ezpm.php export clubb_content -d var/tmp/course
    php ezpm.php export clubb_content -d var/tmp/course --format=json
    ls -l var/tmp/course
  7. Validate both archives: php ezpm.php validate var/tmp/course/<file>.ezpkg for each.

  8. Open Setup > Packages in the administration and find clubb_content in the local repository; open its page and look at What it carries and Package contents.

  9. Read the install help (php ezpm.php help install) and write down what -d and --as-drafts would do.

  10. At the end of the course, remove var/tmp/course (your trainer will say when).

Expected result

  • Step 4 ends without error and the status line showed phases such as Collecting subtree nodes and Serializing content objects.
  • Step 6 lists two archives: clubb_content-<version>...ezpkg and a .json.ezpkg.
  • Step 7 reports both valid.
  • Step 8: the package is in local, with the folder Site B and its sub items as content, no classes.
  • The trainer checks step 7 on one lab.

Quiz

  1. Which three ezpm commands build a content subtree package and write it to a file?
  2. What does --exclude-classes change? A. The content is left out B. The content classes are left out C. Templates are left out D. Nothing
  3. Why do install and add take a lock?
  4. What must you run after a large install, and why?
  5. Which command checks an archive without importing it?
Answers
  1. create, add (with ezcontentobject or ezcontentsubtree) and export.
  2. B.
  3. So that only one run works at a time; two parallel runs caused database lock wait timeouts (ezpm).
  4. php bin/php/updatesearchindex.php and a cache clear, because indexing was delayed and caches were off for the run.
  5. php ezpm.php validate <archive>.

Further reading

Become an Exponential Partner

Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.

Something wrong on this page? Report an error

Documentation license

This documentation is free documentation, licensed under the GNU Free Documentation License 1.3 or later.

Exponential Copyright © 1998-2026 Exponential Foundation and 7x