src/xPDO/Transport/xPDOTransportVehicle.php
protected function _compilePayload(& $transport) {
        parent :: _compilePayload($transport);
        $body = array ();
        $cacheManager = $transport->xpdo->getCacheManager();
        if ($cacheManager) {
            if (isset($this->payload['object'])) {
                $object = $this->payload['object'];
                $fileSource = $object['source'];
                $body['source'] = $transport->signature . '/' . str_replace('\\', '/', $this->payload['class']) . '/' . $this->payload['signature'] . '/';
                $fileTarget = $transport->path . $body['source'];
                $body['target'] = $object['target'];
                $fileName = isset ($object['name']) ? $object['name'] : basename($fileSource);
                $body['name'] = $fileName;
                if (!is_writable($fileTarget)) {
                    $cacheManager->writeTree($fileTarget);
                }
                if (file_exists($fileSource) && is_writable($fileTarget)) {
                    $copied = false;
                    if (is_file($fileSource)) {
                        $copied = $cacheManager->copyFile($fileSource, $fileTarget . $fileName);
                    }
                    if (!$copied) {
                        $transport->xpdo->log(xPDO::LOG_LEVEL_ERROR, "Could not copy file from {$fileSource} to {$fileTarget}{$fileName}");
                        $body = null;
                    }
                } else {
                    $transport->xpdo->log(xPDO::LOG_LEVEL_ERROR, "Source file {$fileSource} is missing or {$fileTarget} is not writable");
                    $body = null;
                }
            }
        }
        if (!empty($body)) {
            $this->payload['object'] = $body;
        }
    }
protected function _compilePayload(& $transport) {
        parent :: _compilePayload($transport);
        $body = array ();
        $cacheManager = $transport->xpdo->getCacheManager();
        if ($cacheManager) {
            if (isset($this->payload['object'])) {
                $object = $this->payload['object'];
                $fileSource = $object['source'];
                $body['source'] = $transport->signature . '/' . str_replace('\\', '/', $this->payload['class']) . '/' . $this->payload['signature'] . '/';
                $fileTarget = $transport->path . $body['source'];
                $body['target'] = $object['target'];
                $fileName = isset ($object['name']) ? $object['name'] : basename($fileSource);
                $body['name'] = $fileName;
                if (!is_writable($fileTarget)) {
                    $cacheManager->writeTree($fileTarget);
                }
                if (file_exists($fileSource) && is_writable($fileTarget)) {
                    $copied = false;
                    if (is_file($fileSource)) {
                        $copied = $cacheManager->copyFile($fileSource, $fileTarget . $fileName);
                    }
                    if (!$copied) {
                        $transport->xpdo->log(xPDO::LOG_LEVEL_ERROR, "Could not copy file from {$fileSource} to {$fileTarget}{$fileName}");
                        $body = null;
                    }
                } else {
                    $transport->xpdo->log(xPDO::LOG_LEVEL_ERROR, "Source file {$fileSource} is missing or {$fileTarget} is not writable");
                    $body = null;
                }
            }
        }
        if (!empty($body)) {
            $this->payload['object'] = $body;
        }
    }
protected function _compilePayload ( & $ transport ) { parent :: _compilePayload ( $ transport ) ; $ body = array ( ) ; $ cacheManager = $ transport -> xpdo -> getCacheManager ( ) ; if ( $ cacheManager ) { if ( isset ( $ this -> payload [ 'object' ] ) ) { $ object = $ this -> payload [ 'object' ] ; $ fileSource = $ object [ 'source' ] ; $ body [ 'source' ] = $ transport -> signature . '/' . str_replace ( '\\' , '/' , $ this -> payload [ 'class' ] ) . '/' . $ this -> payload [ 'signature' ] . '/' ; $ fileTarget = $ transport -> path . $ body [ 'source' ] ; $ body [ 'target' ] = $ object [ 'target' ] ; $ fileName = isset ( $ object [ 'name' ] ) ? $ object [ 'name' ] : basename ( $ fileSource ) ; $ body [ 'name' ] = $ fileName ; if ( ! is_writable ( $ fileTarget ) ) { $ cacheManager -> writeTree ( $ fileTarget ) ; } if ( file_exists ( $ fileSource ) && is_writable ( $ fileTarget ) ) { $ copied = false ; if ( is_file ( $ fileSource ) ) { $ copied = $ cacheManager -> copyFile ( $ fileSource , $ fileTarget . $ fileName ) ; } if ( ! $ copied ) { $ transport -> xpdo -> log ( xPDO :: LOG_LEVEL_ERROR , "Could not copy file from {$fileSource} to {$fileTarget}{$fileName}" ) ; $ body = null ; } } else { $ transport -> xpdo -> log ( xPDO :: LOG_LEVEL_ERROR , "Source file {$fileSource} is missing or {$fileTarget} is not writable" ) ; $ body = null ; } } } if ( ! empty ( $ body ) ) { $ this -> payload [ 'object' ] = $ body ; } }
Copies the transport into the vehicle and transforms the payload for storage.
Copies the transport into the vehicle and transforms the payload for storage .