Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File resolve options #77

Open
wants to merge 1 commit into
base: 2.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions xpdo/transport/xpdofilevehicle.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,12 @@ protected function _compilePayload(& $transport) {
}
if (file_exists($fileSource) && is_writable($fileTarget)) {
$copied = false;
$options = isset($object[xPDOTransport::FILE_RESOLVE_OPTIONS]) ? $object[xPDOTransport::FILE_RESOLVE_OPTIONS] : array();
if (is_dir($fileSource)) {
$copied = $cacheManager->copyTree($fileSource, $fileTarget . $fileName);
$copied = $cacheManager->copyTree($fileSource, $fileTarget . $fileName, $options);
}
elseif (is_file($fileSource)) {
$copied = $cacheManager->copyFile($fileSource, $fileTarget . $fileName);
$copied = $cacheManager->copyFile($fileSource, $fileTarget . $fileName, $options);
}
if (!$copied) {
$transport->xpdo->log(xPDO::LOG_LEVEL_ERROR, "Could not copy file from {$fileSource} to {$fileTarget}{$fileName}");
Expand Down
1 change: 1 addition & 0 deletions xpdo/transport/xpdotransport.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class xPDOTransport {
const ABORT_INSTALL_ON_VEHICLE_FAIL = 'abort_install_on_vehicle_fail';
const PACKAGE_NAME = 'package_name';
const PACKAGE_VERSION = 'package_version';
const FILE_RESOLVE_OPTIONS = 'file_resolve_options';
/**
* Indicates how pre-existing objects are treated on install/uninstall.
* @var integer
Expand Down
9 changes: 7 additions & 2 deletions xpdo/transport/xpdovehicle.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ protected function _compilePayload(& $transport) {
$cacheManager = $transport->xpdo->getCacheManager();
if ($cacheManager) {
if (isset ($this->payload['resolve']) && is_array($this->payload['resolve'])) {
$fro = isset($this->payload[xPDOTransport::FILE_RESOLVE_OPTIONS]) ? $this->payload[xPDOTransport::FILE_RESOLVE_OPTIONS] : array();
foreach ($this->payload['resolve'] as $rKey => $r) {
$type = $r['type'];
$body = array ();
Expand All @@ -399,11 +400,15 @@ protected function _compilePayload(& $transport) {
}
if (file_exists($fileSource) && is_writable($fileTarget)) {
$copied = false;
$o = $fro;
if (isset($r[xPDOTransport::FILE_RESOLVE_OPTIONS])) {
$o = array_merge($fro, $r[xPDOTransport::FILE_RESOLVE_OPTIONS]);
}
if (is_dir($fileSource)) {
$copied = $cacheManager->copyTree($fileSource, $fileTarget . $fileName);
$copied = $cacheManager->copyTree($fileSource, $fileTarget . $fileName, $o);
}
elseif (is_file($fileSource)) {
$copied = $cacheManager->copyFile($fileSource, $fileTarget . $fileName);
$copied = $cacheManager->copyFile($fileSource, $fileTarget . $fileName, $o);
}
if (!$copied) {
$transport->xpdo->log(xPDO::LOG_LEVEL_ERROR, "Could not copy file from {$fileSource} to {$fileTarget}{$fileName}");
Expand Down