Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
our_own_cloud_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
die_coolen_jungs
our_own_cloud_project
Commits
e5792cc0
Commit
e5792cc0
authored
12 years ago
by
Björn Schießle
Browse files
Options
Downloads
Patches
Plain Diff
adjust the name and/or location of the stored versions if the actual file gets moved or renamed
parent
f22f4967
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
apps/files_versions/appinfo/app.php
+3
-2
3 additions, 2 deletions
apps/files_versions/appinfo/app.php
apps/files_versions/versions.php
+24
-1
24 additions, 1 deletion
apps/files_versions/versions.php
with
27 additions
and
3 deletions
apps/files_versions/appinfo/app.php
+
3
−
2
View file @
e5792cc0
...
...
@@ -9,5 +9,6 @@ OCP\Util::addscript('files_versions', 'versions');
// Listen to write signals
OCP\Util
::
connectHook
(
'OC_Filesystem'
,
'post_write'
,
"OCA_Versions\Storage"
,
"write_hook"
);
// Listen to delete signals
OCP\Util
::
connectHook
(
'OC_Filesystem'
,
'delete'
,
"OCA_Versions\Storage"
,
"removeVersions"
);
\ No newline at end of file
// Listen to delete and rename signals
OCP\Util
::
connectHook
(
'OC_Filesystem'
,
'delete'
,
"OCA_Versions\Storage"
,
"removeVersions"
);
OCP\Util
::
connectHook
(
'OC_Filesystem'
,
'rename'
,
"OCA_Versions\Storage"
,
"renameVersions"
);
\ No newline at end of file
This diff is collapsed.
Click to expand it.
apps/files_versions/versions.php
+
24
−
1
View file @
e5792cc0
...
...
@@ -310,7 +310,11 @@ class Storage {
}
/**
* @brief Erase versions of deleted file
* @brief Erase versions of deleted file
* @param array
*
* This function is connected to the delete signal of OC_Filesystem
* cleanup the versions directory if the actual file gets deleted
*/
public
static
function
removeVersions
(
$params
)
{
$rel_path
=
$params
[
\OC_Filesystem
::
signal_param_path
];
...
...
@@ -322,4 +326,23 @@ class Storage {
}
}
}
/**
* @brief rename/move versions of renamed/moved files
* @param array with oldpath and newpath
*
* This function is connected to the rename signal of OC_Filesystem and adjust the name and location
* of the stored versions along the actual file
*/
public
static
function
renameVersions
(
$params
)
{
$rel_oldpath
=
$params
[
'oldpath'
];
$abs_oldpath
=
\OCP\Config
::
getSystemValue
(
'datadirectory'
)
.
'/'
.
\OC_User
::
getUser
()
.
"/versions"
.
$rel_oldpath
.
'.v'
;
$abs_newpath
=
\OCP\Config
::
getSystemValue
(
'datadirectory'
)
.
'/'
.
\OC_User
::
getUser
()
.
"/versions"
.
$params
[
'newpath'
]
.
'.v'
;
if
(
Storage
::
isversioned
(
$rel_oldpath
))
{
$versions
=
Storage
::
getVersions
(
$rel_oldpath
);
foreach
(
$versions
as
$v
){
rename
(
$abs_oldpath
.
$v
[
'version'
],
$abs_newpath
.
$v
[
'version'
]);
}
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment