Extension portability

As from eZ Publish 3.8 version, you can install extensions through the packages. This system is very useful because you can install your, or third-party extensions in a very simple way through a convenient graphical interface.

From the eZ Publish backend, you can create new packages that can be used in other installations or can be freely distributed through the eZ.no site.

To deliver our extensions and our custom classes (created in Chapter 2), we need to create two types of packages. The first one is the content classes package that will include the definition of our custom classes. The second is an extension package that will include our entire extensions, including the content class package that we previously created.

Content class package

First of all, we can make a content class package into which we can save the content class definition that we customized in the previous chapters.

The content class package is basically an archive containing all of the enhancement and personalization that we made to the CMF that can be exported to other eZ Publish installations.

To create a content class package, we have to:

  1. Go to the backend site http://packtmediaproject/index.php/ezwebin_site_admin.
  2. Click on the Setup tab of top menu.
  3. Click on the Packages link in left menu.
  4. Click on the Create new package button.
    Content class package
  5. Select the option button Content class export, and then click on the Create package button.
    Content class package
  6. Next, select the content classes Article and Profile, which we built in Chapter 3, from the class list. To continue, we have to click on the Next button.
    Content class package
  7. Next, we have to complete the form with information regarding the package that we are building, and then click on the Next button.
    Content class package
  8. Specify the Package maintainer contents, and then click on the Next button.
    Content class package
  9. As the last step, we will create a changelog with all the changes that we will add in this package release. Finally, we will click on the Continue button.
    Content class package

Our MagazineContentClass package is now ready. We can download it by clicking on the Export to file button and saving the file in an easily-accessible folder.

Content class package

If we want to add this file to our extension to make our content class definition reusable and easily portable, we have to create a folder named packages in our extension and then add the downloaded file to this folder.

Open a shell and execute the following commands:

# cd /var/www/packtmediaproject/extension/packtmedia
# mkdir packages
# cp [browser_download_dir]/MagazineContentClass-1.0-1.ezpkg packages/

Now, when we will export our extension, it will include the content class package that we have created.

Note

The .ezpkg file is a compressed archive. We can uncompress it and see its contents with the tar command.

The first step to create our package is complete.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.22.41.235