How To Mirror Add-Ons Update Site for Zend Studio 9

Follow

Applies To:

[ Zend Studio 9.x ]
[ All operating systems ]

Overview

Starting with Zend Studio 9, the product consists of two major sets of components - the core features and add-on features. The developer can easily customize his specific installation of Zend Studio by selecting and installing the add-ons directly from the Welcome page. Such customized installations that contain only the features a specific user needs are much more efficient than an installation that contains and loads all possible components that developers may or may not use.

While the new approach is in general much more flexible for an end user, it presents certain administrative difficulties in large organizations. The network access in such organizations may be performed through a proxy server. Additionally, the network performance may be affected, if several developers are customizing or updating their Zend Studio installations simultaneously. This article explains how to create a local LAN mirror of the Zend Studio add-ons update site.

Instructions

To use the local LAN add-ons update site, a mirror of the on-line resource needs to be created and made available throughout the organization. Zend Studio needs to be configured to use the mirror update site instead of its on-line counterpart.

Prerequisites

The update site needs to be accessible by HTTP protocol using a pre-defined URL:

  • The local update site needs to run on a web server. The web server does not need any special configuration.
  • The update site mirror needs to reside in a directory served by the web server.
  • The local update site URL needs to be provided to all Zend Studio users.

In this guide we will use the URL - 'http://10.1.2.3/updates-extra/' - as an example.

Update Site Mirror Creation

The mirror should be created using an automatic scrip that:

  • Checks whether the existing contents are up to date using the file 'build.id'
  • Downloads the files listed in 'files.lst', if there is a newer build on-line
  • Changes the update site URL in 'directory.xml'

The script may run automatically or manually. The recommended run frequency is weekly or bi-weekly. It does not make sense to run it more frequently, because the add-ons update site normally changes on-line once a month or even once every two months. To make sure you get the changes on the mirror site as soon as they appear on-line, you can run the script daily. In any case, unless the number in 'build.id' is different, the script only runs for a second or two - the time it takes to compare the local and on-line revisions.

 

Example Scripts

Here are two samples of scripts you can run manually or automatically as described earlier. Depending on the machine running the web server, use the Linux/OSX or Windows script. The scripts create a mirror of the add-ons update site in the working directory. The scripts are very basic and can be easily adjustedto match a specific environment.

Note:
The variable 'local_url' needs to be modified to reflect the actual URL of the local LAN add-ons update site.

 

BASH script for Linux or OSX
#!/bin/bash

prefix="http://downloads.zend.com/studio-eclipse/updates-extra/9_0"

# $local_url needs to be modified to reflect the actual local update site URL
local_url="http://10.1.2.3/updates-extra"

wget "$prefix/build.id" -O "$TMPDIR/build.id" -q

remote_id=$(cat "$TMPDIR/build.id")
if [ -f build.id ]; then
    local_id=$(cat build.id)
else
    local_id="0"
fi

rm -f "$TMPDIR/build.id"

echo "Remote build ID - $remote_id"
echo "Local build ID - $local_id"

if [ $remote_id -eq $local_id ]; then
    echo "---------------------------------------------------------"
    echo "Current local build ID is the same as on the server - $local_id"
    echo Will not perform update
    exit
else
    rm -rf features plugins *.xml build.id catalog.jar files.lst
    mkdir features plugins

    wget "$prefix/files.lst" -q

    for file in `cat files.lst`; do
        wget "$prefix/$file" -O "$file" -q
        echo "Downloaded $file"
    done

    sed "s@http://downloads.zend.com/.*catalog.jar@$local_url/catalog.jar@g" directory.xml > directory.fixed
    rm -f directory.xml
    mv directory.fixed directory.xml
fi

 

Windows CMD script
@echo off

rem This script requires two GNU utilities: 'wget' and 'sed'
rem http://gnuwin32.sourceforge.net/packages/wget.htm
rem http://gnuwin32.sourceforge.net/packages/sed.htm

set wget_bin="c:\Program Files\Gnu\Win32\bin\wget"
set sed_bin="c:\Program Files\Gnu\Win32\bin\sed"

set prefix=http://downloads.zend.com/studio-eclipse/updates-extra/9_0/

rem %local_url% needs to be modified to reflect the actual local update site URL
set local_url=http://10.1.2.3/updates-extra/

%wget_bin% "%prefix%build.id" -O "%TEMP%/build.id" -q 2> nul

set local_id=0
set /p remote_id=<"%TEMP%build.id"
set /p local_id=<build.id
del "%TEMP%build.id"

echo Remote build ID - %remote_id%
echo Local build ID - %local_id%

if %remote_id%==%local_id% (call :nonews %local_id%) else (goto :update)
goto :eof

:update
rd /s /q features plugins
del artifacts.xml build.id catalog.jar content.xml directory.xml files.lst
md features plugins

%wget_bin% "%prefix%files.lst" -q 2> nul

for /f %%a in (files.lst) do (
    %wget_bin% "%prefix%%%a" -O "%%a" -q 2> nul
    echo Downloaded %%a
)

%sed_bin% "s@http://downloads.zend.com/.*catalog.jar@%local_url%catalog.jar@g" directory.xml > directory.fixed
del directory.xml
ren directory.fixed directory.xml
goto :eof

:nonews
echo ---------------------------------------------------------
echo Current local build ID is the same as on the server - %1
echo Will not perform update

 

Windows Note:
The script relies on two GNU utilities - wget and sed. You can obtain them from the following links:
Make sure to adjust these utilities' locations in variables 'wget_bin' and 'sed_bin', if they are different from 'C:Program Files\Gnu\Win32\bin' (default path for a 32-bit system).

 

Zend Studio Configuration

To use the newly created local add-ons update site, add the following line to the end of 'ZendStudio.ini' file (the URL needs to be adjusted):

-Dcom.zend.php.customization.site.url=http://10.1.2.3/updates-extra/

The file 'ZendStudio.ini' can be found in Zend Studio installation directory on Linux and Windows.

On OSX the file is located inside the application package, e.g. '/Applications/Zend Studio.app/Contents/MacOS/ZendStudio.ini'

 

Result

To verify that the local LAN add-ons update site is working properly, simply open the Welcome page (Help | Welcome). If the add-ons list is populated correctly, the new setup is functional.

If an error occurs, inspect the details of error messages and/or the program log (<your workspace>/.metadata/.log). In such cases the log usually contains very clear messages explaining what exectly did not work as expected.

 


Excerpt: Starting with Zend Studio 9, the product consists of two major sets of components - the core features and add-on features. This article explains how to create a local LAN mirror of the Zend Studio add-ons update site.


Original Post Date: 2012-05-18 22:07:07

Alternative Description:

Starting with Zend Studio 9, the product consists of two major sets of components - the core features and add-on features. While the new approach is in general much more flexible for an end user, it presents certain administrative difficulties in large organizations. The network access in such organizations may be performed through a proxy server. Additionally, the network performance may be affected, if several developers are customizing or updating their Zend Studio installations simultaneously. This article explains how to create a local LAN mirror of the Zend Studio add-ons update site.

_____
Tags: add-on,addon,Apple OS X 10.7 (Lion),Apple OS X 10.8 (Mountain Lion),Apple OS X 10.9 (Mavericks),Debian / Ubuntu,extra,local,MacOS 10.6 and earlier,mirror,MS Windows 2003 Server,MS Windows 2008 Server,MS Windows 2012 Server,MS Windows 7,MS Windows 8,MS Windows XP,RedHat Enterprise Linux / CentOS,SUSE Linux Enterprise Server / OpenSUSE,update,update site,Zend Studio 10.x,Zend Studio 11.x,Zend Studio 9.x,oldKB

Comments