mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 14:41:29 +01:00
* Add filemanager actions to convert editable files to PDF or PNG
This commit is contained in:
parent
f6828a8205
commit
2a4faf0137
@ -2440,17 +2440,9 @@ abstract class Merge
|
||||
$target = $_target = (Vfs::is_writable(Vfs::get_home_dir()) ?
|
||||
Vfs::get_home_dir() :
|
||||
"/home/{$GLOBALS['egw_info']['user']['account_lid']}"
|
||||
)."/$filename";
|
||||
$dupe_count = 0;
|
||||
while(is_file(Vfs::PREFIX.$target))
|
||||
{
|
||||
$dupe_count++;
|
||||
$target = Vfs::dirname($_target) . '/' .
|
||||
pathinfo($filename, PATHINFO_FILENAME) .
|
||||
' ('.($dupe_count + 1).')' . '.' .
|
||||
pathinfo($filename, PATHINFO_EXTENSION);
|
||||
}
|
||||
copy($result, Vfs::PREFIX.$target);
|
||||
) . "/$filename";
|
||||
$target = Vfs::make_unique($target);
|
||||
copy($result, Vfs::PREFIX . $target);
|
||||
unlink($result);
|
||||
|
||||
// Find out what to do with it
|
||||
|
@ -2386,6 +2386,27 @@ class Vfs extends Vfs\Base
|
||||
}
|
||||
return self::_call_on_backend('get_minimum_file_id', array($path));
|
||||
}
|
||||
|
||||
/**
|
||||
* Make sure the path is unique, by appending (#) to the filename if it already exists
|
||||
*
|
||||
* @param string $path
|
||||
*
|
||||
* @return string The same path, but modified if it exists
|
||||
*/
|
||||
static function make_unique($path)
|
||||
{
|
||||
$dupe_count = 0;
|
||||
while(is_file(Vfs::PREFIX . $path))
|
||||
{
|
||||
$dupe_count++;
|
||||
$path = Vfs::dirname($path) . '/' .
|
||||
pathinfo($path, PATHINFO_FILENAME) .
|
||||
' (' . ($dupe_count + 1) . ')' . '.' .
|
||||
pathinfo($path, PATHINFO_EXTENSION);
|
||||
}
|
||||
return $path;
|
||||
}
|
||||
}
|
||||
|
||||
Vfs::init_static();
|
||||
|
Loading…
Reference in New Issue
Block a user