function display()
    {
        // Get site templates from setup.ini
        $config = eZINI::instance( 'setup.ini' );
        $thumbnailBase = $config->variable( 'SiteTemplates', 'ThumbnailBase' );
        $thumbnailExtension = $config->variable( 'SiteTemplates', 'ThumbnailExtension' );

        $site_templates = array();

        $packages = eZPackage::fetchPackages( array( 'path' => 'kernel/setup/packages' ) );
        foreach( $packages as $key => $package )
        {
            $site_templates[$key]['name'] = $package->attribute( 'summary' );
            $site_templates[$key]['identifier'] = $package->attribute( 'name' );
            $thumbnails = $package->thumbnailList( 'default' );
            if ( count( $thumbnails ) > 0 )
                $site_templates[$key]['image_file_name'] = $package->fileItemPath( $thumbnails[0], 'default', 'kernel/setup/packages' );
            else
                $site_templates[$key]['image_file_name'] = false;
        }

        $this->Tpl->setVariable( 'site_templates', $site_templates );
        $this->Tpl->setVariable( 'error', $this->Error );

        // Return template and data to be shown
        $result = array();
        // Display template
        $result['content'] = $this->Tpl->fetch( 'design:setup/init/site_templates.tpl' );
        $result['path'] = array( array( 'text' => ezpI18n::tr( 'design/standard/setup/init',
                                                          'Site template selection' ),
                                        'url' => false ) );
        return $result;

    }
 function finalize(&$package, $http, &$persistentData)
 {
     $this->createPackage($package, $http, $persistentData, $cleanupFiles);
     $classHandler = eZPackage::packageHandler('ezcontentclass');
     $classList = $persistentData['classlist'];
     foreach ($classList as $classID) {
         $classHandler->addClass($package, $classID);
     }
     $package->setAttribute('is_active', true);
     $package->store();
 }
 function finalize(&$package, $http, &$persistentData)
 {
     $this->createPackage($package, $http, $persistentData, $cleanupFiles, false);
     $extensionHandler = eZPackage::packageHandler('ezextension');
     $extensionList = $persistentData['extensionlist'];
     foreach ($extensionList as $extensionName) {
         $extensionHandler->addExtension($package, $extensionName);
     }
     $package->setAttribute('is_active', true);
     $package->store();
 }
Exemplo n.º 4
0
 function finalize(&$package, $http, &$persistentData)
 {
     $this->createPackage($package, $http, $persistentData, $cleanupFiles);
     $objectHandler = eZPackage::packageHandler('ezcontentobject');
     $nodeList = $persistentData['node_list'];
     $options = $persistentData['object_options'];
     foreach ($nodeList as $nodeInfo) {
         $objectHandler->addNode($nodeInfo['id'], $nodeInfo['type'] == 'subtree');
     }
     $objectHandler->generatePackage($package, $options);
     $package->setAttribute('is_active', true);
     $package->store();
 }
 /**
  * Regression test for issue #15263
  * Content object name/url of imported content classes aren't generated correctly
  *
  * @url http://issues.ez.no/15263
  *
  * @outline
  * 1) Expire and force generation of class attribute cache
  * 2) Load a test package
  * 3) Install the package
  * 4) Publish an object of the imported class
  * 5) The object name / url alias shouldn't be the expected one
  **/
 public function testIssue15263()
 {
     $adminUser = eZUser::fetchByName('admin');
     $previousUser = eZUser::currentUser();
     eZUser::setCurrentlyLoggedInUser($adminUser, $adminUser->attribute('contentobject_id'));
     // 1) Expire and force generation of class attribute cache
     $handler = eZExpiryHandler::instance();
     $handler->setTimestamp('class-identifier-cache', time() - 1);
     $handler->store();
     eZContentClassAttribute::classAttributeIdentifierByID(1);
     // 1) Load a test package
     $packageName = 'ezpackage_regression_testIssue15223.ezpkg';
     $packageFilename = dirname(__FILE__) . DIRECTORY_SEPARATOR . $packageName;
     $packageImportTried = false;
     while (!$packageImportTried) {
         $package = eZPackage::import($packageFilename, $packageName);
         if (!$package instanceof eZPackage) {
             if ($package === eZPackage::STATUS_ALREADY_EXISTS) {
                 $packageToRemove = eZPackage::fetch($packageName);
                 $packageToRemove->remove();
             } else {
                 self::fail("An error occured loading the package '{$packageFilename}'");
             }
         }
         $packageImportTried = true;
     }
     // 2) Install the package
     $installParameters = array('site_access_map' => array('*' => false), 'top_nodes_map' => array('*' => 2), 'design_map' => array('*' => false), 'restore_dates' => true, 'user_id' => $adminUser->attribute('contentobject_id'), 'non-interactive' => true, 'language_map' => $package->defaultLanguageMap());
     $result = $package->install($installParameters);
     // 3) Publish an object of the imported class
     $object = new ezpObject('test_issue_15523', 2, $adminUser->attribute('contentobject_id'), 1);
     $object->myname = __METHOD__;
     $object->myothername = __METHOD__;
     $publishedObjectID = $object->publish();
     unset($object);
     // 4) Test data from the publish object
     $publishedNodeArray = eZContentObjectTreeNode::fetchByContentObjectID($publishedObjectID);
     if (count($publishedNodeArray) != 1) {
         $this->fail("An error occured fetching node for object #{$publishedObjectID}");
     }
     $publishedNode = $publishedNodeArray[0];
     if (!$publishedNode instanceof eZContentObjectTreeNode) {
         $this->fail("An error occured fetching node for object #{$publishedObjectID}");
     } else {
         $this->assertEquals("eZPackageRegression::testIssue15263", $publishedNode->attribute('name'));
         $this->assertEquals("eZPackageRegression-testIssue15263", $publishedNode->attribute('url_alias'));
     }
     // Remove the installed package & restore the logged in user
     $package->remove();
     eZUser::setCurrentlyLoggedInUser($previousUser, $previousUser->attribute('contentobject_id'));
 }
 function display()
 {
     $siteTypes = $this->chosenSiteTypes();
     $siteType = $siteTypes[0]['identifier'];
     $typeFunctionality = eZSetupFunctionality($siteType);
     $requiredPackageList = $typeFunctionality['required'];
     $requiredPackages = array();
     foreach ($requiredPackageList as $requiredPackage) {
         $requiredPackages[] = strtolower($requiredPackage);
     }
     $packageArray = eZPackage::fetchPackages(array('repository_id' => 'addons'));
     $requiredPackageInfoArray = array();
     $packageInfoArray = array();
     foreach ($packageArray as $package) {
         if (in_array(strtolower($package->attribute('name')), $requiredPackages)) {
             $requiredPackageInfoArray[] = array('identifier' => $package->attribute('name'), 'name' => $package->attribute('summary'), 'description' => $package->attribute('description'));
         } else {
             $packageInfoArray[] = array('identifier' => $package->attribute('name'), 'name' => $package->attribute('summary'), 'description' => $package->attribute('description'));
         }
     }
     $recommended = array();
     if (isset($typeFunctionality['recommended'])) {
         $recommended = $typeFunctionality['recommended'];
     }
     if (isset($this->PersistenceList['additional_packages'])) {
         $recommended = array_unique(array_merge($recommended, $this->PersistenceList['additional_packages']));
     }
     $this->Tpl->setVariable('site_types', $siteTypes);
     $this->Tpl->setVariable('recommended_package_array', $recommended);
     $this->Tpl->setVariable('error', $this->ErrorMsg);
     $this->Tpl->setVariable('required_package_array', $requiredPackageInfoArray);
     $this->Tpl->setVariable('package_array', $packageInfoArray);
     // Return template and data to be shown
     $result = array();
     // Display template
     $result['content'] = $this->Tpl->fetch('design:setup/init/site_packages.tpl');
     $result['path'] = array(array('text' => ezpI18n::tr('design/standard/setup/init', 'Site functionality'), 'url' => false));
     return $result;
 }
Exemplo n.º 7
0
//
// 'url' option
//
$packageURL = $scriptOptions['url'];
if (!$packageURL) {
    $packageINI = eZINI::instance('package.ini');
    $packageURL = $packageINI->variable('RepositorySettings', 'RemotePackagesIndexURL');
}
//
// 'auto-mode' option
//
global $autoMode;
$autoMode = $scriptOptions['auto-mode'];
if ($autoMode != 'off') {
    $autoMode = 'on';
    $importDir = eZPackage::repositoryPath() . "/{$packageRepository}";
    showWarning("Processing in auto-mode: \n" . "- packages will be downloaded to '{$packageDir}';\n" . "- packages will be imported to '{$importDir}';\n" . "- installing of existing classes will be skipped;\n" . "- all files(extesion, design, downloaded and imported packages) will be overwritten;");
    $action = getUserInput("Continue? [y/n]: ");
    if (strpos($action, 'y') !== 0) {
        $script->shutdown(0, 'Done');
    }
}
/**************************************************************
* do the work                                                 *
***************************************************************/
if (downloadPackages($packageList, $packageURL, $packageDir, $packageRepository)) {
    // install
    installPackages($packageList);
}
if (file_exists(installScriptDir($packageRepository, 'ezwebin_site'))) {
    include_once installScriptDir($packageRepository, 'ezwebin_site') . "/settings/ezwebininstaller.php";
Exemplo n.º 8
0
 /**
  * Retrieve list of packages available to download.
  *
  * Example of return value:
  * array(
  *  'packages' => array(
  *                      '<package_name1>' => array( "name" =>... , "version" =>... , "summary" => ... "url" =>... ),
  *                      '<package_name2>' => array( "name" =>... , "version" =>... , "summary" => ... "url" =>... )
  *                     )
  *      );
  *
  */
 function retrieveRemotePackagesList($onlySitePackages = false)
 {
     // Download index file.
     $idxFileName = $this->downloadFile($this->XMLIndexURL, eZStepSiteTypes::tempDir(), 'index.xml');
     if ($idxFileName === false) {
         // Searching for a local index.xml file to use for offline installation
         $destIndexPath = eZStepSiteTypes::tempDir() . DIRECTORY_SEPARATOR . 'index.xml';
         $repo = eZPackage::systemRepositoryInformation();
         if ($repo) {
             $sourceIndexPath = $repo['path'] . DIRECTORY_SEPARATOR . 'index.xml';
             if (file_exists($sourceIndexPath)) {
                 eZFileHandler::copy($sourceIndexPath, $destIndexPath);
                 $idxFileName = $destIndexPath;
                 // Removing error message from downloadFile
                 $this->ErrorMsg = false;
             }
         }
     }
     if ($idxFileName === false) {
         $this->ErrorMsg = ezpI18n::tr('design/standard/setup/init', 'Retrieving remote site packages list failed. ' . 'You may upload packages manually.');
         eZDebug::writeNotice("Cannot download remote packages index file from '{$this->XMLIndexURL}'.");
         return false;
     }
     // Parse it.
     $dom = new DOMDocument('1.0', 'utf-8');
     $dom->preserveWhiteSpace = false;
     $success = $dom->load(realpath($idxFileName));
     @unlink($idxFileName);
     if (!$success) {
         eZDebug::writeError("Unable to open index file.");
         return false;
     }
     $root = $dom->documentElement;
     if ($root->localName != 'packages') {
         eZDebug::writeError("Malformed index file.");
         return false;
     }
     $packageList = array();
     foreach ($root->childNodes as $packageNode) {
         if ($packageNode->localName != 'package') {
             // skip unwanted chilren
             continue;
         }
         if ($onlySitePackages && $packageNode->getAttribute('type') != 'site') {
             // skip non-site packages
             continue;
         }
         $packageAttributes = array();
         foreach ($packageNode->attributes as $attributeNode) {
             $packageAttributes[$attributeNode->localName] = $attributeNode->value;
         }
         $packageList[$packageAttributes['name']] = $packageAttributes;
     }
     return $packageList;
 }
Exemplo n.º 9
0
    {
        // If this is an unhandled error, we are skipping this item
        $currentItem++;
    }
    $doItemInstall = true;
}
elseif ( $module->isCurrentAction( 'UninstallPackage' ) )
{
    $doItemInstall = true;
}
else
{
    $uninstallElements = array();
    foreach ( $uninstallItems as $uninstallItem )
    {
        $handler = eZPackage::packageHandler( $uninstallItem['type'] );
        if ( $handler )
        {
            $uninstallElement = $handler->explainInstallItem( $package, $uninstallItem );

            if ( $uninstallElement )
            {
                if ( isset( $uninstallElement[0] ) )
                    $uninstallElements = array_merge( $uninstallElements, $uninstallElement );
                else
                    $uninstallElements[] = $uninstallElement;
            }
        }
    }

    $templateName = "design:package/uninstall.tpl";
Exemplo n.º 10
0
 function importPackage()
 {
     $surveyINI = eZINI::instance('ezsurvey.ini');
     $packageName = $surveyINI->variable('PackageSettings', 'PackageName');
     $packagePath = $surveyINI->variable('PackageSettings', 'PackagePath');
     $fileName = $surveyINI->variable('PackageSettings', 'PackageFileName');
     $path = eZExtension::baseDirectory() . '/' . $packagePath . '/';
     $file = $path . $fileName;
     if (file_exists($file)) {
         $package = eZPackage::import($file, $packageName);
         if (is_object($package)) {
             $status = $this->installPackage($package);
         } else {
             if ($package == eZPackage::STATUS_ALREADY_EXISTS) {
                 $package = eZPackage::fetch($packageName);
                 if (is_object($package)) {
                     $status = $this->installPackage($package);
                 } else {
                     eZDebug::writeError("Could not fetch package: {$packageName}", 'eZSurveyWizard::importPackage');
                 }
             } else {
                 eZDebug::writeError("Uploaded file is not an eZ Publish package", 'eZSurveyWizard::importPackage');
             }
         }
     } else {
         eZDebug::writeWarning('File "' . $file . '" does not exist', 'eZSurveyWizard::importPackage');
     }
 }
Exemplo n.º 11
0
 function checkPackageMaintainer($package, &$persistentData)
 {
     $roleList = eZPackage::fetchMaintainerRoleIDList($this->packageType($package, $persistentData), true);
     if (count($roleList) > 0) {
         if ($package instanceof eZPackage) {
             $maintainerPerson = false;
             $user = eZUser::currentUser();
             $userObject = $user->attribute('contentobject');
             if ($userObject) {
                 $maintainerPerson = $userObject->attribute('name');
             }
             $maintainers = $package->attribute('maintainers');
             foreach ($maintainers as $maintainer) {
                 if ($maintainer['person'] == $maintainerPerson) {
                     return false;
                 }
             }
         }
         return true;
     }
     return false;
 }
Exemplo n.º 12
0
<?php
/**
 * @copyright Copyright (C) 1999-2011 eZ Systems AS. All rights reserved.
 * @license http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2
 * @version //autogentag//
 * @package kernel
 */

$module = $Params['Module'];
$viewMode = $Params['ViewMode'];
$packageName = $Params['PackageName'];
$repositoryID = false;
if ( isset( $Params['RepositoryID'] ) and $Params['RepositoryID'] )
    $repositoryID = $Params['RepositoryID'];

$package = eZPackage::fetch( $packageName, false, $repositoryID );
if ( !is_object( $package ) )
    return $module->handleError( eZError::KERNEL_NOT_AVAILABLE, 'kernel' );

if ( !$package->attribute( 'can_read' ) )
    return $module->handleError( eZError::KERNEL_ACCESS_DENIED, 'kernel' );


if ( $module->isCurrentAction( 'Export' ) )
{
    return $module->run( 'export', array( $packageName ) );
}
else if ( $module->isCurrentAction( 'Install' ) )
{
    return $module->redirectToView( 'install', array( $packageName ) );
}
Exemplo n.º 13
0
 function languageInfo($withLanguageNames = false)
 {
     $langaugeInfo = array();
     $classHandler = eZPackage::packageHandler('ezcontentclass');
     $objectHandler = eZPackage::packageHandler('ezcontentobject');
     $explainClassInfo = array('language_info');
     $packageItems = $this->installItemsList();
     foreach ($packageItems as $item) {
         $itemLanguageInfo = array();
         if ($item['type'] == 'ezcontentclass') {
             $classInfo = $classHandler->explainInstallItem($this, $item, $explainClassInfo);
             $itemLanguageInfo = isset($classInfo['language_info']) ? $classInfo['language_info'] : array();
         } else {
             if ($item['type'] == 'ezcontentobject') {
                 $objectsInfo = $objectHandler->explainInstallItem($this, $item);
                 // merge objects info
                 foreach ($objectsInfo as $objectInfo) {
                     $objectLanguages = isset($objectInfo['language_info']) ? $objectInfo['language_info'] : array();
                     foreach ($objectLanguages as $objectLanguage) {
                         if (!in_array($objectLanguage, $itemLanguageInfo)) {
                             $itemLanguageInfo[] = $objectLanguage;
                         }
                     }
                 }
             }
         }
         // merge class and objects infos
         foreach ($itemLanguageInfo as $languageLocale) {
             if (!in_array($languageLocale, $langaugeInfo)) {
                 $langaugeInfo[] = $languageLocale;
             }
         }
     }
     if ($withLanguageNames) {
         $langaugeInfoWithNames = array();
         foreach ($langaugeInfo as $languageLocale) {
             $language = eZContentLanguage::fetchByLocale($languageLocale);
             $languageName = $language->attribute('name');
             $langaugeInfoWithNames[$languageLocale] = $languageName;
         }
         $langaugeInfo = $langaugeInfoWithNames;
     }
     return $langaugeInfo;
 }
 function objectAttributeContent($contentObjectAttribute)
 {
     $packageName = $contentObjectAttribute->attribute("data_text");
     $package = eZPackage::fetch($packageName);
     return $package;
 }
 function init()
 {
     /*
     if( $this->hasKickstartData() )
     {
         $data = $this->kickstartData();
     
         return $this->kickstartContinueNextStep();
     }
     */
     //
     // Get all available languages
     //
     $languages = false;
     $defaultLanguage = false;
     $defaultExtraLanguages = false;
     eZSetupLanguageList($languages, $defaultLanguage, $defaultExtraLanguages);
     //
     // Get info about package and site languages
     //
     $siteLanguageLocaleList = $this->PersistenceList['regional_info']['languages'];
     $packageNameList = array();
     $packageLanguageLocaleList = array();
     $sitePackageName = $this->chosenSitePackage();
     $sitePackage = eZPackage::fetch($sitePackageName, false, false, false);
     if (is_object($sitePackage)) {
         $dependencies = $sitePackage->attribute('dependencies');
         $requirements = $dependencies['requires'];
         foreach ($requirements as $req) {
             $packageNameList[] = $req['name'];
         }
         $packageLanguageLocaleList = eZPackage::languageInfoFromPackageList($packageNameList, false);
     }
     // Explicitly add 'eng-GB' cause clean data is in 'eng-GB'.
     if (!in_array('eng-GB', $packageLanguageLocaleList)) {
         $packageLanguageLocaleList[] = 'eng-GB';
     }
     //
     // Exclude languages which exist both in packges and site.
     //
     $packageLanguageLocaleList = array_diff($packageLanguageLocaleList, $siteLanguageLocaleList);
     if (count($packageLanguageLocaleList) > 0) {
         //
         // Get language names
         //
         $siteLanguageList = array();
         $packageLanguageList = array();
         foreach ($languages as $language) {
             $locale = $language->attribute('locale_code');
             $name = $language->attribute('intl_language_name');
             if (in_array($locale, $siteLanguageLocaleList)) {
                 $siteLanguageList[] = array('locale' => $locale, 'name' => $name);
             }
             if (in_array($locale, $packageLanguageLocaleList)) {
                 $packageLanguageList[] = array('locale' => $locale, 'name' => $name);
             }
         }
         $this->MissedPackageLanguageList = $packageLanguageList;
         $this->SiteLanguageList = $siteLanguageList;
         return false;
     }
     // There are no language conflicts => proceed with next step
     return true;
 }
 function canRemove()
 {
     return array('result' => eZPackage::canUsePolicyFunction('remove'));
 }
Exemplo n.º 17
0
 * @version  2013.11
 * @package kernel
 */
$module = $Params['Module'];
if (!eZPackage::canUsePolicyFunction('import')) {
    return $module->handleError(eZError::KERNEL_ACCESS_DENIED, 'kernel');
}
$package = false;
$installElements = false;
$errorList = array();
if ($module->isCurrentAction('UploadPackage')) {
    if (eZHTTPFile::canFetch('PackageBinaryFile')) {
        $file = eZHTTPFile::fetch('PackageBinaryFile');
        if ($file) {
            $packageFilename = $file->attribute('filename');
            $package = eZPackage::import($packageFilename, $packageName);
            if ($package instanceof eZPackage) {
                if ($package->attribute('install_type') != 'install' or !$package->attribute('can_install')) {
                    return $module->redirectToView('view', array('full', $package->attribute('name')));
                } else {
                    if ($package->attribute('install_type') == 'install') {
                        return $module->redirectToView('install', array($package->attribute('name')));
                    }
                }
            } else {
                if ($package == eZPackage::STATUS_ALREADY_EXISTS) {
                    $errorList[] = array('description' => ezpI18n::tr('kernel/package', 'Package %packagename already exists, cannot import the package', false, array('%packagename' => $packageName)));
                } else {
                    if ($package == eZPackage::STATUS_INVALID_NAME) {
                        $errorList[] = array('description' => ezpI18n::tr('kernel/package', 'The package name %packagename is invalid, cannot import the package', false, array('%packagename' => $packageName)));
                    } else {
 function modify($tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters, $placement)
 {
     $package = $operatorValue;
     $class = $namedParameters['class'];
     switch ($class) {
         case 'thumbnail':
             if ($operatorValue instanceof eZPackage) {
                 if (!is_array($fileList = $operatorValue->fileList('default'))) {
                     $fileList = array();
                 }
                 foreach ($fileList as $file) {
                     $fileType = $file["type"];
                     if ($fileType == 'thumbnail') {
                         $operatorValue = $operatorValue->fileItemPath($file, 'default');
                         return;
                     }
                 }
                 $operatorValue = false;
             }
             break;
         case 'filepath':
             if ($operatorValue instanceof eZPackage) {
                 $variableName = $namedParameters['data'];
                 $fileList = $operatorValue->fileList('default');
                 foreach ($fileList as $file) {
                     $fileIdentifier = $file["variable-name"];
                     if ($fileIdentifier == $variableName) {
                         $operatorValue = $operatorValue->fileItemPath($file, 'default');
                         return;
                     }
                 }
                 $tpl->error($operatorName, "No filepath found for variable {$variableName} in package " . $package->attribute('name'));
                 $operatorValue = false;
             }
             break;
         case 'fileitempath':
             if ($operatorValue instanceof eZPackage) {
                 $fileItem = $namedParameters['data'];
                 $operatorValue = $operatorValue->fileItemPath($fileItem, 'default');
             }
             break;
         case 'documentpath':
             if ($package instanceof eZPackage) {
                 $documentName = $namedParameters['data'];
                 $documentList = $package->attribute('documents');
                 foreach (array_keys($documentList) as $key) {
                     $document =& $documentList[$key];
                     $name = $document["name"];
                     if ($name == $documentName) {
                         $documentFilePath = $package->path() . '/' . eZPackage::documentDirectory() . '/' . $document['name'];
                         $operatorValue = $documentFilePath;
                         return;
                     }
                 }
                 $tpl->error($operatorName, "No documentpath found for document {$documentName} in package " . $package->attribute('name'));
                 $operatorValue = false;
             }
             break;
         case 'dirpath':
             $dirPath = $operatorValue->currentRepositoryPath() . "/" . $operatorValue->attribute('name');
             $operatorValue = $dirPath;
             break;
         default:
             $tpl->error($operatorName, "Unknown package operator name: '{$class}'");
             break;
     }
 }
Exemplo n.º 19
0
                 $package->exportToArchive($exportDirectory . eZSys::fileSeparator() . $package->exportName());
                 $cli->output("Package " . $cli->stylize('symbol', $package->attribute('name')) . " exported to directory " . $cli->stylize('dir', $exportDirectory));
             }
         } else {
             $exportPath = $package->exportToArchive($package->exportName());
             $cli->output("Package " . $cli->stylize('symbol', $package->attribute('name')) . " exported to file " . $cli->stylize('file', $exportPath));
         }
     } else {
         $cli->error("Could not locate package " . $cli->stylize('emphasize', $commandItem['name']));
     }
 } else {
     if ($command == 'create') {
         if ($alreadyCreated) {
             $cli->output();
         }
         $package = eZPackage::create($commandItem['name'], array('summary' => $commandItem['summary']), false, $repositoryID);
         $user = eZUser::currentUser();
         $userObject = $user->attribute('contentobject');
         $commandItem['licence'] = 'GPL';
         if (!in_array($commandItem['installtype'], array('install', 'import'))) {
             $commandItem['installtype'] = 'install';
         }
         if (!$commandItem['version']) {
             $commandItem['version'] = '1.0';
         }
         $package->setRelease($commandItem['version'], '1', false, $commandItem['licence'], 'alpha');
         $package->setAttribute('install_type', $commandItem['installtype']);
         if ($userObject) {
             $package->appendMaintainer($userObject->attribute('name'), $user->attribute('email'), 'lead');
         }
         eZPackageCreationHandler::appendLicence($package);
Exemplo n.º 20
0
$module = $Params['Module'];
$offset = (int) $Params['Offset'];
$repositoryID = 'local';
if ($Params['RepositoryID']) {
    $repositoryID = $Params['RepositoryID'];
}
if ($module->isCurrentAction('InstallPackage')) {
    return $module->redirectToView('upload');
}
$removeList = array();
if ($module->isCurrentAction('RemovePackage') or $module->isCurrentAction('ConfirmRemovePackage')) {
    if ($module->hasActionParameter('PackageSelection')) {
        $removeConfirmation = $module->isCurrentAction('ConfirmRemovePackage');
        $packageSelection = $module->actionParameter('PackageSelection');
        foreach ($packageSelection as $packageID) {
            $package = eZPackage::fetch($packageID);
            if ($package) {
                if ($removeConfirmation) {
                    $package->remove();
                } else {
                    $removeList[] = $package;
                }
            }
        }
        if ($removeConfirmation) {
            return $module->redirectToView('list');
        }
    }
}
if ($module->isCurrentAction('ChangeRepository')) {
    $repositoryID = $module->actionParameter('RepositoryID');
Exemplo n.º 21
0
/**************************************************************
* do the work                                                 *
***************************************************************/
if (downloadPackages($packageList, $packageURL, $packageDir, $packageRepository)) {
    if (file_exists(installScriptDir($packageRepository))) {
        //
        // Prepare siteaccesses access info.
        //
        $locales = eZContentLanguage::fetchLocaleList();
        $primaryLanguage = eZContentLanguage::topPriorityLanguage();
        $siteINI = eZINI::instance();
        $matchOrder = $siteINI->variableArray('SiteAccessSettings', 'MatchOrder');
        $accessType = $matchOrder[0];
        $accessTypeValue = 'ezwebin_site';
        $adminAccessTypeValue = 'ezwebin_site_admin';
        $package = eZPackage::fetch('ezwebin_site');
        if ($accessType == 'port') {
            $portAccessList = $siteINI->group('PortAccessSettings');
            $usedPorts = array_keys($portAccessList);
            foreach ($portAccessList as $port => $siteaccess) {
                if ($siteaccess == $userSiteaccess) {
                    while (in_array($port, $usedPorts)) {
                        // $port is used => get next port
                        ++$port;
                    }
                    $accessTypeValue = $port;
                    $usedPorts[] = $port;
                } else {
                    if ($siteaccess == $adminSiteaccess) {
                        while (in_array($port, $usedPorts)) {
                            // $port is used => get next port
Exemplo n.º 22
0
    function loadDBContentFromFile( eZPackage $package, $extensionName )
    {
        $db = eZDB::instance();

        $sqlFile = 'democontent.sql';
        $path = $package->path() . '/ezextension/' . $extensionName . '/sql/common';
        $res = $db->insertFile( $path, $sqlFile, false );

        if ( ! $res )
        {
            eZDebug::writeError( 'Can\'t initialize ' . $extensionName . ' demo data.', __METHOD__ );

            return false;
        }

        return true;
    }
 function initializePackage($siteType, &$accessMap, $charset, &$extraLanguageCodes, &$allLanguages, &$primaryLanguage, &$admin, &$resultArray)
 {
     // Time limit #3:
     // We set the time limit to 5 minutes to ensure we have enough time
     // to initialize the site. However we only set if the current limit
     // is too small
     $maxTime = ini_get('max_execution_time');
     if ($maxTime != 0 and $maxTime < 5 * 60) {
         @set_time_limit(5 * 60);
     }
     switch ($siteType['access_type']) {
         case 'port':
             $userSiteaccessName = $siteType['identifier'] . '_' . 'user';
             $adminSiteaccessName = $siteType['identifier'] . '_' . 'admin';
             $accessMap['port'][$siteType['access_type_value']] = $userSiteaccessName;
             $accessMap['port'][$siteType['admin_access_type_value']] = $adminSiteaccessName;
             break;
         case 'hostname':
             $userSiteaccessName = $siteType['identifier'] . '_' . 'user';
             $adminSiteaccessName = $siteType['identifier'] . '_' . 'admin';
             $accessMap['hostname'][$siteType['access_type_value']] = $userSiteaccessName;
             $accessMap['hostname'][$siteType['admin_access_type_value']] = $adminSiteaccessName;
             break;
         case 'url':
         default:
             $userSiteaccessName = $siteType['access_type_value'];
             $adminSiteaccessName = $siteType['admin_access_type_value'];
             $accessMap['url'][$siteType['access_type_value']] = $userSiteaccessName;
             $accessMap['url'][$siteType['admin_access_type_value']] = $adminSiteaccessName;
             break;
     }
     $accessMap['accesses'][] = $userSiteaccessName;
     $accessMap['accesses'][] = $adminSiteaccessName;
     $accessMap['sites'][] = $userSiteaccessName;
     $userDesignName = $siteType['identifier'];
     $languageObjects = $allLanguages;
     $databaseMap = eZSetupDatabaseMap();
     $databaseInfo = $this->PersistenceList['database_info'];
     $databaseInfo['info'] = $databaseMap[$databaseInfo['type']];
     $dbServer = $databaseInfo['server'];
     $dbPort = $databaseInfo['port'];
     //        $dbName = $databaseInfo['dbname'];
     $dbSocket = $databaseInfo['socket'];
     $dbUser = $databaseInfo['user'];
     $dbPwd = $databaseInfo['password'];
     $dbCharset = $charset;
     $dbDriver = $databaseInfo['info']['driver'];
     $dbName = $siteType['database'];
     $dbParameters = array('server' => $dbServer, 'port' => $dbPort, 'user' => $dbUser, 'password' => $dbPwd, 'socket' => $dbSocket, 'database' => $dbName, 'charset' => $dbCharset);
     $db = eZDB::instance($dbDriver, $dbParameters, true);
     if (!$db->isConnected()) {
         $resultArray['errors'][] = array('code' => 'EZSW-005', 'text' => "Failed connecting to database {$dbName}\n" . $db->errorMessage());
         return false;
     }
     eZDB::setInstance($db);
     $result = true;
     // Initialize the database by inserting schema and data
     if (!isset($siteType['existing_database'])) {
         $siteType['existing_database'] = false;
     }
     if ($siteType['existing_database'] == eZStepInstaller::DB_DATA_REMOVE) {
         eZDBTool::cleanup($db);
     }
     if ($siteType['existing_database'] != eZStepInstaller::DB_DATA_KEEP) {
         $result = true;
         $schemaArray = eZDbSchema::read('share/db_schema.dba', true);
         if (!$schemaArray) {
             $resultArray['errors'][] = array('code' => 'EZSW-001', 'message' => "Failed loading database schema file share/db_schema.dba");
             $result = false;
         }
         if ($result) {
             $result = true;
             $dataArray = eZDbSchema::read('share/db_data.dba', true);
             if (!$dataArray) {
                 $resultArray['errors'][] = array('code' => 'EZSW-002', 'text' => "Failed loading database data file share/db_data.dba");
                 $result = false;
             }
             if ($result) {
                 $schemaArray = array_merge($schemaArray, $dataArray);
                 $schemaArray['type'] = strtolower($db->databaseName());
                 $schemaArray['instance'] = $db;
                 $result = true;
                 $dbSchema = eZDbSchema::instance($schemaArray);
                 if (!$dbSchema) {
                     $resultArray['errors'][] = array('code' => 'EZSW-003', 'text' => "Failed loading " . $db->databaseName() . " schema handler");
                     $result = false;
                 }
                 if ($result) {
                     $result = true;
                     // This will insert the schema, then the data and
                     // run any sequence value correction SQL if required
                     $params = array('schema' => true, 'data' => true);
                     if ($db->databaseName() == 'mysql') {
                         $engines = $db->arrayQuery('SHOW ENGINES');
                         foreach ($engines as $engine) {
                             if ($engine['Engine'] == 'InnoDB' && in_array($engine['Support'], array('YES', 'DEFAULT'))) {
                                 $params['table_type'] = 'innodb';
                                 break;
                             }
                         }
                     }
                     if (!$dbSchema->insertSchema($params)) {
                         $resultArray['errors'][] = array('code' => 'EZSW-004', 'text' => "Failed inserting data to " . $db->databaseName() . "\n" . $db->errorMessage());
                         $result = false;
                     }
                 }
             }
         }
         if ($result) {
             // Inserting data from the dba-data files of the datatypes
             eZDataType::loadAndRegisterAllTypes();
             $registeredDataTypes = eZDataType::registeredDataTypes();
             foreach ($registeredDataTypes as $dataType) {
                 if (!$dataType->importDBDataFromDBAFile()) {
                     $resultArray['errors'][] = array('code' => 'EZSW-002', 'text' => "Failed importing datatype related data into database: \n" . 'datatype - ' . $dataType->DataTypeString . ", \n" . 'dba-data file - ' . $dataType->getDBAFilePath());
                 }
             }
         }
     }
     if (!$result) {
         return false;
     }
     // Database initialization done
     // Prepare languages
     $primaryLanguageLocaleCode = $primaryLanguage->localeCode();
     $primaryLanguageName = $primaryLanguage->languageName();
     $prioritizedLanguages = array_merge(array($primaryLanguageLocaleCode), $extraLanguageCodes);
     $installParameters = array('path' => '.');
     $installParameters['ini'] = array();
     $siteINIChanges = array();
     $url = $siteType['url'];
     if (preg_match("#^[a-zA-Z0-9]+://(.*)\$#", $url, $matches)) {
         $url = $matches[1];
     }
     $siteINIChanges['SiteAccessSettings'] = array('RelatedSiteAccessList' => $accessMap['accesses']);
     $siteINIChanges['ContentSettings'] = array('TranslationList' => implode(';', $extraLanguageCodes));
     $siteINIChanges['SiteSettings'] = array('SiteName' => $siteType['title'], 'SiteURL' => $url);
     $siteINIChanges['DatabaseSettings'] = array('DatabaseImplementation' => $dbDriver, 'Server' => $dbServer, 'Port' => $dbPort, 'Database' => $dbName, 'User' => $dbUser, 'Password' => $dbPwd, 'Charset' => false);
     $siteINIChanges['FileSettings'] = array('VarDir' => 'var/' . $siteType['identifier']);
     if (trim($dbSocket) != '') {
         $siteINIChanges['DatabaseSettings']['Socket'] = $dbSocket;
     } else {
         $siteINIChanges['DatabaseSettings']['Socket'] = 'disabled';
     }
     if ($admin['email']) {
         $siteINIChanges['InformationCollectionSettings'] = array('EmailReceiver' => false);
         $siteINIChanges['UserSettings'] = array('RegistrationEmail' => false);
         $siteINIChanges['MailSettings'] = array('AdminEmail' => $admin['email'], 'EmailSender' => false);
     }
     $siteINIChanges['RegionalSettings'] = array('Locale' => $primaryLanguage->localeFullCode(), 'ContentObjectLocale' => $primaryLanguage->localeCode(), 'SiteLanguageList' => $prioritizedLanguages);
     if ($primaryLanguage->localeCode() == 'eng-GB') {
         $siteINIChanges['RegionalSettings']['TextTranslation'] = 'disabled';
     } else {
         $siteINIChanges['RegionalSettings']['TextTranslation'] = 'enabled';
     }
     $installParameters['ini']['siteaccess'][$adminSiteaccessName]['site.ini.append'] = $siteINIChanges;
     $installParameters['ini']['siteaccess'][$userSiteaccessName]['site.ini.append'] = $siteINIChanges;
     $installParameters['ini']['siteaccess'][$userSiteaccessName]['site.ini']['DesignSettings'] = array('SiteDesign' => $userDesignName);
     $installParameters['variables']['user_siteaccess'] = $userSiteaccessName;
     $installParameters['variables']['admin_siteaccess'] = $adminSiteaccessName;
     $installParameters['variables']['design'] = $userDesignName;
     $tmpSiteINI = eZINI::create('site.ini');
     // Set ReadOnlySettingsCheck to false: towards
     // Ignore site.ini[eZINISettings].ReadonlySettingList[] settings when saving ini variables.
     $tmpSiteINI->setReadOnlySettingsCheck(false);
     $tmpSiteINI->setVariable('FileSettings', 'VarDir', $siteINIChanges['FileSettings']['VarDir']);
     // Change the current translation variables, before other parts start using them
     $tmpSiteINI->setVariable('RegionalSettings', 'Locale', $siteINIChanges['RegionalSettings']['Locale']);
     $tmpSiteINI->setVariable('RegionalSettings', 'ContentObjectLocale', $siteINIChanges['RegionalSettings']['ContentObjectLocale']);
     $tmpSiteINI->setVariable('RegionalSettings', 'TextTranslation', $siteINIChanges['RegionalSettings']['TextTranslation']);
     $tmpSiteINI->save(false, '.append.php', false, true, "settings/siteaccess/{$userSiteaccessName}");
     /*
     $typeFunctionality = eZSetupFunctionality( $siteType['identifier'] );
     $extraFunctionality = array_merge( isset( $this->PersistenceList['additional_packages'] ) ?
                                        $this->PersistenceList['additional_packages'] :
                                        array(),
                                        $typeFunctionality['required'] );
     $extraFunctionality = array_unique( $extraFunctionality );
     */
     // Add a policy to permit editors using OE
     eZPolicy::createNew(3, array('ModuleName' => 'ezoe', 'FunctionName' => '*'));
     // Install site package and it's required packages
     $sitePackageName = $this->chosenSitePackage();
     $sitePackage = eZPackage::fetch($sitePackageName);
     if (!is_object($sitePackage)) {
         $resultArray['errors'][] = array('code' => 'EZSW-041', 'text' => " Could not fetch site package: '{$sitePackageName}'");
         return false;
     }
     $dependecies = $sitePackage->attribute('dependencies');
     $requires = $dependecies['requires'];
     $requiredPackages = array();
     // Include setting files
     $settingsFiles = $sitePackage->attribute('settings-files');
     foreach ($settingsFiles as $settingsFileName) {
         if (file_exists($sitePackage->path() . '/settings/' . $settingsFileName)) {
             include_once $sitePackage->path() . '/settings/' . $settingsFileName;
         }
     }
     // Call user function for additional setup tasks.
     if (function_exists('eZSitePreInstall')) {
         eZSitePreInstall($siteType);
     }
     // Make sure objects use the selected main language instead of eng-GB
     if ($primaryLanguageLocaleCode != 'eng-GB') {
         $engLanguageObj = eZContentLanguage::fetchByLocale('eng-GB');
         $engLanguageID = (int) $engLanguageObj->attribute('id');
         $updateSql = "UPDATE ezcontent_language\nSET\nlocale='{$primaryLanguageLocaleCode}',\nname='{$primaryLanguageName}'\nWHERE\nid={$engLanguageID}";
         $db->query($updateSql);
         eZContentLanguage::expireCache();
         $primaryLanguageObj = eZContentLanguage::fetchByLocale($primaryLanguageLocaleCode);
         // Add it if it is missing (most likely)
         if (!$primaryLanguageObj) {
             $primaryLanguageObj = eZContentLanguage::addLanguage($primaryLanguageLocaleCode, $primaryLanguageName);
         }
         $primaryLanguageID = (int) $primaryLanguageObj->attribute('id');
         // Find objects which are always available
         if ($db->databaseName() == 'oracle') {
             $sql = "SELECT id\nFROM\nezcontentobject\nWHERE\nbitand( language_mask, 1 ) = 1";
         } else {
             $sql = "SELECT id\nFROM\nezcontentobject\nWHERE\nlanguage_mask & 1 = 1";
         }
         $objectList = array();
         $list = $db->arrayQuery($sql);
         foreach ($list as $row) {
             $objectList[] = (int) $row['id'];
         }
         $inSql = 'IN ( ' . implode(', ', $objectList) . ')';
         // Updates databases that have eng-GB data to the new locale.
         $updateSql = "UPDATE ezcontentobject_name\nSET\ncontent_translation='{$primaryLanguageLocaleCode}',\nreal_translation='{$primaryLanguageLocaleCode}',\nlanguage_id={$primaryLanguageID}\nWHERE\ncontent_translation='eng-GB' OR\nreal_translation='eng-GB'";
         $db->query($updateSql);
         // Fix always available
         $updateSql = "UPDATE ezcontentobject_name\nSET\nlanguage_id=language_id+1\nWHERE\ncontentobject_id {$inSql}";
         $db->query($updateSql);
         // attributes
         $updateSql = "UPDATE ezcontentobject_attribute\nSET\nlanguage_code='{$primaryLanguageLocaleCode}',\nlanguage_id={$primaryLanguageID}\nWHERE\nlanguage_code='eng-GB'";
         $db->query($updateSql);
         // Fix always available
         $updateSql = "UPDATE ezcontentobject_attribute\nSET\nlanguage_id=language_id+1\nWHERE\ncontentobject_id {$inSql}";
         $db->query($updateSql);
         // version
         $updateSql = "UPDATE ezcontentobject_version\nSET\ninitial_language_id={$primaryLanguageID},\nlanguage_mask={$primaryLanguageID}\nWHERE\ninitial_language_id={$engLanguageID}";
         $db->query($updateSql);
         // Fix always available
         $updateSql = "UPDATE ezcontentobject_version\nSET\nlanguage_mask=language_mask+1\nWHERE\ncontentobject_id {$inSql}";
         $db->query($updateSql);
         // object
         $updateSql = "UPDATE ezcontentobject\nSET\ninitial_language_id={$primaryLanguageID},\nlanguage_mask={$primaryLanguageID}\nWHERE\ninitial_language_id={$engLanguageID}";
         $db->query($updateSql);
         // Fix always available
         $updateSql = "UPDATE ezcontentobject\nSET\nlanguage_mask=language_mask+1\nWHERE\nid {$inSql}";
         $db->query($updateSql);
         // content object state groups & states
         $mask = $primaryLanguageID | 1;
         $db->query("UPDATE ezcobj_state_group\n                         SET language_mask = {$mask}, default_language_id = {$primaryLanguageID}\n                         WHERE default_language_id = {$engLanguageID}");
         $db->query("UPDATE ezcobj_state\n                         SET language_mask = {$mask}, default_language_id = {$primaryLanguageID}\n                         WHERE default_language_id = {$engLanguageID}");
         $db->query("UPDATE ezcobj_state_group_language\n                         SET language_id = {$primaryLanguageID}\n                         WHERE language_id = {$engLanguageID}");
         $db->query("UPDATE ezcobj_state_language\n                         SET language_id = {$primaryLanguageID}\n                         WHERE language_id = {$engLanguageID}");
         // ezcontentclass_name
         $updateSql = "UPDATE ezcontentclass_name\nSET\nlanguage_locale='{$primaryLanguageLocaleCode}'\nWHERE\nlanguage_locale='eng-GB'";
         $db->query($updateSql);
         // use high-level api, because it's impossible to update serialized names with direct sqls.
         // use direct access to 'NameList' to avoid unnecessary sql-requests and because
         // we do 'replacement' of existing language(with some 'id') with another language code.
         $contentClassList = eZContentClass::fetchList();
         foreach ($contentClassList as $contentClass) {
             $classAttributes = $contentClass->fetchAttributes();
             foreach ($classAttributes as $classAttribute) {
                 $classAttribute->NameList->setName($classAttribute->NameList->name('eng-GB'), $primaryLanguageLocaleCode);
                 $classAttribute->NameList->setAlwaysAvailableLanguage($primaryLanguageLocaleCode);
                 $classAttribute->NameList->removeName('eng-GB');
                 $classAttribute->store();
             }
             $contentClass->NameList->setName($contentClass->NameList->name('eng-GB'), $primaryLanguageLocaleCode);
             $contentClass->NameList->setAlwaysAvailableLanguage($primaryLanguageLocaleCode);
             $contentClass->NameList->removeName('eng-GB');
             $contentClass->NameList->setHasDirtyData(false);
             // to not update 'ezcontentclass_name', because we've already updated it.
             $contentClass->store();
         }
     }
     // Setup all languages
     foreach ($allLanguages as $languageObject) {
         $primaryLanguageObj = eZContentLanguage::fetchByLocale($languageObject->localeCode());
         // Add it if it is missing (most likely)
         if (!$primaryLanguageObj) {
             $primaryLanguageObj = eZContentLanguage::addLanguage($languageObject->localeCode(), $languageObject->internationalLanguageName());
         }
     }
     eZContentLanguage::expireCache();
     // Make sure priority list is changed to the new chosen languages
     eZContentLanguage::setPrioritizedLanguages($prioritizedLanguages);
     if ($siteType['existing_database'] != eZStepInstaller::DB_DATA_KEEP) {
         $user = eZUser::instance(14);
         // Must be initialized to make node assignments work correctly
         if (!is_object($user)) {
             $resultArray['errors'][] = array('code' => 'EZSW-020', 'text' => "Could not fetch administrator user object");
             return false;
         }
         // Make sure Admin is the currently logged in user
         // This makes sure all new/changed objects get this as creator
         $user->loginCurrent();
         // by default(if 'language_map' is not set) create all necessary languages
         $languageMap = isset($this->PersistenceList['package_info']) && isset($this->PersistenceList['package_info']['language_map']) ? $this->PersistenceList['package_info']['language_map'] : true;
         if (is_array($languageMap) && count($languageMap) > 0) {
             //
             // Create necessary languages and set them as "prioritized languages" to avoid
             // drawbacks in fetch functions, like eZContentObjectTreeNode::fetch().
             //
             $prioritizedLanguageObjects = eZContentLanguage::prioritizedLanguages();
             // returned objects
             foreach ($languageMap as $fromLanguage => $toLanguage) {
                 if ($toLanguage != 'skip') {
                     $prioritizedLanguageObjects[] = eZContentLanguage::fetchByLocale($toLanguage, true);
                 }
             }
             $prioritizedLanguageLocales = array();
             foreach ($prioritizedLanguageObjects as $language) {
                 $locale = $language->attribute('locale');
                 if (!in_array($locale, $prioritizedLanguageLocales)) {
                     $prioritizedLanguageLocales[] = $locale;
                 }
             }
             eZContentLanguage::setPrioritizedLanguages($prioritizedLanguageLocales);
         }
         foreach ($requires as $require) {
             if ($require['type'] != 'ezpackage') {
                 continue;
             }
             $packageName = $require['name'];
             $package = eZPackage::fetch($packageName, false, false, false);
             if (is_object($package)) {
                 $requiredPackages[] = $package;
                 if ($package->attribute('install_type') == 'install') {
                     $installParameters = array('use_dates_from_package' => true, 'site_access_map' => array('*' => $userSiteaccessName), 'top_nodes_map' => array('*' => 2), 'design_map' => array('*' => $userDesignName), 'language_map' => $languageMap, 'restore_dates' => true, 'user_id' => $user->attribute('contentobject_id'), 'non-interactive' => true);
                     $status = $package->install($installParameters);
                     if (!$status) {
                         $errorText = "Unable to install package '{$packageName}'";
                         if (isset($installParameters['error']['description'])) {
                             $errorText .= ": " . $installParameters['error']['description'];
                         }
                         $resultArray['errors'][] = array('code' => 'EZSW-051', 'text' => $errorText);
                         return false;
                     }
                 }
             } else {
                 $resultArray['errors'][] = array('code' => 'EZSW-050', 'text' => "Could not fetch required package: '{$packageName}'");
                 return false;
             }
             unset($package);
         }
     }
     $GLOBALS['eZContentObjectDefaultLanguage'] = $primaryLanguageLocaleCode;
     $nodeRemoteMap = array();
     $rows = $db->arrayQuery("SELECT node_id, remote_id FROM ezcontentobject_tree");
     foreach ($rows as $row) {
         $remoteID = $row['remote_id'];
         if (strlen(trim($remoteID)) > 0) {
             $nodeRemoteMap[$remoteID] = $row['node_id'];
         }
     }
     $objectRemoteMap = array();
     $rows = $db->arrayQuery("SELECT id, remote_id FROM ezcontentobject");
     foreach ($rows as $row) {
         $remoteID = $row['remote_id'];
         if (strlen(trim($remoteID)) > 0) {
             $objectRemoteMap[$remoteID] = $row['id'];
         }
     }
     $classRemoteMap = array();
     $rows = $db->arrayQuery("SELECT id, identifier, remote_id FROM ezcontentclass");
     foreach ($rows as $row) {
         $remoteID = $row['remote_id'];
         if (strlen(trim($remoteID)) > 0) {
             $classRemoteMap[$remoteID] = array('id' => $row['id'], 'identifier' => $row['identifier']);
         }
     }
     $siteCSS = false;
     $classesCSS = false;
     foreach ($requiredPackages as $package) {
         if ($package->attribute('type') == 'sitestyle') {
             $fileList = $package->fileList('default');
             foreach ($fileList as $file) {
                 $fileIdentifier = $file["variable-name"];
                 if ($fileIdentifier == 'sitecssfile') {
                     $siteCSS = $package->fileItemPath($file, 'default');
                 } else {
                     if ($fileIdentifier == 'classescssfile') {
                         $classesCSS = $package->fileItemPath($file, 'default');
                     }
                 }
             }
         }
     }
     $parameters = array('node_remote_map' => $nodeRemoteMap, 'object_remote_map' => $objectRemoteMap, 'class_remote_map' => $classRemoteMap, 'preview_design' => $userDesignName, 'design_list' => array($userDesignName, 'admin2', 'admin'), 'user_siteaccess' => $userSiteaccessName, 'admin_siteaccess' => $adminSiteaccessName, 'package_object' => $sitePackage, 'siteaccess_urls' => $this->siteaccessURLs(), 'access_map' => $accessMap, 'site_type' => $siteType, 'all_language_codes' => $prioritizedLanguages);
     $siteINIStored = false;
     $siteINIAdminStored = false;
     $designINIStored = false;
     if (function_exists('eZSiteINISettings')) {
         $extraSettings = eZSiteINISettings($parameters);
     } else {
         $extraSettings = array();
     }
     if (function_exists('eZSiteAdminINISettings')) {
         $extraAdminSettings = eZSiteAdminINISettings($parameters);
     } else {
         $extraAdminSettings = array();
     }
     if (function_exists('eZSiteCommonINISettings')) {
         $extraCommonSettings = eZSiteCommonINISettings($parameters);
     } else {
         $extraCommonSettings = array();
     }
     $isUntranslatedSettingAdded = false;
     foreach ($extraAdminSettings as $key => $extraAdminSetting) {
         if ($extraAdminSetting['name'] == 'site.ini') {
             $extraAdminSettings[$key]['settings']['RegionalSettings']['ShowUntranslatedObjects'] = 'enabled';
             $isUntranslatedSettingAdded = true;
             break;
         }
     }
     if (!$isUntranslatedSettingAdded) {
         $extraAdminSettings[] = array('name' => 'site.ini', 'settings' => array('RegionalSettings' => array('ShowUntranslatedObjects' => 'enabled')));
     }
     // Enable OE and ODF extensions by default
     $extensionsToEnable = array();
     // Included in "fat" install, needs to override $extraCommonSettings extensions
     $extensionsPrepended = array('ezjscore', 'ezoe', 'ezformtoken');
     foreach (array('ezie', 'ezodf', 'ezprestapiprovider', 'ezmultiupload', 'eztags', 'ezautosave', 'ez_network', 'ez_network_demo') as $extension) {
         if (file_exists("extension/{$extension}")) {
             $extensionsToEnable[] = $extension;
         }
     }
     $settingAdded = false;
     foreach ($extraCommonSettings as $key => $extraCommonSetting) {
         if ($extraCommonSetting['name'] == 'site.ini' && isset($extraCommonSettings[$key]['settings']['ExtensionSettings']['ActiveExtensions'])) {
             $settingAdded = true;
             $extraCommonSettings[$key]['settings']['ExtensionSettings']['ActiveExtensions'] = array_merge($extensionsPrepended, $extraCommonSettings[$key]['settings']['ExtensionSettings']['ActiveExtensions'], $extensionsToEnable);
             break;
         }
     }
     if (!$settingAdded) {
         $extraCommonSettings[] = array('name' => 'site.ini', 'settings' => array('ExtensionSettings' => array('ActiveExtensions' => array_merge($extensionsPrepended, $extensionsToEnable))));
     }
     // Enable dynamic tree menu for the admin interface by default
     $enableDynamicTreeMenuAdded = false;
     foreach ($extraAdminSettings as $key => $extraSetting) {
         if ($extraSetting['name'] == 'contentstructuremenu.ini') {
             if (isset($extraSetting['settings']['TreeMenu'])) {
                 $extraAdminSettings[$key]['settings']['TreeMenu']['Dynamic'] = 'enabled';
             } else {
                 $extraAdminSettings[$key]['settings'] = array('TreeMenu' => array('Dynamic' => 'enabled'));
             }
             $enableDynamicTreeMenuAdded = true;
             break;
         }
     }
     if (!$enableDynamicTreeMenuAdded) {
         $extraAdminSettings[] = array('name' => 'contentstructuremenu.ini', 'settings' => array('TreeMenu' => array('Dynamic' => 'enabled')));
     }
     $resultArray['common_settings'] = $extraCommonSettings;
     foreach ($extraSettings as $extraSetting) {
         if ($extraSetting === false) {
             continue;
         }
         $iniName = $extraSetting['name'];
         $settings = $extraSetting['settings'];
         $resetArray = false;
         if (isset($extraSetting['reset_arrays'])) {
             $resetArray = $extraSetting['reset_arrays'];
         }
         $tmpINI = eZINI::create($iniName);
         // Set ReadOnlySettingsCheck to false: towards
         // Ignore site.ini[eZINISettings].ReadonlySettingList[] settings when saving ini variables.
         $tmpINI->setReadOnlySettingsCheck(false);
         $tmpINI->setVariables($settings);
         if ($iniName == 'site.ini') {
             $siteINIStored = true;
             $tmpINI->setVariables($siteINIChanges);
             $tmpINI->setVariable('DesignSettings', 'SiteDesign', $userDesignName);
             $tmpINI->setVariable('DesignSettings', 'AdditionalSiteDesignList', array('base'));
         } else {
             if ($iniName == 'design.ini') {
                 if ($siteCSS) {
                     $tmpINI->setVariable('StylesheetSettings', 'SiteCSS', $siteCSS);
                 }
                 if ($classesCSS) {
                     $tmpINI->setVariable('StylesheetSettings', 'ClassesCSS', $classesCSS);
                 }
                 $designINIStored = true;
             }
         }
         $tmpINI->save(false, '.append.php', false, true, "settings/siteaccess/{$userSiteaccessName}", $resetArray);
         if ($siteType['existing_database'] != eZStepInstaller::DB_DATA_KEEP) {
             // setting up appropriate data in look&feel object
             $templateLookClass = eZContentClass::fetchByIdentifier('template_look', true);
             if ($templateLookClass) {
                 $objectList = $templateLookClass->objectList();
                 if ($objectList and count($objectList) > 0) {
                     $templateLookObject = current($objectList);
                     $dataMap = $templateLookObject->fetchDataMap();
                     if (isset($dataMap['title'])) {
                         $dataMap['title']->setAttribute('data_text', $siteINIChanges['SiteSettings']['SiteName']);
                         $dataMap['title']->store();
                     }
                     if (isset($dataMap['siteurl'])) {
                         $dataMap['siteurl']->setAttribute('data_text', $siteINIChanges['SiteSettings']['SiteURL']);
                         $dataMap['siteurl']->store();
                     }
                     if (isset($dataMap['email'])) {
                         $dataMap['email']->setAttribute('data_text', $siteINIChanges['MailSettings']['AdminEmail']);
                         $dataMap['email']->store();
                     }
                     $objectName = $templateLookClass->contentObjectName($templateLookObject);
                     $templateLookObject->setName($objectName);
                     $templateLookObject->store();
                 }
             }
         }
     }
     foreach ($extraAdminSettings as $extraSetting) {
         if ($extraSetting === false) {
             continue;
         }
         $iniName = $extraSetting['name'];
         $settings = $extraSetting['settings'];
         $resetArray = false;
         if (isset($extraSetting['reset_arrays'])) {
             $resetArray = $extraSetting['reset_arrays'];
         }
         $tmpINI = eZINI::create($iniName);
         $tmpINI->setVariables($settings);
         if ($iniName == 'site.ini') {
             $siteINIAdminStored = true;
             $tmpINI->setVariables($siteINIChanges);
             $tmpINI->setVariable('SiteAccessSettings', 'RequireUserLogin', 'true');
             $tmpINI->setVariable('DesignSettings', 'SiteDesign', 'admin2');
             $tmpINI->setVariable('DesignSettings', 'AdditionalSiteDesignList', array('admin'));
             $tmpINI->setVariable('SiteSettings', 'LoginPage', 'custom');
             $tmpINI->setVariable('SiteSettings', 'DefaultPage', 'content/dashboard');
         }
         $tmpINI->save(false, '.append.php', false, true, "settings/siteaccess/{$adminSiteaccessName}", $resetArray);
     }
     if (!$siteINIAdminStored) {
         $siteINI = eZINI::create('site.ini');
         // Set ReadOnlySettingsCheck to false: towards
         // Ignore site.ini[eZINISettings].ReadonlySettingList[] settings when saving ini variables.
         $siteINI->setReadOnlySettingsCheck(false);
         $siteINI->setVariables($siteINIChanges);
         $siteINI->setVariable('SiteAccessSettings', 'RequireUserLogin', 'true');
         $siteINI->setVariable('DesignSettings', 'SiteDesign', 'admin2');
         $tmpINI->setVariable('DesignSettings', 'AdditionalSiteDesignList', array('admin'));
         $siteINI->setVariable('SiteSettings', 'LoginPage', 'custom');
         $siteINI->setVariable('SiteSettings', 'DefaultPage', 'content/dashboard');
         $siteINI->save(false, '.append.php', false, false, "settings/siteaccess/{$adminSiteaccessName}", true);
     }
     if (!$siteINIStored) {
         $siteINI = eZINI::create('site.ini');
         // Set ReadOnlySettingsCheck to false: towards
         // Ignore site.ini[eZINISettings].ReadonlySettingList[] settings when saving ini variables.
         $siteINI->setReadOnlySettingsCheck(false);
         $siteINI->setVariables($siteINIChanges);
         $siteINI->setVariable('DesignSettings', 'SiteDesign', $userDesignName);
         $siteINI->setVariable('DesignSettings', 'AdditionalSiteDesignList', array('base'));
         $siteINI->save(false, '.append.php', false, true, "settings/siteaccess/{$userSiteaccessName}", true);
     }
     if (!$designINIStored) {
         $designINI = eZINI::create('design.ini');
         // Set ReadOnlySettingsCheck to false: towards
         // Ignore site.ini[eZINISettings].ReadonlySettingList[] settings when saving ini variables.
         $designINI->setReadOnlySettingsCheck(false);
         if ($siteCSS) {
             $designINI->setVariable('StylesheetSettings', 'SiteCSS', $siteCSS);
         }
         if ($classesCSS) {
             $designINI->setVariable('StylesheetSettings', 'ClassesCSS', $classesCSS);
         }
         $designINI->save(false, '.append.php', false, true, "settings/siteaccess/{$userSiteaccessName}");
     }
     eZDir::mkdir("design/" . $userDesignName);
     eZDir::mkdir("design/" . $userDesignName . "/templates");
     eZDir::mkdir("design/" . $userDesignName . "/stylesheets");
     eZDir::mkdir("design/" . $userDesignName . "/images");
     eZDir::mkdir("design/" . $userDesignName . "/override");
     eZDir::mkdir("design/" . $userDesignName . "/override/templates");
     if ($siteType['existing_database'] == eZStepInstaller::DB_DATA_KEEP) {
         return true;
     }
     // Try and remove user/login without limitation from the anonymous user
     $anonRole = eZRole::fetchByName('Anonymous');
     if (is_object($anonRole)) {
         $anonPolicies = $anonRole->policyList();
         foreach ($anonPolicies as $anonPolicy) {
             if ($anonPolicy->attribute('module_name') == 'user' and $anonPolicy->attribute('function_name') == 'login') {
                 $anonPolicy->removeThis();
                 break;
             }
         }
     }
     // Setup all roles according to site chosen and addons
     if (function_exists('eZSiteRoles')) {
         $extraRoles = eZSiteRoles($parameters);
         foreach ($extraRoles as $extraRole) {
             if (!$extraRole) {
                 continue;
             }
             $extraRoleName = $extraRole['name'];
             $role = eZRole::fetchByName($extraRoleName);
             if (!is_object($role)) {
                 $role = eZRole::create($extraRoleName);
                 $role->store();
             }
             $roleID = $role->attribute('id');
             if (isset($extraRole['policies'])) {
                 $extraPolicies = $extraRole['policies'];
                 foreach ($extraPolicies as $extraPolicy) {
                     if (isset($extraPolicy['limitation'])) {
                         $role->appendPolicy($extraPolicy['module'], $extraPolicy['function'], $extraPolicy['limitation']);
                     } else {
                         $role->appendPolicy($extraPolicy['module'], $extraPolicy['function']);
                     }
                 }
             }
             if (isset($extraRole['assignments'])) {
                 $roleAssignments = $extraRole['assignments'];
                 foreach ($roleAssignments as $roleAssignment) {
                     $assignmentIdentifier = false;
                     $assignmentValue = false;
                     if (isset($roleAssignment['limitation'])) {
                         $assignmentIdentifier = $roleAssignment['limitation']['identifier'];
                         $assignmentValue = $roleAssignment['limitation']['value'];
                     }
                     $role->assignToUser($roleAssignment['user_id'], $assignmentIdentifier, $assignmentValue);
                 }
             }
         }
     }
     // Setup user preferences based on the site chosen and addons
     if (function_exists('eZSitePreferences')) {
         $prefs = eZSitePreferences($parameters);
         foreach ($prefs as $prefEntry) {
             if (!$prefEntry) {
                 continue;
             }
             $prefUserID = $prefEntry['user_id'];
             foreach ($prefEntry['preferences'] as $pref) {
                 $prefName = $pref['name'];
                 $prefValue = $pref['value'];
                 if (!eZPreferences::setValue($prefName, $prefValue, $prefUserID)) {
                     $resultArray['errors'][] = array('code' => 'EZSW-070', 'text' => "Could not create ezpreference '{$prefValue}' for {$prefUserID}");
                     return false;
                 }
             }
         }
     }
     $publishAdmin = false;
     $userAccount = eZUser::fetch(14);
     if (!is_object($userAccount)) {
         $resultArray['errors'][] = array('code' => 'EZSW-020', 'text' => "Could not fetch administrator user object");
         return false;
     }
     $userObject = $userAccount->attribute('contentobject');
     if (!is_object($userObject)) {
         $resultArray['errors'][] = array('code' => 'EZSW-021', 'text' => "Could not fetch administrator content object");
         return false;
     }
     $newUserObject = $userObject->createNewVersion(false, false);
     if (!is_object($newUserObject)) {
         $resultArray['errors'][] = array('code' => 'EZSW-022', 'text' => "Could not create new version of administrator content object");
         return false;
     }
     $dataMap = $newUserObject->attribute('data_map');
     $error = false;
     if (trim($admin['email'])) {
         if (!isset($dataMap['user_account'])) {
             $resultArray['errors'][] = array('code' => 'EZSW-023', 'text' => "Administrator content object does not have a 'user_account' attribute");
             return false;
         }
         $userAccount->setInformation(14, 'admin', $admin['email'], $admin['password'], $admin['password']);
         $dataMap['user_account']->setContent($userAccount);
         $dataMap['user_account']->store();
         $publishAdmin = true;
         $userAccount->store();
     }
     if (trim($admin['first_name']) or trim($admin['last_name'])) {
         if (!isset($dataMap['first_name'])) {
             $resultArray['errors'][] = array('code' => 'EZSW-023', 'text' => "Administrator content object does not have a 'first_name' field");
             $error = true;
         }
         if (!isset($dataMap['last_name'])) {
             $resultArray['errors'][] = array('code' => 'EZSW-024', 'text' => "Administrator content object does not have a 'last_name' field");
             $error = true;
         }
         if ($error) {
             return false;
         }
         $dataMap['first_name']->setAttribute('data_text', $admin['first_name']);
         $dataMap['first_name']->store();
         $dataMap['last_name']->setAttribute('data_text', $admin['last_name']);
         $dataMap['last_name']->store();
         $newUserObject->store();
         $publishAdmin = true;
     }
     if ($publishAdmin) {
         $operationResult = eZOperationHandler::execute('content', 'publish', array('object_id' => $newUserObject->attribute('contentobject_id'), 'version' => $newUserObject->attribute('version')));
         if ($operationResult['status'] != eZModuleOperationInfo::STATUS_CONTINUE) {
             $resultArray['errors'][] = array('code' => 'EZSW-025', 'text' => "Failed to properly publish the administrator object");
             return false;
         }
     }
     // Call user function for additional setup tasks.
     if (function_exists('eZSitePostInstall')) {
         eZSitePostInstall($parameters);
     }
     // get all siteaccesses. do it via 'RelatedSiteAccessesList' settings.
     $adminSiteINI = eZINI::instance('site.ini' . '.append.php', "settings/siteaccess/{$adminSiteaccessName}");
     $relatedSiteAccessList = $adminSiteINI->variable('SiteAccessSettings', 'RelatedSiteAccessList');
     // Adding override for 'tiny_image' view for 'multi-option2' datatype
     foreach ($relatedSiteAccessList as $siteAccess) {
         $tmpOverrideINI = new eZINI('override.ini' . '.append.php', "settings/siteaccess/{$siteAccess}", null, null, null, true, true);
         $tmpOverrideINI->setVariable('tiny_image', 'Source', 'content/view/tiny.tpl');
         $tmpOverrideINI->setVariable('tiny_image', 'MatchFile', 'tiny_image.tpl');
         $tmpOverrideINI->setVariable('tiny_image', 'Subdir', 'templates');
         $tmpOverrideINI->setVariable('tiny_image', 'Match', array('class_identifier' => 'image'));
         $tmpOverrideINI->save();
     }
     $accessMap = $parameters['access_map'];
     // Call user function for some text which will be displayed at 'Finish' screen
     if (function_exists('eZSiteFinalText')) {
         $text = eZSiteFinalText($parameters);
         if (!isset($this->PersistenceList['final_text'])) {
             $this->PersistenceList['final_text'] = array();
         }
         $this->PersistenceList['final_text'][] = $text;
     }
     // ensure that evaluated policy wildcards in the user info cache
     // will be up to date with the currently activated modules
     eZCache::clearByID('user_info_cache');
     return true;
 }
Exemplo n.º 24
0
                                 }
                                 eZPackageCreationHandler::appendLicence($package);
                                 if ($userObject) {
                                     $package->appendChange($userObject->attribute('name'), $user->attribute('email'), 'Creation of package');
                                 }
                                 $package->store();
                                 $text = "Created package " . $cli->stylize('symbol', $commandItem['name']) . "-" . $cli->stylize('symbol', $commandItem['version']);
                                 if ($commandItem['summary']) {
                                     $text .= " " . $cli->stylize('archive', $commandItem['summary']);
                                 }
                                 $cli->output($text);
                                 $alreadyCreated = true;
                                 $createdPackages[$commandItem['name']] =& $package;
                             } else {
                                 if ($command == 'delete') {
                                     $package = eZPackage::fetch($commandItem['name']);
                                     if ($package) {
                                         $package->remove();
                                         $cli->output("Package " . $commandItem['name'] . " deleted.");
                                     } else {
                                         $cli->error("Could not open package " . $commandItem['name']);
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 25
0
 /**
  * @param string $sitePackageName
  * @return bool
  */
 function selectSiteType($sitePackageName)
 {
     $package = eZPackage::fetch($sitePackageName);
     if (!$package) {
         return false;
     }
     $this->PersistenceList['chosen_site_package']['0'] = $sitePackageName;
     $this->PersistenceList['site_extra_data_title'][$sitePackageName] = $package->attribute('summary');
     return true;
 }
Exemplo n.º 26
0
/**
 * @copyright Copyright (C) 1999-2012 eZ Systems AS. All rights reserved.
 * @license http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2
 * @version  2012.6
 * @package kernel
 */
$module = $Params['Module'];
$packageName = $Params['PackageName'];
$package = eZPackage::fetch($packageName);
if (!$package) {
    return $module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
}
if (!$package->attribute('can_export')) {
    return $module->handleError(eZError::KERNEL_ACCESS_DENIED, 'kernel');
}
$exportDirectory = eZPackage::temporaryExportPath();
$exportName = $package->exportName();
$exportPath = $exportDirectory . '/' . $exportName;
$exportPath = $package->exportToArchive($exportPath);
//return $module->redirectToView( 'view', array( 'full', $package->attribute( 'name' ) ) );
$fileName = $exportPath;
if ($fileName != "" and file_exists($fileName)) {
    clearstatcache();
    $fileSize = filesize($fileName);
    $mimeType = 'application/octet-stream';
    $originalFileName = $exportName;
    $contentLength = $fileSize;
    $fileOffset = false;
    $fileLength = false;
    if (isset($_SERVER['HTTP_RANGE'])) {
        $httpRange = trim($_SERVER['HTTP_RANGE']);
Exemplo n.º 27
0
 function insertDBFile($packageName, $extensionName, $loadContent = false)
 {
     $db = eZDB::instance();
     $extensionPackage = eZPackage::fetch($packageName, false, false, false);
     if ($extensionPackage instanceof eZPackage) {
         switch ($db->databaseName()) {
             case 'mysql':
                 $sqlFile = 'mysql.sql';
                 $path = $extensionPackage->path() . '/ezextension/' . $extensionName . '/sql/mysql';
                 break;
             case 'postgresql':
                 $sqlFile = 'postgresql.sql';
                 $path = $extensionPackage->path() . '/ezextension/' . $extensionName . '/sql/postgresql';
                 break;
         }
         $res = $db->insertFile($path, $sqlFile, false);
         if (!$res) {
             eZDebug::writeError('Can\'t initialize ' . $extensionName . ' database shema.', __METHOD__);
         }
         if ($res && $loadContent) {
             $sqlFile = 'democontent.sql';
             $path = $extensionPackage->path() . '/ezextension/' . $extensionName . '/sql/common';
             $res = $db->insertFile($path, $sqlFile, false);
             if (!$res) {
                 eZDebug::writeError('Can\'t initialize ' . $extensionName . ' demo data.', __METHOD__);
             }
         }
     }
 }
Exemplo n.º 28
0
        }
        $creator->generateStepMap($package, $persistentData);
    }
} else {
    if ($module->isCurrentAction('PackageStep')) {
        if ($module->hasActionParameter('CreatorItemID')) {
            $creatorID = $module->actionParameter('CreatorItemID');
            $creator = eZPackageCreationHandler::instance($creatorID);
            if ($http->hasSessionVariable('eZPackageCreatorData' . $creatorID)) {
                $persistentData = $http->sessionVariable('eZPackageCreatorData' . $creatorID);
            } else {
                $persistentData = array();
            }
            $package = false;
            if (isset($persistentData['package_name'])) {
                $package = eZPackage::fetch($persistentData['package_name']);
            }
            $creator->generateStepMap($package, $persistentData);
        }
    }
}
$tpl = eZTemplate::factory();
$templateName = 'design:package/create.tpl';
if ($creator) {
    $currentStepID = false;
    if ($module->hasActionParameter('CreatorStepID')) {
        $currentStepID = $module->actionParameter('CreatorStepID');
    }
    $steps =& $creator->stepMap();
    if (!isset($steps['map'][$currentStepID])) {
        $currentStepID = $steps['first']['id'];
Exemplo n.º 29
0
function installPackages($packageList, $params = array())
{
    global $cli;
    showMessage2("Installing...");
    // copy/paste from eZPackage
    if (!isset($params['path'])) {
        $params['path'] = false;
    }
    // process packages
    $action = false;
    while ((list(, $packageName) = each($packageList)) && $action != EZ_INSTALL_PACKAGE_EXTRA_ACTION_QUIT) {
        $action = false;
        $cli->output($cli->stylize('emphasize', "Installing package '{$packageName}'"), true);
        $package = eZPackage::fetch($packageName);
        if (!is_object($package)) {
            showError("can't fetch package '{$packageName}'. Aborting...");
        }
        // skip package which can not be installed(e.g. which can be imported only, like 'design' and 'site' types)
        if ($package->attribute('install_type') != 'install') {
            continue;
        }
        $packageType = $package->attribute('type');
        $packageItems = $package->installItemsList();
        while ((list(, $item) = each($packageItems)) && $action != EZ_INSTALL_PACKAGE_EXTRA_ACTION_QUIT && $action != EZ_INSTALL_PACKAGE_EXTRA_ACTION_SKIP_PACKAGE) {
            $itemInstalled = false;
            do {
                $action = false;
                $package->installItem($item, $params);
                if (isset($params['error']) && is_array($params['error']) && count($params['error']) > 0) {
                    global $autoMode;
                    if ($autoMode == 'on') {
                        switch ($packageType) {
                            case 'contentclass':
                                $action = 2;
                                break;
                            case 'extension':
                                $action = 1;
                                break;
                            default:
                                $action = handlePackageError($params['error']);
                                break;
                        }
                    } else {
                        $action = handlePackageError($params['error']);
                    }
                    $params['error']['choosen_action'] = $action;
                } else {
                    $itemInstalled = true;
                }
            } while (!$itemInstalled && $action != EZ_INSTALL_PACKAGE_EXTRA_ACTION_QUIT && $action != EZ_INSTALL_PACKAGE_EXTRA_ACTION_SKIP_PACKAGE);
        }
    }
}
Exemplo n.º 30
0
 /**
  * Fetches list of packages already available locally.
  *
  * \private
  */
 function fetchAvailablePackages($type = false)
 {
     $typeArray = array();
     if ($type) {
         $typeArray['type'] = $type;
     }
     $packageList = eZPackage::fetchPackages(array('db_available' => false), $typeArray);
     return $packageList;
 }