diff options
author | Björn Schießle <schiessle@owncloud.com> | 2014-05-13 09:25:16 -0400 |
---|---|---|
committer | Björn Schießle <schiessle@owncloud.com> | 2014-05-13 09:25:16 -0400 |
commit | b8de1e5d716c416beae328506e368cd0554509e1 (patch) | |
tree | 8b13942c27547f4c4266699efc445b0bfe96296d /lib/private/util.php | |
parent | e934129bf6125c50ccede651b544d7ab07d5378a (diff) | |
parent | a9ac11718e62017c70682f99eb35b43b1ef9c498 (diff) | |
download | nextcloud-server-b8de1e5d716c416beae328506e368cd0554509e1.tar.gz nextcloud-server-b8de1e5d716c416beae328506e368cd0554509e1.zip |
Merge pull request #8398 from owncloud/enc_backup_keys
backup the encryption key after the encryption was disabled
Diffstat (limited to 'lib/private/util.php')
-rwxr-xr-x | lib/private/util.php | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/lib/private/util.php b/lib/private/util.php index e2005d31c38..96d80beb4d1 100755 --- a/lib/private/util.php +++ b/lib/private/util.php @@ -551,6 +551,27 @@ class OC_Util { } /** + * @brief check if a backup from the encryption keys exists + * @return boolean + */ + public static function backupKeysExists() { + //check if encryption was enabled in the past + $backupExists = false; + if (OC_App::isEnabled('files_encryption') === false) { + $view = new OC\Files\View('/' . OCP\User::getUser()); + $backupPath = '/files_encryption/keyfiles.backup'; + if ($view->is_dir($backupPath)) { + $dircontent = $view->getDirectoryContent($backupPath); + if (!empty($dircontent)) { + $backupExists = true; + } + } + } + + return $backupExists; + } + + /** * @brief Check for correct file permissions of data directory * @param string $dataDirectory * @return array arrays with error messages and hints @@ -837,7 +858,7 @@ class OC_Util { if (!\OC_Config::getValue("check_for_working_htaccess", true)) { return true; } - + // testdata $fileName = '/htaccesstest.txt'; $testContent = 'testcontent'; @@ -1082,7 +1103,7 @@ class OC_Util { curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($curl, CURLOPT_URL, $url); - + curl_setopt($curl, CURLOPT_USERAGENT, "ownCloud Server Crawler"); if(OC_Config::getValue('proxy', '') != '') { @@ -1091,17 +1112,16 @@ class OC_Util { if(OC_Config::getValue('proxyuserpwd', '') != '') { curl_setopt($curl, CURLOPT_PROXYUSERPWD, OC_Config::getValue('proxyuserpwd')); } - - if (ini_get('open_basedir') === '' && ini_get('safe_mode' === 'Off')) { + + if (ini_get('open_basedir') === '' && ini_get('safe_mode' === 'Off')) { curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($curl, CURLOPT_MAXREDIRS, $max_redirects); $data = curl_exec($curl); } else { curl_setopt($curl, CURLOPT_FOLLOWLOCATION, false); $mr = $max_redirects; - if ($mr > 0) { + if ($mr > 0) { $newURL = curl_getinfo($curl, CURLINFO_EFFECTIVE_URL); - $rcurl = curl_copy_handle($curl); curl_setopt($rcurl, CURLOPT_HEADER, true); curl_setopt($rcurl, CURLOPT_NOBODY, true); @@ -1125,9 +1145,9 @@ class OC_Util { curl_close($rcurl); if ($mr > 0) { curl_setopt($curl, CURLOPT_URL, $newURL); - } + } } - + if($mr == 0 && $max_redirects > 0) { $data = false; } else { |