kernel/setup/steps/ezstep_site_types.php
function downloadAndImportPackage( $packageName, $packageUrl, $forceDownload = false )
    {
        $package = eZPackage::fetch( $packageName, false, false, false );

        if ( is_object( $package ) )
        {
            if ( $forceDownload )
            {
                $package->remove();
            }
            else
            {
                eZDebug::writeNotice( "Skipping download of package '$packageName': package already exists." );
                return $package;
            }
        }

        $archiveName = $this->downloadFile( $packageUrl, /* $outDir = */ eZStepSiteTypes::tempDir() );
        if ( $archiveName === false )
        {
            eZDebug::writeWarning( "Download of package '$packageName' from '$packageUrl' failed: $this->ErrorMsg" );
            $this->ErrorMsg = ezpI18n::tr( 'design/standard/setup/init',
                                      'Download of package \'%pkg\' failed. You may upload the package manually.',
                                      false, array( '%pkg' => $packageName ) );

            return false;
        }

        $package = eZPackage::import( $archiveName, $packageName, false );

        // Remove downloaded ezpkg file
        $ezFileHandler = new eZFileHandler();
        $ezFileHandler->unlink( $archiveName );

        if ( !$package instanceof eZPackage )
        {
            if ( $package == eZPackage::STATUS_INVALID_NAME )
            {
                eZDebug::writeNotice( "The package name $packageName is invalid" );
            }
            else
            {
                eZDebug::writeNotice( "Invalid package" );
            }

            $this->ErrorMsg = ezpI18n::tr( 'design/standard/setup/init', 'Invalid package' );
            return false;
        }

        return $package;
    }
function downloadAndImportPackage( $packageName, $packageUrl, $forceDownload = false )
    {
        $package = eZPackage::fetch( $packageName, false, false, false );

        if ( is_object( $package ) )
        {
            if ( $forceDownload )
            {
                $package->remove();
            }
            else
            {
                eZDebug::writeNotice( "Skipping download of package '$packageName': package already exists." );
                return $package;
            }
        }

        $archiveName = $this->downloadFile( $packageUrl, /* $outDir = */ eZStepSiteTypes::tempDir() );
        if ( $archiveName === false )
        {
            eZDebug::writeWarning( "Download of package '$packageName' from '$packageUrl' failed: $this->ErrorMsg" );
            $this->ErrorMsg = ezpI18n::tr( 'design/standard/setup/init',
                                      'Download of package \'%pkg\' failed. You may upload the package manually.',
                                      false, array( '%pkg' => $packageName ) );

            return false;
        }

        $package = eZPackage::import( $archiveName, $packageName, false );

        // Remove downloaded ezpkg file
        $ezFileHandler = new eZFileHandler();
        $ezFileHandler->unlink( $archiveName );

        if ( !$package instanceof eZPackage )
        {
            if ( $package == eZPackage::STATUS_INVALID_NAME )
            {
                eZDebug::writeNotice( "The package name $packageName is invalid" );
            }
            else
            {
                eZDebug::writeNotice( "Invalid package" );
            }

            $this->ErrorMsg = ezpI18n::tr( 'design/standard/setup/init', 'Invalid package' );
            return false;
        }

        return $package;
    }
function downloadAndImportPackage ( $ packageName , $ packageUrl , $ forceDownload = false ) { $ package = eZPackage :: fetch ( $ packageName , false , false , false ) ; if ( is_object ( $ package ) ) { if ( $ forceDownload ) { $ package -> remove ( ) ; } else { eZDebug :: writeNotice ( "Skipping download of package '$packageName': package already exists." ) ; return $ package ; } } $ archiveName = $ this -> downloadFile ( $ packageUrl , /* $outDir = */ eZStepSiteTypes :: tempDir ( ) ) ; if ( $ archiveName === false ) { eZDebug :: writeWarning ( "Download of package '$packageName' from '$packageUrl' failed: $this->ErrorMsg" ) ; $ this -> ErrorMsg = ezpI18n :: tr ( 'design/standard/setup/init' , 'Download of package \'%pkg\' failed. You may upload the package manually.' , false , array ( '%pkg' => $ packageName ) ) ; return false ; } $ package = eZPackage :: import ( $ archiveName , $ packageName , false ) ; // Remove downloaded ezpkg file $ ezFileHandler = new eZFileHandler ( ) ; $ ezFileHandler -> unlink ( $ archiveName ) ; if ( ! $ package instanceof eZPackage ) { if ( $ package == eZPackage :: STATUS_INVALID_NAME ) { eZDebug :: writeNotice ( "The package name $packageName is invalid" ) ; } else { eZDebug :: writeNotice ( "Invalid package" ) ; } $ this -> ErrorMsg = ezpI18n :: tr ( 'design/standard/setup/init' , 'Invalid package' ) ; return false ; } return $ package ; }
Downloads and imports package.

Sets $this->ErrorMsg in case of an error.

\param $forceDownload  download even if this package already exists.
\private
\return false on error, package object otherwise.
Downloads and imports package .