diff options
Diffstat (limited to 'apps/files_versioning/settings.php')
-rw-r--r-- | apps/files_versioning/settings.php | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/apps/files_versioning/settings.php b/apps/files_versioning/settings.php new file mode 100644 index 00000000000..94af587a215 --- /dev/null +++ b/apps/files_versioning/settings.php @@ -0,0 +1,34 @@ +<?php + +// Get the full path to the repository folder (FIXME: hard-coded to 'Backup') +$path = OC_Config::getValue('datadirectory', OC::$SERVERROOT.'/data') + . DIRECTORY_SEPARATOR + . OC_User::getUser() + . DIRECTORY_SEPARATOR + . 'files' + . DIRECTORY_SEPARATOR + . 'Backup' + . DIRECTORY_SEPARATOR + . '.git' + . DIRECTORY_SEPARATOR; + +$repository = new Granite\Git\Repository($path); + +$commits = array(); +// Fetch most recent 50 commits (FIXME - haven't tested this much) +$commit = $repository->head(); +for ($i = 0; $i < 50; $i++) { + $commits[] = $commit; + $parents = $commit->parents(); + if (count($parents) > 0) { + $parent = $parents[0]; + } else { + break; + } + + $commit = $repository->factory('commit', $parent); +} + +$tmpl = new OC_Template( 'files_versioning', 'settings'); +$tmpl->assign('commits', $commits); +return $tmpl->fetchPage(); |