Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin <robin@Amaya.(none)>2010-05-08 23:32:20 +0400
committerRobin <robin@Amaya.(none)>2010-05-08 23:32:20 +0400
commit51b253447d4aa6d10a3870e94b9a2288278e1916 (patch)
treebb6737a66c2883a59e85f7fac796cc844641a4fe /inc/lib_base.php
parent565410d8e266b4d0391b10d15339f700dcb1f789 (diff)
provide option for automatic backup
Diffstat (limited to 'inc/lib_base.php')
-rwxr-xr-xinc/lib_base.php15
1 files changed, 15 insertions, 0 deletions
diff --git a/inc/lib_base.php b/inc/lib_base.php
index fe8134b68e6..c501a28f4a5 100755
--- a/inc/lib_base.php
+++ b/inc/lib_base.php
@@ -47,7 +47,9 @@ if($WEBROOT{0}!=='/'){
// define default config values
$CONFIG_INSTALLED=false;
$CONFIG_DATADIRECTORY=$SERVERROOT.'/data';
+$CONFIG_BACKUPDIRECTORY=$SERVERROOT.'/backup';
$CONFIG_HTTPFORCESSL=false;
+$CONFIG_ENABLEBACKUP=false;
$CONFIG_DATEFORMAT='j M Y G:i';
$CONFIG_DBNAME='owncloud';
$CONFIG_DBTYPE='sqlite';
@@ -69,6 +71,8 @@ if(isset($CONFIG_HTTPFORCESSL) and $CONFIG_HTTPFORCESSL){
// load core libs
oc_require_once('lib_files.php');
oc_require_once('lib_filesystem.php');
+oc_require_once('lib_filestorage.php');
+oc_require_once('lib_fileobserver.php');
oc_require_once('lib_log.php');
oc_require_once('lib_config.php');
oc_require_once('lib_user.php');
@@ -87,6 +91,17 @@ if(OC_USER::isLoggedIn()){
mkdir($CONFIG_DATADIRECTORY);
}
$rootStorage=new OC_FILESTORAGE_LOCAL(array('datadir'=>$CONFIG_DATADIRECTORY));
+ if($CONFIG_ENABLEBACKUP){
+ if(!is_dir($CONFIG_BACKUPDIRECTORY)){
+ mkdir($CONFIG_BACKUPDIRECTORY);
+ }
+ if(!is_dir($CONFIG_BACKUPDIRECTORY.'/'.$_SESSION['username_clean'])){
+ mkdir($CONFIG_BACKUPDIRECTORY.'/'.$_SESSION['username_clean']);
+ }
+ $backupStorage=new OC_FILESTORAGE_LOCAL(array('datadir'=>$CONFIG_BACKUPDIRECTORY.'/'.$_SESSION['username_clean']));
+ $backup=new OC_FILEOBSERVER_BACKUP(array('storage'=>$backupStorage));
+ $rootStorage->addObserver($backup);
+ }
OC_FILESYSTEM::mount($rootStorage,'/');
}