// Object is returned when a plugin could not be cached.
$bag = new serendipity_property_bag;
$plugin->introspect($bag);
- $props = serendipity_plugin_api::setPluginInfo($plugin, $pluginFile, $bag, $class_data);
+
+ // If a foreign plugin is upgradable, keep the new version number.
+ if (isset($foreignPlugins['pluginstack'][$class_data['name']]) && $foreignPlugins['pluginstack'][$class_data['name']]['upgradable']) {
+ $class_data['upgrade_version'] = $foreignPlugins['pluginstack'][$class_data['name']]['upgrade_version'];
+ }
+
+ $props = serendipity_plugin_api::setPluginInfo($plugin, $pluginFile, $bag, $class_data, 'local', $foreignPlugins);
+
$counter++;
} elseif (is_array($plugin)) {
// Array is returned if a plugin could be fetched from info cache
}
if (is_array($props)) {
+ if (version_compare($props['version'], $props['upgrade_version'], '<')) {
+ $props['upgradable'] = true;
+ $props['customURI'] .= $foreignPlugins['baseURI'] . $foreignPlugins['upgradeURI'];
+ }
+
$props['installable'] = !($props['stackable'] === false && in_array($class_data['true_name'], $plugins));
$props['requirements'] = unserialize($props['requirements']);
@define('PLUGIN_EVENT_SPARTACUS_CHOWN', 'Owner of downloaded files');
@define('PLUGIN_EVENT_SPARTACUS_CHOWN_DESC', 'Here you can enter the (FTP/Shell) owner (like "nobody") of files downloaded by Spartacus. If empty, no changes are made to the ownership.');
@define('PLUGIN_EVENT_SPARTACUS_CHMOD', 'Permissions downloaded files');
-@define('PLUGIN_EVENT_SPARTACUS_CHMOD_DESC', 'Here you can enter the octal mode (like "0777") of the file permissions for Spartacus files.(FTP/Shell) owner of files downloaded by Spartacus. If empty, the default permission mask of the system are used. Note that not all servers allow changing/setting permissions. Pay attention that the applied permissions allow reading and writing for the webserver user. Else spartacus/Serendipity cannot overwrite existing files.');
+@define('PLUGIN_EVENT_SPARTACUS_CHMOD_DESC', 'Here you can enter the octal mode (like "0777") of the file permissions for files (FTP/Shell) downloaded by Spartacus. If empty, the default permission mask of the system are used. Note that not all servers allow changing/setting permissions. Pay attention that the applied permissions allow reading and writing for the webserver user. Else spartacus/Serendipity cannot overwrite existing files.');
+@define('PLUGIN_EVENT_SPARTACUS_CHMOD_DIR', 'Permissions downloaded directories');
+@define('PLUGIN_EVENT_SPARTACUS_CHMOD_DIR_DESC', 'Here you can enter the octal mode (like "0777") of the directory permissions for directories (FTP/Shell) downloaded by Spartacus. If empty, the default permission mask of the system are used. Note that not all servers allow changing/setting permissions. Pay attention that the applied permissions allow reading and writing for the webserver user. Else spartacus/Serendipity cannot overwrite existing directories.');
class serendipity_event_spartacus extends serendipity_event
{
$propbag->add('description', PLUGIN_EVENT_SPARTACUS_DESC);
$propbag->add('stackable', false);
$propbag->add('author', 'Garvin Hicking');
- $propbag->add('version', '2.3');
+ $propbag->add('version', '2.4');
$propbag->add('requirements', array(
'serendipity' => '0.9',
'smarty' => '2.6.7',
'backend_templates_fetchtemplate' => true
));
$propbag->add('groups', array('BACKEND_FEATURES'));
- $propbag->add('configuration', array('mirror_xml', 'mirror_files', 'chown', 'chmod'));
+ $propbag->add('configuration', array('mirror_xml', 'mirror_files', 'chown', 'chmod_files', 'chmod_dir'));
}
function generate_content(&$title) {
global $serendipity;
switch($name) {
- case 'chmod':
+ case 'chmod_files':
$propbag->add('type', 'string');
$propbag->add('name', PLUGIN_EVENT_SPARTACUS_CHMOD);
$propbag->add('description', PLUGIN_EVENT_SPARTACUS_CHMOD_DESC);
$propbag->add('default', '');
break;
+ case 'chmod_dir':
+ $propbag->add('type', 'string');
+ $propbag->add('name', PLUGIN_EVENT_SPARTACUS_CHMOD_DIR);
+ $propbag->add('description', PLUGIN_EVENT_SPARTACUS_CHMOD_DIR_DESC);
+ $propbag->add('default', '');
+ break;
+
case 'chown':
$propbag->add('type', 'string');
$propbag->add('name', PLUGIN_EVENT_SPARTACUS_CHOWN);
// Apply file permission settings.
function fileperm($stack, $is_dir) {
- $chmod = octdec($this->get_config('chmod'));
- $chown = $this->get_config('chown');
+ $chmod_dir = intval($this->get_config('chmod_dir'), 8);
+ $chmod_files = intval($this->get_config('chmod_files'), 8);
+ $chown = $this->get_config('chown');
- if (!empty($chmod) && function_exists('chmod')) {
- @chmod($stack, $chmod);
- if ($is_dir) {
- @chmod($stack, 'ug+x'); // Always ensure directory traversal.
- }
+ if ($is_dir && !empty($chmod_dir) && function_exists('chmod')) {
+ @chmod($stack, $chmod_dir); // Always ensure directory traversal.
+ }
+
+ if (!$is_dir && !empty($chmod_files) && function_exists('chmod')) {
+ @chmod($stack, $chmod_files); // Always ensure directory traversal.
}
if (!empty($chown) && function_exists('chown')) {
$installable = false;
} elseif (version_compare($bag->get('version'), $data['version'], '<')) {
$data['upgradable'] = true;
- $data['upgrade_version'] = $pluginstack[$i]['version'];
+ $data['upgrade_version'] = $data['version'];
$data['version'] = $bag->get('version');
$upgradeLink = '&serendipity[spartacus_upgrade]=true';
}
$eventData = array(
'pluginstack' => $this->buildList($this->fetchOnline($type), $type),
- 'errorstack' => array()
+ 'errorstack' => array(),
+ 'upgradeURI' => '&serendipity[spartacus_upgrade]=true',
+ 'baseURI' => '&serendipity[spartacus_fetch]=' . $type
);
return true;