summaryrefslogtreecommitdiffstats
path: root/lib/private/util.php
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2013-10-04 12:30:49 +0200
committerBjoern Schiessle <schiessle@owncloud.com>2013-10-04 12:30:49 +0200
commit51295e9a6b9cd8e351132e988858b5d4bd223968 (patch)
tree7d2da02957552a8ac49eb6f2f3bd6b08e1049406 /lib/private/util.php
parenta223cf769a670c1c8926baf4ded445af300d056d (diff)
parent514d7a884a5211fe246487421ea8103202d004d7 (diff)
downloadnextcloud-server-51295e9a6b9cd8e351132e988858b5d4bd223968.tar.gz
nextcloud-server-51295e9a6b9cd8e351132e988858b5d4bd223968.zip
Merge branch 'master' into sharing_mail_notification_master
Conflicts: apps/files/index.php apps/files/templates/index.php
Diffstat (limited to 'lib/private/util.php')
-rwxr-xr-xlib/private/util.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/private/util.php b/lib/private/util.php
index 97dd2fac53c..ae9aef69b4c 100755
--- a/lib/private/util.php
+++ b/lib/private/util.php
@@ -68,6 +68,7 @@ class OC_Util {
$userDirectory = $userRoot . '/files';
if( !is_dir( $userDirectory )) {
mkdir( $userDirectory, 0755, true );
+ OC_Util::copySkeleton($userDirectory);
}
//jail the user into his "home" directory
\OC\Files\Filesystem::init($user, $userDir);
@@ -93,6 +94,35 @@ class OC_Util {
}
/**
+ * @brief copies the user skeleton files into the fresh user home files
+ * @param string $userDirectory
+ */
+ public static function copySkeleton($userDirectory) {
+ OC_Util::copyr(\OC::$SERVERROOT.'/core/skeleton' , $userDirectory);
+ }
+
+ /**
+ * @brief copies a directory recursively
+ * @param string $source
+ * @param string $target
+ * @return void
+ */
+ public static function copyr($source,$target) {
+ $dir = opendir($source);
+ @mkdir($target);
+ while(false !== ( $file = readdir($dir)) ) {
+ if ( !\OC\Files\Filesystem::isIgnoredDir($file) ) {
+ if ( is_dir($source . '/' . $file) ) {
+ OC_Util::copyr($source . '/' . $file , $target . '/' . $file);
+ } else {
+ copy($source . '/' . $file,$target . '/' . $file);
+ }
+ }
+ }
+ closedir($dir);
+ }
+
+ /**
* @return void
*/
public static function tearDownFS() {