summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorSam Tuke <samtuke@owncloud.com>2012-09-18 14:36:08 +0100
committerSam Tuke <samtuke@owncloud.com>2012-09-18 14:36:08 +0100
commitdc0dc56d481844f55d08b08736b6ce8d7d2918e1 (patch)
tree8994e1c06f3e6e59648187394511571bfc3efc25 /lib
parentb765e883f32bf271c77e4bfa4a88249e5b371a1a (diff)
parent06e963c54f3067381784c976df75c250e43a95bd (diff)
downloadnextcloud-server-dc0dc56d481844f55d08b08736b6ce8d7d2918e1.tar.gz
nextcloud-server-dc0dc56d481844f55d08b08736b6ce8d7d2918e1.zip
Merge branch 'master' of https://github.com/owncloud/core
Diffstat (limited to 'lib')
-rw-r--r--lib/connector/sabre/directory.php3
-rw-r--r--lib/connector/sabre/node.php2
-rw-r--r--lib/db.php6
-rw-r--r--lib/filecache/cached.php15
-rw-r--r--lib/fileproxy/quota.php8
-rw-r--r--lib/filesystem.php1
-rw-r--r--lib/filesystemview.php158
-rw-r--r--lib/helper.php7
-rw-r--r--lib/l10n/da.php4
-rw-r--r--lib/l10n/de.php4
-rw-r--r--lib/l10n/sl.php6
-rw-r--r--lib/l10n/zh_CN.GB2312.php28
-rwxr-xr-xlib/util.php8
-rw-r--r--lib/vcategories.php5
14 files changed, 162 insertions, 93 deletions
diff --git a/lib/connector/sabre/directory.php b/lib/connector/sabre/directory.php
index 39606577f6d..b5049d800c4 100644
--- a/lib/connector/sabre/directory.php
+++ b/lib/connector/sabre/directory.php
@@ -50,6 +50,9 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa
public function createFile($name, $data = null) {
if (isset($_SERVER['HTTP_OC_CHUNKED'])) {
$info = OC_FileChunking::decodeName($name);
+ if (empty($info)) {
+ throw new Sabre_DAV_Exception_NotImplemented();
+ }
$chunk_handler = new OC_FileChunking($info);
$chunk_handler->store($info['index'], $data);
if ($chunk_handler->isComplete()) {
diff --git a/lib/connector/sabre/node.php b/lib/connector/sabre/node.php
index 2916575e2d5..ecbbef81292 100644
--- a/lib/connector/sabre/node.php
+++ b/lib/connector/sabre/node.php
@@ -235,7 +235,7 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
static public function removeETagPropertyForPath($path) {
// remove tags from this and parent paths
$paths = array();
- while ($path != '/' && $path != '') {
+ while ($path != '/' && $path != '.' && $path != '') {
$paths[] = $path;
$path = dirname($path);
}
diff --git a/lib/db.php b/lib/db.php
index 4317f798484..9c10512350f 100644
--- a/lib/db.php
+++ b/lib/db.php
@@ -187,7 +187,7 @@ class OC_DB {
// Prepare options array
$options = array(
- 'portability' => MDB2_PORTABILITY_ALL & (!MDB2_PORTABILITY_FIX_CASE),
+ 'portability' => MDB2_PORTABILITY_ALL - MDB2_PORTABILITY_FIX_CASE,
'log_line_break' => '<br>',
'idxname_format' => '%s',
'debug' => true,
@@ -232,6 +232,7 @@ class OC_DB {
$dsn['database'] = $name;
} else { // use dbname for hostspec
$dsn['hostspec'] = $name;
+ $dsn['database'] = $user;
}
break;
}
@@ -457,7 +458,8 @@ class OC_DB {
$previousSchema = self::$schema->getDefinitionFromDatabase();
if (PEAR::isError($previousSchema)) {
$error = $previousSchema->getMessage();
- OC_Log::write('core', 'Failed to get existing database structure for upgrading ('.$error.')', OC_Log::FATAL);
+ $detail = $previousSchema->getDebugInfo();
+ OC_Log::write('core', 'Failed to get existing database structure for upgrading ('.$error.', '.$detail.')', OC_Log::FATAL);
return false;
}
diff --git a/lib/filecache/cached.php b/lib/filecache/cached.php
index 4e8ff23793e..9b1eb4f7803 100644
--- a/lib/filecache/cached.php
+++ b/lib/filecache/cached.php
@@ -18,8 +18,19 @@ class OC_FileCache_Cached{
$root=OC_Filesystem::getRoot();
}
$path=$root.$path;
- $query=OC_DB::prepare('SELECT `path`,`ctime`,`mtime`,`mimetype`,`size`,`encrypted`,`versioned`,`writable` FROM `*PREFIX*fscache` WHERE `path_hash`=?');
- $result=$query->execute(array(md5($path)))->fetchRow();
+ $stmt=OC_DB::prepare('SELECT `path`,`ctime`,`mtime`,`mimetype`,`size`,`encrypted`,`versioned`,`writable` FROM `*PREFIX*fscache` WHERE `path_hash`=?');
+ if ( ! OC_DB::isError($stmt) ) {
+ $result=$stmt->execute(array(md5($path)));
+ if ( ! OC_DB::isError($result) ) {
+ $result = $result->fetchRow();
+ } else {
+ OC:Log::write('OC_FileCache_Cached', 'could not execute get: '. OC_DB::getErrorMessage($result), OC_Log::ERROR);
+ $result = false;
+ }
+ } else {
+ OC_Log::write('OC_FileCache_Cached', 'could not prepare get: '. OC_DB::getErrorMessage($stmt), OC_Log::ERROR);
+ $result = false;
+ }
if(is_array($result)) {
if(isset(self::$savedData[$path])) {
$result=array_merge($result, self::$savedData[$path]);
diff --git a/lib/fileproxy/quota.php b/lib/fileproxy/quota.php
index adbff3d301a..5a0dbdb6fe2 100644
--- a/lib/fileproxy/quota.php
+++ b/lib/fileproxy/quota.php
@@ -26,6 +26,7 @@
*/
class OC_FileProxy_Quota extends OC_FileProxy{
+ static $rootView;
private $userQuota=-1;
/**
@@ -86,7 +87,10 @@ class OC_FileProxy_Quota extends OC_FileProxy{
}
public function preCopy($path1,$path2) {
- return (OC_Filesystem::filesize($path1)<$this->getFreeSpace() or $this->getFreeSpace()==0);
+ if(!self::$rootView){
+ self::$rootView = new OC_FilesystemView('');
+ }
+ return (self::$rootView->filesize($path1)<$this->getFreeSpace() or $this->getFreeSpace()==0);
}
public function preFromTmpFile($tmpfile,$path) {
@@ -96,4 +100,4 @@ class OC_FileProxy_Quota extends OC_FileProxy{
public function preFromUploadedFile($tmpfile,$path) {
return (filesize($tmpfile)<$this->getFreeSpace() or $this->getFreeSpace()==0);
}
-} \ No newline at end of file
+}
diff --git a/lib/filesystem.php b/lib/filesystem.php
index 92eb4fa4778..ce4d3a0cf48 100644
--- a/lib/filesystem.php
+++ b/lib/filesystem.php
@@ -527,6 +527,7 @@ class OC_Filesystem{
} else {
$path=$params['oldpath'];
}
+ $path = self::normalizePath($path);
OC_Connector_Sabre_Node::removeETagPropertyForPath($path);
}
diff --git a/lib/filesystemview.php b/lib/filesystemview.php
index 3a17af510cf..fcf419e864d 100644
--- a/lib/filesystemview.php
+++ b/lib/filesystemview.php
@@ -263,24 +263,26 @@ class OC_FilesystemView {
$path = $this->getRelativePath($absolutePath);
$exists = $this->file_exists($path);
$run = true;
- if(!$exists) {
+ if( $this->fakeRoot==OC_Filesystem::getRoot() ){
+ if(!$exists) {
+ OC_Hook::emit(
+ OC_Filesystem::CLASSNAME,
+ OC_Filesystem::signal_create,
+ array(
+ OC_Filesystem::signal_param_path => $path,
+ OC_Filesystem::signal_param_run => &$run
+ )
+ );
+ }
OC_Hook::emit(
OC_Filesystem::CLASSNAME,
- OC_Filesystem::signal_create,
+ OC_Filesystem::signal_write,
array(
OC_Filesystem::signal_param_path => $path,
OC_Filesystem::signal_param_run => &$run
)
);
}
- OC_Hook::emit(
- OC_Filesystem::CLASSNAME,
- OC_Filesystem::signal_write,
- array(
- OC_Filesystem::signal_param_path => $path,
- OC_Filesystem::signal_param_run => &$run
- )
- );
if(!$run) {
return false;
}
@@ -289,18 +291,20 @@ class OC_FilesystemView {
$count=OC_Helper::streamCopy($data, $target);
fclose($target);
fclose($data);
- if(!$exists) {
+ if( $this->fakeRoot==OC_Filesystem::getRoot() ){
+ if(!$exists) {
+ OC_Hook::emit(
+ OC_Filesystem::CLASSNAME,
+ OC_Filesystem::signal_post_create,
+ array( OC_Filesystem::signal_param_path => $path)
+ );
+ }
OC_Hook::emit(
OC_Filesystem::CLASSNAME,
- OC_Filesystem::signal_post_create,
+ OC_Filesystem::signal_post_write,
array( OC_Filesystem::signal_param_path => $path)
);
- }/*
- OC_Hook::emit(
- OC_Filesystem::CLASSNAME,
- OC_Filesystem::signal_post_write,
- array( OC_Filesystem::signal_param_path => $path)
- );*/
+ }
OC_FileProxy::runPostProxies('file_put_contents', $absolutePath, $count);
return $count > 0;
}else{
@@ -330,14 +334,16 @@ class OC_FilesystemView {
return false;
}
$run=true;
- OC_Hook::emit(
- OC_Filesystem::CLASSNAME, OC_Filesystem::signal_rename,
- array(
- OC_Filesystem::signal_param_oldpath => $path1,
- OC_Filesystem::signal_param_newpath => $path2,
- OC_Filesystem::signal_param_run => &$run
- )
- );
+ if( $this->fakeRoot==OC_Filesystem::getRoot() ){
+ OC_Hook::emit(
+ OC_Filesystem::CLASSNAME, OC_Filesystem::signal_rename,
+ array(
+ OC_Filesystem::signal_param_oldpath => $path1,
+ OC_Filesystem::signal_param_newpath => $path2,
+ OC_Filesystem::signal_param_run => &$run
+ )
+ );
+ }
if($run) {
$mp1 = $this->getMountPoint($path1.$postFix1);
$mp2 = $this->getMountPoint($path2.$postFix2);
@@ -353,14 +359,16 @@ class OC_FilesystemView {
$storage1->unlink($this->getInternalPath($path1.$postFix1));
$result = $count>0;
}
- OC_Hook::emit(
- OC_Filesystem::CLASSNAME,
- OC_Filesystem::signal_post_rename,
- array(
- OC_Filesystem::signal_param_oldpath => $path1,
- OC_Filesystem::signal_param_newpath => $path2
- )
- );
+ if( $this->fakeRoot==OC_Filesystem::getRoot() ){
+ OC_Hook::emit(
+ OC_Filesystem::CLASSNAME,
+ OC_Filesystem::signal_post_rename,
+ array(
+ OC_Filesystem::signal_param_oldpath => $path1,
+ OC_Filesystem::signal_param_newpath => $path2
+ )
+ );
+ }
return $result;
}
}
@@ -378,35 +386,37 @@ class OC_FilesystemView {
return false;
}
$run=true;
- OC_Hook::emit(
- OC_Filesystem::CLASSNAME,
- OC_Filesystem::signal_copy,
- array(
- OC_Filesystem::signal_param_oldpath => $path1,
- OC_Filesystem::signal_param_newpath=>$path2,
- OC_Filesystem::signal_param_run => &$run
- )
- );
- $exists=$this->file_exists($path2);
- if($run and !$exists) {
+ if( $this->fakeRoot==OC_Filesystem::getRoot() ){
OC_Hook::emit(
OC_Filesystem::CLASSNAME,
- OC_Filesystem::signal_create,
+ OC_Filesystem::signal_copy,
array(
- OC_Filesystem::signal_param_path => $path2,
- OC_Filesystem::signal_param_run => &$run
- )
- );
- }
- if($run) {
- OC_Hook::emit(
- OC_Filesystem::CLASSNAME,
- OC_Filesystem::signal_write,
- array(
- OC_Filesystem::signal_param_path => $path2,
+ OC_Filesystem::signal_param_oldpath => $path1,
+ OC_Filesystem::signal_param_newpath=>$path2,
OC_Filesystem::signal_param_run => &$run
)
);
+ $exists=$this->file_exists($path2);
+ if($run and !$exists) {
+ OC_Hook::emit(
+ OC_Filesystem::CLASSNAME,
+ OC_Filesystem::signal_create,
+ array(
+ OC_Filesystem::signal_param_path => $path2,
+ OC_Filesystem::signal_param_run => &$run
+ )
+ );
+ }
+ if($run) {
+ OC_Hook::emit(
+ OC_Filesystem::CLASSNAME,
+ OC_Filesystem::signal_write,
+ array(
+ OC_Filesystem::signal_param_path => $path2,
+ OC_Filesystem::signal_param_run => &$run
+ )
+ );
+ }
}
if($run) {
$mp1=$this->getMountPoint($path1.$postFix1);
@@ -420,26 +430,28 @@ class OC_FilesystemView {
$target = $this->fopen($path2.$postFix2, 'w');
$result = OC_Helper::streamCopy($source, $target);
}
- OC_Hook::emit(
- OC_Filesystem::CLASSNAME,
- OC_Filesystem::signal_post_copy,
- array(
- OC_Filesystem::signal_param_oldpath => $path1,
- OC_Filesystem::signal_param_newpath=>$path2
- )
- );
- if(!$exists) {
+ if( $this->fakeRoot==OC_Filesystem::getRoot() ){
OC_Hook::emit(
OC_Filesystem::CLASSNAME,
- OC_Filesystem::signal_post_create,
- array(OC_Filesystem::signal_param_path => $path2)
+ OC_Filesystem::signal_post_copy,
+ array(
+ OC_Filesystem::signal_param_oldpath => $path1,
+ OC_Filesystem::signal_param_newpath=>$path2
+ )
+ );
+ if(!$exists) {
+ OC_Hook::emit(
+ OC_Filesystem::CLASSNAME,
+ OC_Filesystem::signal_post_create,
+ array(OC_Filesystem::signal_param_path => $path2)
+ );
+ }
+ OC_Hook::emit(
+ OC_Filesystem::CLASSNAME,
+ OC_Filesystem::signal_post_write,
+ array( OC_Filesystem::signal_param_path => $path2)
);
}
- OC_Hook::emit(
- OC_Filesystem::CLASSNAME,
- OC_Filesystem::signal_post_write,
- array( OC_Filesystem::signal_param_path => $path2)
- );
return $result;
}
}
diff --git a/lib/helper.php b/lib/helper.php
index 70b2f78862b..dda5fcc5f0c 100644
--- a/lib/helper.php
+++ b/lib/helper.php
@@ -62,8 +62,11 @@ class OC_Helper {
}
}
- foreach($args as $k => $v) {
- $urlLinkTo .= '&'.$k.'='.$v;
+ if (!empty($args)) {
+ $urlLinkTo .= '?';
+ foreach($args as $k => $v) {
+ $urlLinkTo .= '&'.$k.'='.$v;
+ }
}
return $urlLinkTo;
diff --git a/lib/l10n/da.php b/lib/l10n/da.php
index 7a9ee26b477..5c68174fa07 100644
--- a/lib/l10n/da.php
+++ b/lib/l10n/da.php
@@ -21,5 +21,7 @@
"last month" => "Sidste måned",
"months ago" => "måneder siden",
"last year" => "Sidste år",
-"years ago" => "år siden"
+"years ago" => "år siden",
+"%s is available. Get <a href=\"%s\">more information</a>" => "%s er tilgængelig. Få <a href=\"%s\">mere information</a>",
+"up to date" => "opdateret"
);
diff --git a/lib/l10n/de.php b/lib/l10n/de.php
index 4a567003de2..aea631aba28 100644
--- a/lib/l10n/de.php
+++ b/lib/l10n/de.php
@@ -14,10 +14,10 @@
"Token expired. Please reload page." => "Token abgelaufen. Bitte laden Sie die Seite neu.",
"seconds ago" => "Vor wenigen Sekunden",
"1 minute ago" => "Vor einer Minute",
-"%d minutes ago" => "Vor %d Minuten",
+"%d minutes ago" => "Vor %d Minute(n)",
"today" => "Heute",
"yesterday" => "Gestern",
-"%d days ago" => "Vor %d Tagen",
+"%d days ago" => "Vor %d Tag(en)",
"last month" => "Letzten Monat",
"months ago" => "Vor Monaten",
"last year" => "Letztes Jahr",
diff --git a/lib/l10n/sl.php b/lib/l10n/sl.php
index 273773f2f7b..eac839e78f3 100644
--- a/lib/l10n/sl.php
+++ b/lib/l10n/sl.php
@@ -12,16 +12,16 @@
"Application is not enabled" => "Aplikacija ni omogočena",
"Authentication error" => "Napaka overitve",
"Token expired. Please reload page." => "Žeton je potekel. Prosimo, če spletno stran znova naložite.",
-"seconds ago" => "sekund nazaj",
+"seconds ago" => "pred nekaj sekundami",
"1 minute ago" => "pred minuto",
"%d minutes ago" => "pred %d minutami",
"today" => "danes",
"yesterday" => "včeraj",
"%d days ago" => "pred %d dnevi",
"last month" => "prejšnji mesec",
-"months ago" => "mesecev nazaj",
+"months ago" => "pred nekaj meseci",
"last year" => "lani",
-"years ago" => "let nazaj",
+"years ago" => "pred nekaj leti",
"%s is available. Get <a href=\"%s\">more information</a>" => "%s je na voljo. <a href=\"%s\">Več informacij.</a>",
"up to date" => "ažuren",
"updates check is disabled" => "preverjanje za posodobitve je onemogočeno"
diff --git a/lib/l10n/zh_CN.GB2312.php b/lib/l10n/zh_CN.GB2312.php
new file mode 100644
index 00000000000..4b0a5e9f4d2
--- /dev/null
+++ b/lib/l10n/zh_CN.GB2312.php
@@ -0,0 +1,28 @@
+<?php $TRANSLATIONS = array(
+"Help" => "帮助",
+"Personal" => "私人",
+"Settings" => "设置",
+"Users" => "用户",
+"Apps" => "程序",
+"Admin" => "管理员",
+"ZIP download is turned off." => "ZIP 下载已关闭",
+"Files need to be downloaded one by one." => "需要逐个下载文件。",
+"Back to Files" => "返回到文件",
+"Selected files too large to generate zip file." => "选择的文件太大而不能生成 zip 文件。",
+"Application is not enabled" => "应用未启用",
+"Authentication error" => "验证错误",
+"Token expired. Please reload page." => "会话过期。请刷新页面。",
+"seconds ago" => "秒前",
+"1 minute ago" => "1 分钟前",
+"%d minutes ago" => "%d 分钟前",
+"today" => "今天",
+"yesterday" => "昨天",
+"%d days ago" => "%d 天前",
+"last month" => "上个月",
+"months ago" => "月前",
+"last year" => "去年",
+"years ago" => "年前",
+"%s is available. Get <a href=\"%s\">more information</a>" => "%s 不可用。获知 <a href=\"%s\">详情</a>",
+"up to date" => "最新",
+"updates check is disabled" => "更新检测已禁用"
+);
diff --git a/lib/util.php b/lib/util.php
index c2edc660e8e..5e39fd1f914 100755
--- a/lib/util.php
+++ b/lib/util.php
@@ -89,7 +89,7 @@ class OC_Util {
* @return string
*/
public static function getVersionString() {
- return '4.5 beta 3';
+ return '4.5 beta 3a';
}
/**
@@ -211,13 +211,13 @@ class OC_Util {
$permissionsHint="Permissions can usually be fixed by giving the webserver write access to the ownCloud directory";
// Check if config folder is writable.
- if(!is_writable(OC::$SERVERROOT."/config/")) {
+ if(!is_writable(OC::$SERVERROOT."/config/") or !is_readable(OC::$SERVERROOT."/config/")) {
$errors[]=array('error'=>"Can't write into config directory 'config'",'hint'=>"You can usually fix this by giving the webserver user write access to the config directory in owncloud");
}
// Check if there is a writable install folder.
if(OC_Config::getValue('appstoreenabled', true)) {
- if( OC_App::getInstallPath() === null || !is_writable(OC_App::getInstallPath())) {
+ if( OC_App::getInstallPath() === null || !is_writable(OC_App::getInstallPath()) || !is_readable(OC_App::getInstallPath()) ) {
$errors[]=array('error'=>"Can't write into apps directory",'hint'=>"You can usually fix this by giving the webserver user write access to the apps directory
in owncloud or disabling the appstore in the config file.");
}
@@ -257,7 +257,7 @@ class OC_Util {
if(!$success) {
$errors[]=array('error'=>"Can't create data directory (".$CONFIG_DATADIRECTORY.")",'hint'=>"You can usually fix this by giving the webserver write access to the ownCloud directory '".OC::$SERVERROOT."' (in a terminal, use the command 'chown -R www-data:www-data /path/to/your/owncloud/install/data' ");
}
- } else if(!is_writable($CONFIG_DATADIRECTORY)) {
+ } else if(!is_writable($CONFIG_DATADIRECTORY) or !is_readable($CONFIG_DATADIRECTORY)) {
$errors[]=array('error'=>'Data directory ('.$CONFIG_DATADIRECTORY.') not writable by ownCloud<br/>','hint'=>$permissionsHint);
}
diff --git a/lib/vcategories.php b/lib/vcategories.php
index f5123adeeb6..6b1d6a316f1 100644
--- a/lib/vcategories.php
+++ b/lib/vcategories.php
@@ -55,7 +55,10 @@ class OC_VCategories {
$this->app = $app;
$this->user = is_null($user) ? OC_User::getUser() : $user;
$categories = trim(OC_Preferences::getValue($this->user, $app, self::PREF_CATEGORIES_LABEL, ''));
- $this->categories = $categories != '' ? @unserialize($categories) : $defcategories;
+ if ($categories) {
+ $categories = @unserialize($categories);
+ }
+ $this->categories = is_array($categories) ? $categories : $defcategories;
}
/**