$fileset = array (
'source' => MODX_BASE_PATH . 'connectors/index.php',
'target' => "return MODX_CONNECTORS_PATH;",
);
$attributes['resolve'][] = array (
'type' => 'php',
'source' => dirname(__FILE__) . '/resolvers/resolve.core.php',
'target' => "return MODX_CONNECTORS_PATH . 'config.core.php';",
);
$package->put($fileset, $attributes);I’m lost here; where is this function you are referring to. It’s not in xPDOVehicle...?
Does the file resolver $source in $vehicle->resolve(’file’, $source, $target) have to be a directory, or can it be an individual file?
It’s not necessary, but the particular resolver script here needs a target in the metadata to know where to put the file.
Also, I’m confused by this code in transport.core.php:
$fileset = array ( 'source' => MODX_BASE_PATH . 'connectors/index.php', 'target' => "return MODX_CONNECTORS_PATH;", ); $attributes['resolve'][] = array ( 'type' => 'php', 'source' => dirname(__FILE__) . '/resolvers/resolve.core.php', 'target' => "return MODX_CONNECTORS_PATH . 'config.core.php';", ); $package->put($fileset, $attributes);
I thought that the ’target’ was unnecessary (and ignored) in a php resolver.
I honestly don’t remember why I made this decision at the moment, but will post back when I do...
And I thought an xPDOFileVehicle was required to move files without a traditional vehicle containing an object. Why is this method used in this case and xPDOFileVehicle used in others?
I’m lost here; where is this function you are referring to. It’s not in xPDOVehicle...?
$vehicle->resolve($object['resolver_type'],array(
'type' => $object['resolver_type'],
'source' => $object['resolver_source'],
'target' => $object['resolver_target'],
));
I still can’t find the method you are referring to. xPDOVehicle->resolve() takes three parameters, & $transport, & $object, and $options = array(), and is called by the install() process anyway. You should never need to call it.
/**
* Adds a post-save resolver to the vehicle.
*
* @access public
* @param string $type The type of resolver (php,file,etc)
* @param array $options An array of options for the resolver.
* @return array The added resolver.
*/
function resolve($type, $options) {
$options['type'] = $type;
array_push($this->resolvers, $options);
return $options;
}
Hmm, I guess Shaun wrote that; looks the same as if you pass them as attributes in the first example you pasted in this thread: an absolute path to a resolver script for php types and an absolute path to a directory or file for file types.
$fv = new xPDOFileVehicle($type, $source, $target); $package->put($fv);