コード例 #1
0
function parseOptions(array $options)
{
    $parsedOptions = array();
    $parsedOptions['clusterIdentifier'] = isset($options['clusterIdentifier']) ? explode(',', $options['clusterIdentifier']) : ClusterTool::globCluster();
    $parsedOptions['path'] = isset($options['path']) ? $options['path'] : DEFAULT_BANNER_PATH;
    $parsedOptions['convertPath'] = isset($options['convertPath']) ? $options['convertPath'] : eZINI::instance('image.ini')->variable('ImageMagick', 'ExecutablePath');
    return $parsedOptions;
}
コード例 #2
0
function parseOptions(array $options)
{
    $parsedOptions = array();

    $existingClusters = ClusterTool::globCluster();
    if (empty($options['clusterIdentifier'])) {
        $parsedOptions['clusters'] = $existingClusters;
    } else {
        $clusterList = explode(',', $options['clusterIdentifier']);
        $clusterList = array_intersect($clusterList, $existingClusters);
        $parsedOptions['clusters'] = $clusterList;
    }
    return $parsedOptions;
}
コード例 #3
0
    /**
     * @param int $contentObjectId
     * @return boolean[]
     */
    public static function getClusterVisibilities($contentObjectId)
    {
        $clusters = ClusterTool::globCluster();
        $visibilities = array();

        foreach( $clusters as $cluster )
        {
            $visibilities[$cluster] = !ObjectVisibilityManager::isClusterLimited( $contentObjectId, $cluster );
        }

        return $visibilities;
    }
コード例 #4
0
<?php

/* @type $cli eZCli */
/* @type $script eZScript */

$clusters        = ClusterTool::globCluster();
$solrLimit       = 200;
$globalObjectIds = array();
$solrStart       = 0;
$orFilters       = array();
$filters         = array(
    'meta_installation_id_ms:' . eZSolr::installationID(),
    "meta_class_identifier_ms:article",
);
$rawSolrParams = array(
    'indent'        => 'on',
    'q'             => '',
    'fl'            => "meta_id_si",
    'rows'          => $solrLimit,
    'qt'            => 'ezpublish',
);

foreach ( $clusters as $cluster )
{
    $orFilters[] = "attr_{$cluster}_url_s:full/*";
}
$filters[] = "( " . implode(' OR ', $orFilters ) . " )";

$rawSolrParams['fq'] = implode(' AND ', $filters);

while (true)
コード例 #5
0
    'remove'              => 'Remove old files else copy. Use remove option in a second pass'
));

$remove = isset($options['remove']) && $options['remove'] == true;
$varDir = eZSys::varDirectory();
$newStaticDir = StaticData::directory();

$fileUtils = eZClusterFileHandler::instance( $path );
if( $fileUtils->requiresClusterizing() ) {
    $dfsBackend = new eZDFSFileHandlerDFSBackend();
    $mountPoint = $dfsBackend->getMountPoint();
    $varDir = eZDir::path(array($mountPoint, $varDir));
    $newStaticDir = eZDir::path(array($mountPoint, $newStaticDir));
}

$clusterList = ClusterTool::globCluster();
$oldStaticDir = eZDir::path(array($varDir, 'static-data'));

$applicationList = array();
$rows = ApplicationObject::fetchObjectList(ApplicationObject::definition(), array('identifier'), null, null, null, false);
foreach ($rows as $row) {
    $applicationList[] = $row['identifier'];
}
$applicationList = array_unique($applicationList);

$fileToRemove = array();

function moveIfNeeded($oldPath, $newPath) {
    global $fileToRemove;
    
    $success = true;
/**
 * @param eZMySQLiDB $db
 * @return array
 */
function getRelations( $db )
{
    $paths = array();
    $query = "SELECT
                pf.id AS pfid, pf.path AS path, al.cluster_identifier AS cluster
              FROM
                mm_application_has_publisher_folder AS ahpf
              LEFT JOIN
                mm_publisher_folder AS pf ON ahpf.publisher_folder_id = pf.id,
                mm_application_localized AS al
              WHERE
                ahpf.application_localized_id
              IN
                (SELECT id FROM mm_application_localized WHERE cluster_identifier IN ('" . implode( '\', \'', ClusterTool::globCluster() ) . "'))
              AND
                ahpf.application_localized_id = al.id
              ORDER BY
                cluster, pf.id";
    foreach ( $db->arrayQuery( sprintf( $query ) ) as $row )
        $paths[$row['cluster']][$row['pfid']] = $row['path'];

    return $paths;
}
コード例 #7
0
function parseClusterIdentifiers($clusterIdentifiersString, $sanitizeInput = true)
{
    $existingClusters = ClusterTool::globCluster();
    if (strlen($clusterIdentifiersString) == 0) {
       return $existingClusters;
    }
    $clusterIdentifiers = explode(',', $clusterIdentifiersString);
    if ($sanitizeInput) {
        $clusterIdentifiers = array_intersect($existingClusters, $clusterIdentifiers);
    }
    return $clusterIdentifiers;
}
コード例 #8
0
) ) );

// Use admin
$user   = eZUser::fetchByName( 'admin' );
$userID = $user->attribute( 'contentobject_id' );
eZUser::setCurrentlyLoggedInUser( $user, $userID );

$whereClause = "";

$query = "select f.id, f.path as path
        from mm_application_has_publisher_folder as h 
        left join mm_publisher_folder as f on h.publisher_folder_id = f.id
        %s
        order by f.id";

$availableClusters = ClusterTool::globCluster();

if ( isset($options['clusterIdentifier']) && in_array($options['clusterIdentifier'], $availableClusters) )
    $whereClause = " WHERE l.cluster_identifier='{$options['clusterIdentifier']}' ";

$db      = MMDB::instance();
$result  = $db->arrayQuery( sprintf($query, $whereClause) );
$folders = array();
$autoMode = isset($options['auto']);

foreach( $result as $row )
{
    $id      = $row['id'];
    $update  = is_array( eZContentObject::fetchByRemoteID( 'publisher_folder-' . $row['path'], false ) );

    if ( !$update )