$isValid = true;
            break;
        default:
            break;
    }
    return $isValid;
}
// script initializing
$cli = eZCLI::instance();
$script = eZScript::instance(array('description' => "\n" . "This script will upgrade ezwebin.", 'use-session' => false, 'use-modules' => true, 'use-extensions' => true, 'user' => true));
$script->startup();
$scriptOptions = $script->getOptions("[to-version:][repository:][package:][package-dir:][url:][auto-mode:]", "", array('to-version' => "Specify what upgrade path to use. \n" . " available options: '1.2-0' - upgrade 1.1-1 to 1.2-0\n" . "                    '1.3-0' - upgrade 1.2-0 to 1.3-0\n" . "                    '1.4-0' - upgrade 1.3-0 to 1.4-0", 'repository' => "Path to repository where unpacked(unarchived) packages are \n" . "placed. it's relative to 'var/[site.ini].[FileSettings].[StorageDir]/[package.ini].[RepositorySettings].[RepositoryDirectory]' \n" . "(default is 'var/storage/packages/ez_systems')", 'package' => "Package(s) to install, f.e. 'ezwebin_classes'", 'package-dir' => "Path to directory with packed(ezpkg) packages(default is '/tmp/ezwebin') ", 'url' => "URL to download packages, f.e. 'http://packages.ez.no/ezpublish/3.9'.\n" . "'package-dir' can be specified to store uploaded packages on local computer.\n" . "if 'package-dir' is not specified then default dir('/tmp/ezwebin') will be used.", 'auto-mode' => "[on/off]. Do not ask what to do in case of confilicts. By default is 'on'"), false, array('user' => true));
if (!$scriptOptions['siteaccess']) {
    showNotice("No siteaccess provided, will use default siteaccess");
} else {
    $siteAccessExists = checkSiteaccess($scriptOptions['siteaccess']);
    if ($siteAccessExists) {
        showNotice("Using siteaccess " . $scriptOptions['siteaccess']);
        $script->setUseSiteAccess($scriptOptions['siteaccess']);
    } else {
        showError("Siteaccess '" . $scriptOptions['siteaccess'] . "' does not exist. Exiting...");
    }
}
$script->initialize();
/**************************************************************
* process options                                             *
***************************************************************/
$toVersion = '1.2-0';
if ($scriptOptions['to-version']) {
    $version = $scriptOptions['to-version'];
    if (isValidWebinUpgradeVersion($version)) {
Example #2
0
function siteAccessMap($siteAccessNameArray)
{
    if (is_array($siteAccessNameArray)) {
        //Build array map of checked siteaccesses.
        //Siteaccess name as key, points to root dir, to be used in eZINI methods.
        $siteAccessMap = array();
        foreach ($siteAccessNameArray as $siteAccessName) {
            $mapEntry = checkSiteaccess($siteAccessName);
            $siteAccessMap[] = $mapEntry;
        }
        return $siteAccessMap;
    } else {
        return false;
    }
}
require_once 'autoload.php';
// script initializing
$cli = eZCLI::instance();
$script = eZScript::instance(array('description' => "\n" . "Install eZWebin package\n", 'use-session' => false, 'use-modules' => true, 'use-extensions' => true, 'user' => true));
$script->startup();
$scriptOptions = $script->getOptions("[repository:][package:][package-dir:][url:][admin-siteaccess:][user-siteaccess:][auto-mode:]", "", array('repository' => "Path to repository where unpacked(unarchived) packages are \n" . "placed. it's relative to 'var/[site.ini].[FileSettings].[StorageDir]/[package.ini].[RepositorySettings].[RepositoryDirectory]' \n" . "(default is 'var/storage/packages/ez_systems')", 'package-dir' => "Path to directory with packed(ezpkg) packages(default is '/tmp/ezwebin') ", 'url' => "URL to download packages, f.e. 'http://packages.ez.no/ezpublish/3.9'.\n" . "'package-dir' can be specified to store uploaded packages on local computer.\n" . "if 'package-dir' is not specified then default dir('/tmp/ezwebin') will be used.", 'admin-siteaccess' => 'Will be used as base for eZWebin admin siteaccess', 'user-siteaccess' => 'Will be used as base for eZWebin user siteaccesses', 'auto-mode' => "[on/off]. Do not ask what to do in case of confilicts. By default is 'on'"), false, array('user' => true));
if (!$scriptOptions['admin-siteaccess']) {
    showError("No admin siteaccess provided");
}
if (!$scriptOptions['user-siteaccess']) {
    showError("No user siteaccess provided");
}
$adminSiteaccess = $scriptOptions['admin-siteaccess'];
$userSiteaccess = $scriptOptions['user-siteaccess'];
checkSiteaccess($adminSiteaccess, true);
checkSiteaccess($userSiteaccess, true);
showNotice("Using siteaccess '" . $adminSiteaccess . "'");
$script->setUseSiteAccess($adminSiteaccess);
$script->initialize();
/**************************************************************
* process options                                             *
***************************************************************/
//
// 'repository' option
//
$packageRepository = $scriptOptions['repository'];
if (!$packageRepository) {
    $packageRepository = repositoryByVendor(defaultVendor());
}
//
// 'package' option