Skip to content

Commit a29486c

Browse files
committed
Merge pull request #43 from faboo03/patch-1
Add relative option for PublishAssetsTask
2 parents d0f37a3 + 402ee95 commit a29486c

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

lib/task/plugin/sfPluginPublishAssetsTask.class.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ protected function configure()
3232
$this->addOptions(array(
3333
new sfCommandOption('core-only', '', sfCommandOption::PARAMETER_NONE, 'If set only core plugins will publish their assets'),
3434
));
35+
36+
$this->addOptions(array(
37+
new sfCommandOption('relative', '', sfCommandOption::PARAMETER_NONE, 'If set symlinks will be relative'),
38+
));
3539

3640
$this->namespace = 'plugin';
3741
$this->name = 'publish-assets';
@@ -79,7 +83,7 @@ protected function execute($arguments = array(), $options = array())
7983
$pluginConfiguration = $this->configuration->getPluginConfiguration($plugin);
8084

8185
$this->logSection('plugin', 'Configuring plugin - '.$plugin);
82-
$this->installPluginAssets($plugin, $pluginConfiguration->getRootDir());
86+
$this->installPluginAssets($plugin, $pluginConfiguration->getRootDir(), $options['relative']);
8387
}
8488
}
8589

@@ -89,13 +93,17 @@ protected function execute($arguments = array(), $options = array())
8993
* @param string $plugin The plugin name
9094
* @param string $dir The plugin directory
9195
*/
92-
protected function installPluginAssets($plugin, $dir)
96+
protected function installPluginAssets($plugin, $dir, $relative)
9397
{
9498
$webDir = $dir.DIRECTORY_SEPARATOR.'web';
9599

96100
if (is_dir($webDir))
97101
{
98-
$this->getFilesystem()->symlink($webDir, sfConfig::get('sf_web_dir').DIRECTORY_SEPARATOR.$plugin, true);
102+
if($relative) {
103+
$this->getFilesystem()->relativeSymlink($webDir, sfConfig::get('sf_web_dir').DIRECTORY_SEPARATOR.$plugin, true);
104+
} else {
105+
$this->getFilesystem()->symlink($webDir, sfConfig::get('sf_web_dir').DIRECTORY_SEPARATOR.$plugin, true);
106+
}
99107
}
100108
}
101109
}

0 commit comments

Comments
 (0)