From f2b5bc8ab8fadaee3db3a03e6a4748fdb28a01b1 Mon Sep 17 00:00:00 2001 From: Thomas Mueller Date: Thu, 7 Feb 2013 14:47:56 +0100 Subject: [PATCH 01/54] adding autotesting for mssql server - windows only --- autotest.cmd | 47 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 37 insertions(+), 10 deletions(-) diff --git a/autotest.cmd b/autotest.cmd index 053860db54..e5ea0cf4c3 100644 --- a/autotest.cmd +++ b/autotest.cmd @@ -4,14 +4,14 @@ :: @author Thomas Müller :: @author Tobias Ramforth (translated into Windows batch file) :: -:: @copyright 2012 Thomas Müller thomas.mueller@tmit.eu +:: @copyright 2012, 2013 Thomas Müller thomas.mueller@tmit.eu :: @echo off set DATADIR=data-autotest set BASEDIR=%~dp0 -:: create autoconfig for sqlite, mysql and postgresql +:: create autoconfig for sqlite, mysql, postgresql and mssql echo ^ .\tests\autoconfig-sqlite.php echo $AUTOCONFIG ^= array ^( >> .\tests\autoconfig-sqlite.php echo 'installed' ^=^> false^, >> .\tests\autoconfig-sqlite.php @@ -50,16 +50,35 @@ echo 'dbhost' ^=^> 'localhost'^, >> .\tests\autoconfig-pgsql.php echo 'dbpass' ^=^> 'owncloud'^, >> .\tests\autoconfig-pgsql.php echo ^)^; >> .\tests\autoconfig-pgsql.php +echo ^ .\tests\autoconfig-mssql.php +echo $AUTOCONFIG ^= array ^( >> .\tests\autoconfig-mssql.php +echo 'installed' ^=^> false^, >> .\tests\autoconfig-mssql.php +echo 'dbtype' ^=^> 'mssql'^, >> .\tests\autoconfig-mssql.php +echo 'dbtableprefix' ^=^> 'oc_'^, >> .\tests\autoconfig-mssql.php +echo 'adminlogin' ^=^> 'admin'^, >> .\tests\autoconfig-mssql.php +echo 'adminpass' ^=^> 'admin'^, >> .\tests\autoconfig-mssql.php +echo 'directory' ^=^> '%BASEDIR%%DATADIR%'^, >> .\tests\autoconfig-mssql.php +echo 'dbuser' ^=^> 'oc_autotest'^, >> .\tests\autoconfig-mssql.php +echo 'dbname' ^=^> 'oc_autotest'^, >> .\tests\autoconfig-mssql.php +echo 'dbhost' ^=^> 'localhost\sqlexpress'^, >> .\tests\autoconfig-mssql.php +echo 'dbpass' ^=^> 'owncloud'^, >> .\tests\autoconfig-mssql.php +echo ^)^; >> .\tests\autoconfig-mssql.php + echo localhost:5432:*:oc_autotest:owncloud > %APPDATA%\postgresql\pgpass.conf :: :: start test execution :: -::call:execute_tests "sqlite" -call:execute_tests "mysql" -::call:execute_tests "mssql" -::call:execute_tests "ora" -::call:execute_tests "pgsql" +if [%1] == [] ( + echo "Running on all database backends" + call:execute_tests "sqlite" + call:execute_tests "mysql" + call:execute_tests "mssql" + ::call:execute_tests "ora" + call:execute_tests "pgsql" +) else ( + call:execute_tests "%1" +) goto:eof @@ -83,6 +102,9 @@ goto:eof if "%~1" == "mysql" mysql -u oc_autotest -powncloud -e "DROP DATABASE oc_autotest" if "%~1" == "pgsql" dropdb -h localhost -p 5432 -U oc_autotest -w oc_autotest + + :: we assume a sqlexpress installation + if "%~1" == "mssql" sqlcmd -S localhost\sqlexpress -U oc_autotext -P owncloud -Q "IF EXISTS (SELECT name FROM sys.databases WHERE name=N'oc_autotest') DROP DATABASE [oc_autotest]" :: copy autoconfig copy /y %BASEDIR%\tests\autoconfig-%~1.php %BASEDIR%\config\autoconfig.php @@ -96,9 +118,8 @@ goto:eof rmdir /s /q coverage-html-%~1 md coverage-html-%~1 php -f enable_all.php - ::phpunit --log-junit autotest-results-%~1.xml --coverage-clover autotest-clover-%~1.xml --coverage-html coverage-html-%~1 - ::phpunit --bootstrap bootstrap.php --configuration phpunit.xml - php win32-phpunit.php --bootstrap bootstrap.php --configuration phpunit.xml --log-junit autotest-results-%~1.xml --coverage-clover autotest-clover-%~1.xml --coverage-html coverage-html-%~1 + + php win32-phpunit.php --bootstrap bootstrap.php --configuration phpunit-autotest.xml --log-junit autotest-results-%~1.xml --coverage-clover autotest-clover-%~1.xml --coverage-html coverage-html-%~1 echo "Done with testing %~1 ..." cd %BASEDIR% goto:eof @@ -114,4 +135,10 @@ goto:eof :: - to enable dropdb I decided to add following line to pg_hba.conf (this is not the safest way but I don't care for the testing machine): :: local all all trust :: +:: NOTES on mssql: +:: we assume the usage of a local installed sqlexpress +:: create a user 'oc_autotest' with password 'owncloud' and assign the server role 'dbcreator' +:: make sure the sqlserver is configured to allow sql authentication +:: + From d577f790c8cbcf4f8dce74f9991e4bd62e21f949 Mon Sep 17 00:00:00 2001 From: Tobias Ramforth Date: Fri, 8 Feb 2013 00:00:51 +0100 Subject: [PATCH 02/54] Added MS SQL Server support --- core/js/setup.js | 7 ++ core/setup.php | 2 + core/templates/installation.php | 20 +++- lib/db.php | 180 +++++++++++++++++++++++++++++++- lib/setup.php | 148 +++++++++++++++++++++++++- 5 files changed, 346 insertions(+), 11 deletions(-) diff --git a/core/js/setup.js b/core/js/setup.js index 9aded6591c..fb6e7c5097 100644 --- a/core/js/setup.js +++ b/core/js/setup.js @@ -5,6 +5,7 @@ $(document).ready(function() { mysql:!!$('#hasMySQL').val(), postgresql:!!$('#hasPostgreSQL').val(), oracle:!!$('#hasOracle').val(), + mssql:!!$('#hasMSSQL').val() }; $('#selectDbType').buttonset(); @@ -41,6 +42,12 @@ $(document).ready(function() { $('#dbhost').show(250); $('#dbhostlabel').show(250); }); + + $('#mssql').click(function() { + $('#use_other_db').slideDown(250); + $('#dbhost').show(250); + $('#dbhostlabel').show(250); + }); $('input[checked]').trigger('click'); diff --git a/core/setup.php b/core/setup.php index 66b8cf378b..0da9b35a35 100644 --- a/core/setup.php +++ b/core/setup.php @@ -16,6 +16,7 @@ $hasSQLite = class_exists('SQLite3'); $hasMySQL = is_callable('mysql_connect'); $hasPostgreSQL = is_callable('pg_connect'); $hasOracle = is_callable('oci_connect'); +$hasMSSQL = is_callable('sqlsrv_connect'); $datadir = OC_Config::getValue('datadirectory', OC::$SERVERROOT.'/data'); // Protect data directory here, so we can test if the protection is working @@ -26,6 +27,7 @@ $opts = array( 'hasMySQL' => $hasMySQL, 'hasPostgreSQL' => $hasPostgreSQL, 'hasOracle' => $hasOracle, + 'hasMSSQLServer' => $hasMSSQL, 'directory' => $datadir, 'secureRNG' => OC_Util::secureRNG_available(), 'htaccessWorking' => OC_Util::ishtaccessworking(), diff --git a/core/templates/installation.php b/core/templates/installation.php index 03c580c9b0..6a6370785d 100644 --- a/core/templates/installation.php +++ b/core/templates/installation.php @@ -2,6 +2,7 @@ '> '> '> +'>
0): ?> @@ -55,7 +56,7 @@
- + t( 'Configure the database' ); ?>
@@ -71,7 +72,7 @@ - +

MySQL t( 'will be used' ); ?>.

@@ -81,7 +82,7 @@ - +

PostgreSQL t( 'will be used' ); ?>.

@@ -91,7 +92,7 @@ - +

Oracle t( 'will be used' ); ?>.

@@ -99,6 +100,17 @@ /> + + + + +

MS SQL t( 'will be used' ); ?>.

+ + + + /> + +
diff --git a/lib/db.php b/lib/db.php index 51f7c7679d..58f46c1171 100644 --- a/lib/db.php +++ b/lib/db.php @@ -178,6 +178,13 @@ class OC_DB { $dsn = 'oci:dbname=//' . $host . '/' . $name; } break; + case 'mssql': + if ($port) { + $dsn='sqlsrv:Server='.$host.','.$port.';Database='.$name; + } else { + $dsn='sqlsrv:Server='.$host.';Database='.$name; + } + break; default: return false; } @@ -277,6 +284,15 @@ class OC_DB { $dsn['database'] = $user; } break; + case 'mssql': + $dsn = array( + 'phptype' => 'sqlsrv', + 'username' => $user, + 'password' => $pass, + 'hostspec' => $host, + 'database' => $name + ); + break; default: return false; } @@ -540,7 +556,7 @@ class OC_DB { * http://www.sqlite.org/lang_createtable.html * http://docs.oracle.com/cd/B19306_01/server.102/b14200/functions037.htm */ - if( $CONFIG_DBTYPE == 'pgsql' ) { //mysql support it too but sqlite doesn't + if( $CONFIG_DBTYPE == 'pgsql' || 'mssql') { //mysql support it too but sqlite doesn't $content = str_replace( '0000-00-00 00:00:00', 'CURRENT_TIMESTAMP', $content ); } file_put_contents( $file2, $content ); @@ -624,7 +640,7 @@ class OC_DB { } else { return true; } - } elseif( $type == 'pgsql' || $type == 'oci' || $type == 'mysql') { + } elseif( $type == 'pgsql' || $type == 'oci' || $type == 'mysql' || $type == 'mssql') { $query = 'INSERT INTO `' .$table . '` (' . implode(',', array_keys($input)) . ') SELECT \'' . implode('\',\'', array_values($input)) . '\' FROM ' . $table . ' WHERE '; @@ -683,7 +699,15 @@ class OC_DB { }elseif( $type == 'oci' ) { $query = str_replace( '`', '"', $query ); $query = str_ireplace( 'NOW()', 'CURRENT_TIMESTAMP', $query ); - } + }elseif( $type == 'mssql' ) { + $query = preg_replace( "/\`(.*?)`/", "[$1]", $query ); + $query = str_replace( 'NOW()', 'CURRENT_TIMESTAMP', $query ); + $query = str_replace( 'now()', 'CURRENT_TIMESTAMP', $query ); + $query = str_replace( 'LENGTH(', 'LEN(', $query ); + $query = str_replace( 'SUBSTR(', 'SUBSTRING(', $query ); + + $query = self::fixLimitClauseForMSSQL($query); + } // replace table name prefix $query = str_replace( '*PREFIX*', $prefix, $query ); @@ -691,6 +715,60 @@ class OC_DB { return $query; } + private static function fixLimitClauseForMSSQL($query) { + $limitLocation = stripos ($query, "LIMIT"); + + if ( $limitLocation === false ) { + return $query; + } + + // total == 0 means all results - not zero results + // + // First number is either total or offset, locate it by first space + // + $offset = substr ($query, $limitLocation + 5); + $offset = substr ($offset, 0, stripos ($offset, ' ')); + $offset = trim ($offset); + + // check for another parameter + if (stripos ($offset, ',') === false) { + // no more parameters + $offset = 0; + $total = intval ($offset); + } else { + // found another parameter + $offset = intval ($offset); + + $total = substr ($query, $limitLocation + 5); + $total = substr ($total, stripos ($total, ',')); + + $total = substr ($total, 0, stripos ($total, ' ')); + $total = intval ($total); + } + + $query = trim (substr ($query, 0, $limitLocation)); + + if ($offset == 0 && $total !== 0) { + if (strpos($query, "SELECT") === false) { + $query = "TOP {$total} " . $query; + } else { + $query = preg_replace('/SELECT(\s*DISTINCT)?/Dsi', 'SELECT$1 TOP '.$total, $query); + } + } else if ($offset > 0) { + $query = preg_replace('/SELECT(\s*DISTINCT)?/Dsi', 'SELECT$1 TOP(10000000) ', $query); + $query = 'SELECT * + FROM (SELECT sub2.*, ROW_NUMBER() OVER(ORDER BY sub2.line2) AS line3 + FROM (SELECT 1 AS line2, sub1.* FROM (' . $query . ') AS sub1) as sub2) AS sub3'; + + if ($total > 0) { + $query .= ' WHERE line3 BETWEEN ' . ($offset + 1) . ' AND ' . ($offset + $total); + } else { + $query .= ' WHERE line3 > ' . $offset; + } + } + return $query; + } + /** * @brief drop a table * @param string $tableName the table to drop @@ -844,6 +922,14 @@ class PDOStatementWrapper{ public function execute($input=array()) { $this->lastArguments=$input; if(count($input)>0) { + if (!isset($type)) { + $type = OC_Config::getValue( "dbtype", "sqlite" ); + } + + if ($type == 'mssql') { + $this->tryFixSubstringLastArgumentDataForMSSQL($input); + } + $result=$this->statement->execute($input); }else{ $result=$this->statement->execute(); @@ -855,6 +941,94 @@ class PDOStatementWrapper{ } } + private function tryFixSubstringLastArgumentDataForMSSQL(&$input) { + $query = $this->statement->queryString; + $pos = stripos ($query, 'SUBSTRING'); + + if ( $pos === false) { + return; + } + + try { + $newQuery = ''; + + $cArg = 0; + + $inSubstring = false; + + // Create new query + for ($i = 0; $i < strlen ($query); $i++) { + if ($inSubstring == false) { + // Defines when we should start inserting values + if (substr ($query, $i, 9) == 'SUBSTRING') { + $inSubstring = true; + } + } else { + // Defines when we should stop inserting values + if (substr ($query, $i, 1) == ')') { + $inSubstring = false; + } + } + + if (substr ($query, $i, 1) == '?') { + // We found a question mark + if ($inSubstring) { + $newQuery .= $input[$cArg]; + + // + // Remove from input array + // + array_splice ($input, $cArg, 1); + } else { + $newQuery .= substr ($query, $i, 1); + $cArg++; + } + } else { + $newQuery .= substr ($query, $i, 1); + } + } + + // The global data we need + $name = OC_Config::getValue( "dbname", "owncloud" ); + $host = OC_Config::getValue( "dbhost", "" ); + $user = OC_Config::getValue( "dbuser", "" ); + $pass = OC_Config::getValue( "dbpassword", "" ); + if (strpos($host,':')) { + list($host, $port) = explode(':', $host, 2); + } else { + $port = false; + } + $opts = array(); + + if ($port) { + $dsn = 'sqlsrv:Server='.$host.','.$port.';Database='.$name; + } else { + $dsn = 'sqlsrv:Server='.$host.';Database='.$name; + } + + $PDO = new PDO($dsn, $user, $pass, $opts); + $PDO->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC); + $PDO->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + + $this->statement = $PDO->prepare($newQuery); + + $this->lastArguments = $input; + } catch (PDOException $e){ + $entry = 'PDO DB Error: "'.$e->getMessage().'"
'; + $entry .= 'Offending command was: '.$this->statement->queryString .'
'; + $entry .= 'Input parameters: ' .print_r($input, true).'
'; + $entry .= 'Stack trace: ' .$e->getTraceAsString().'
'; + OC_Log::write('core', $entry, OC_Log::FATAL); + OC_User::setUserId(null); + + // send http status 503 + header('HTTP/1.1 503 Service Temporarily Unavailable'); + header('Status: 503 Service Temporarily Unavailable'); + OC_Template::printErrorPage('Failed to connect to database'); + die ($entry); + } + } + /** * provide numRows */ diff --git a/lib/setup.php b/lib/setup.php index 4dd190b99f..d4ea26354e 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -33,12 +33,14 @@ class OC_Setup { $error[] = 'Specify a data folder.'; } - if($dbtype=='mysql' or $dbtype == 'pgsql' or $dbtype == 'oci') { //mysql and postgresql needs more config options - if($dbtype=='mysql') + if($dbtype == 'mysql' or $dbtype == 'pgsql' or $dbtype == 'oci' or $dbtype == 'mssql') { //mysql and postgresql needs more config options + if($dbtype == 'mysql') $dbprettyname = 'MySQL'; - else if($dbtype=='pgsql') + else if($dbtype == 'pgsql') $dbprettyname = 'PostgreSQL'; - else + else if ($dbtype == 'mssql') + $dbprettyname = 'MS SQL Server'; + else $dbprettyname = 'Oracle'; @@ -145,6 +147,29 @@ class OC_Setup { return $error; } } + elseif ($dbtype == 'mssql') { + $dbuser = $options['dbuser']; + $dbpass = $options['dbpass']; + $dbname = $options['dbname']; + $dbhost = $options['dbhost']; + $dbtableprefix = isset($options['dbtableprefix']) ? $options['dbtableprefix'] : 'oc_'; + + OC_Config::setValue('dbname', $dbname); + OC_Config::setValue('dbhost', $dbhost); + OC_Config::setValue('dbuser', $dbuser); + OC_Config::setValue('dbpassword', $dbpass); + OC_Config::setValue('dbtableprefix', $dbtableprefix); + + try { + self::setupMSSQLDatabase($dbhost, $dbuser, $dbpass, $dbname, $dbtableprefix); + } catch (Exception $e) { + $error[] = array( + 'error' => 'MS SQL username and/or password not valid', + 'hint' => 'You need to enter either an existing account or the administrator.' + ); + return $error; + } + } else { //delete the old sqlite database first, might cause infinte loops otherwise if(file_exists("$datadir/owncloud.db")) { @@ -563,6 +588,121 @@ class OC_Setup { } } + private static function setupMSSQLDatabase($dbhost, $dbuser, $dbpass, $dbname, $dbtableprefix) { + //check if the database user has admin right + $masterConnectionInfo = array( "Database" => "master", "UID" => $dbuser, "PWD" => $dbpass); + + $masterConnection = @sqlsrv_connect($dbhost, $masterConnectionInfo); + if(!$masterConnection) { + $entry = null; + if( ($errors = sqlsrv_errors() ) != null) { + $entry='DB Error: "'.print_r(sqlsrv_errors()).'"
'; + } else { + $entry = ''; + } + throw new Exception('MS SQL username and/or password not valid: '.$entry); + } + + OC_Config::setValue('dbuser', $dbuser); + OC_Config::setValue('dbpassword', $dbpass); + + self::mssql_createDBLogin($dbuser, $dbpass, $masterConnection); + + self::mssql_createDatabase($dbname, $masterConnection); + + self::mssql_createDBUser($dbuser, $dbpass, $masterConnection); + + sqlsrv_close($masterConnection); + + $connectionInfo = array( "Database" => $dbname, "UID" => $dbuser, "PWD" => $dbpass); + + $connection = @sqlsrv_connect($dbhost, $connectionInfo); + + //fill the database if needed + $query="SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = '{$dbname}' AND TABLE_NAME = '{$dbtableprefix}users'"; + $result = sqlsrv_query($connection, $query); + if($result) { + $row=sqlsrv_fetch_array($result); + } + + if(!$result or $row[0] == 0) { + OC_DB::createDbFromStructure('db_structure.xml'); + } + + sqlsrv_close($connection); + } + + private static function mssql_createDBLogin($name, $password, $connection) { + $query = "SELECT * FROM master.sys.server_principals WHERE name = '".$name."';"; + $result = sqlsrv_query($connection, $query); + if ($result) { + $row = sqlsrv_fetch_array($result); + } + + if (!$result or $row[0] == 0) { + $query = "CREATE LOGIN [".$name."] WITH PASSWORD = '".$password."';"; + $result = sqlsrv_query($connection, $query); + if (!$result or $result === false) { + if ( ($errors = sqlsrv_errors() ) != null) { + $entry='DB Error: "'.print_r(sqlsrv_errors()).'"
'; + } else { + $entry = ''; + } + $entry.='Offending command was: '.$query.'
'; + echo($entry); + } + } + } + + private static function mssql_createDBUser($name, $dbname, $connection) { + $query = "SELECT * FROM [".$dbname."].sys.database_principals WHERE name = '".$name."';"; + $result = sqlsrv_query($connection, $query); + if($result) { + $row=sqlsrv_fetch_array($result); + } + + if (!$result or $row[0] == 0) { + $query = "USE [".$dbname."]; CREATE USER [".$name."] FOR LOGIN [".$name."];"; + $result = sqlsrv_query($connection, $query); + if (!$result or $result === false) { + if ( ($errors = sqlsrv_errors() ) != null) { + $entry='DB Error: "'.print_r(sqlsrv_errors()).'"
'; + } else { + $entry = ''; + } + $entry.='Offending command was: '.$query.'
'; + echo($entry); + } + } + + $query = "USE [".$dbname."]; EXEC sp_addrolemember 'db_owner', '".$name."';"; + $result = sqlsrv_query($connection, $query); + if (!$result or $result === false) { + if ( ($errors = sqlsrv_errors() ) != null) { + $entry='DB Error: "'.print_r(sqlsrv_errors()).'"
'; + } else { + $entry = ''; + } + $entry.='Offending command was: '.$query.'
'; + echo($entry); + } + } + + private static function mssql_createDatabase($dbname, $connection) { + $query = "CREATE DATABASE [".$dbname."];"; + $result = sqlsrv_query($connection, $query); + if (!$result or $result === false) { + if ( ($errors = sqlsrv_errors() ) != null) { + $entry='DB Error: "'.print_r(sqlsrv_errors()).'"
'; + } else { + $entry = ''; + } + $entry.='Offending command was: '.$query.'
'; + echo($entry); + } + } + + /** * create .htaccess files for apache hosts */ From 41ec976fd74320c379f95d05d3a490310f06402e Mon Sep 17 00:00:00 2001 From: Administrator Date: Sun, 10 Feb 2013 13:07:59 +0100 Subject: [PATCH 03/54] Bugfixes and cleanup MS SQL Server installation --- core/js/setup.js | 4 +- core/setup.php | 2 +- core/templates/installation.php | 2 +- lib/db.php | 36 +++--- lib/setup.php | 191 +++++++++++++++++++++----------- 5 files changed, 148 insertions(+), 87 deletions(-) diff --git a/core/js/setup.js b/core/js/setup.js index fb6e7c5097..cb8392d0a3 100644 --- a/core/js/setup.js +++ b/core/js/setup.js @@ -5,7 +5,7 @@ $(document).ready(function() { mysql:!!$('#hasMySQL').val(), postgresql:!!$('#hasPostgreSQL').val(), oracle:!!$('#hasOracle').val(), - mssql:!!$('#hasMSSQL').val() + mssql:!!$('#hasMSSQL').val() }; $('#selectDbType').buttonset(); @@ -43,7 +43,7 @@ $(document).ready(function() { $('#dbhostlabel').show(250); }); - $('#mssql').click(function() { + $('#mssql').click(function() { $('#use_other_db').slideDown(250); $('#dbhost').show(250); $('#dbhostlabel').show(250); diff --git a/core/setup.php b/core/setup.php index 0da9b35a35..6ea16cdcc4 100644 --- a/core/setup.php +++ b/core/setup.php @@ -27,7 +27,7 @@ $opts = array( 'hasMySQL' => $hasMySQL, 'hasPostgreSQL' => $hasPostgreSQL, 'hasOracle' => $hasOracle, - 'hasMSSQLServer' => $hasMSSQL, + 'hasMSSQL' => $hasMSSQL, 'directory' => $datadir, 'secureRNG' => OC_Util::secureRNG_available(), 'htaccessWorking' => OC_Util::ishtaccessworking(), diff --git a/core/templates/installation.php b/core/templates/installation.php index 6a6370785d..4a41527c90 100644 --- a/core/templates/installation.php +++ b/core/templates/installation.php @@ -107,7 +107,7 @@

MS SQL t( 'will be used' ); ?>.

- + /> diff --git a/lib/db.php b/lib/db.php index 58f46c1171..c3ff481e19 100644 --- a/lib/db.php +++ b/lib/db.php @@ -284,7 +284,7 @@ class OC_DB { $dsn['database'] = $user; } break; - case 'mssql': + case 'mssql': $dsn = array( 'phptype' => 'sqlsrv', 'username' => $user, @@ -292,7 +292,7 @@ class OC_DB { 'hostspec' => $host, 'database' => $name ); - break; + break; default: return false; } @@ -920,28 +920,30 @@ class PDOStatementWrapper{ * make execute return the result instead of a bool */ public function execute($input=array()) { - $this->lastArguments=$input; - if(count($input)>0) { - if (!isset($type)) { - $type = OC_Config::getValue( "dbtype", "sqlite" ); - } - - if ($type == 'mssql') { - $this->tryFixSubstringLastArgumentDataForMSSQL($input); - } - + $this->lastArguments = $input; + if (count($input) > 0) { + + if (!isset($type)) { + $type = OC_Config::getValue( "dbtype", "sqlite" ); + } + + if ($type == 'mssql') { + $input = $this->tryFixSubstringLastArgumentDataForMSSQL($input); + } + $result=$this->statement->execute($input); - }else{ + } else { $result=$this->statement->execute(); } - if($result) { + + if ($result) { return $this; - }else{ + } else { return false; } } - private function tryFixSubstringLastArgumentDataForMSSQL(&$input) { + private function tryFixSubstringLastArgumentDataForMSSQL($input) { $query = $this->statement->queryString; $pos = stripos ($query, 'SUBSTRING'); @@ -1013,6 +1015,8 @@ class PDOStatementWrapper{ $this->statement = $PDO->prepare($newQuery); $this->lastArguments = $input; + + return $input; } catch (PDOException $e){ $entry = 'PDO DB Error: "'.$e->getMessage().'"
'; $entry .= 'Offending command was: '.$this->statement->queryString .'
'; diff --git a/lib/setup.php b/lib/setup.php index d4ea26354e..3efad79cfa 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -610,98 +610,155 @@ class OC_Setup { self::mssql_createDatabase($dbname, $masterConnection); - self::mssql_createDBUser($dbuser, $dbpass, $masterConnection); + self::mssql_createDBUser($dbuser, $dbname, $masterConnection); sqlsrv_close($masterConnection); - $connectionInfo = array( "Database" => $dbname, "UID" => $dbuser, "PWD" => $dbpass); - - $connection = @sqlsrv_connect($dbhost, $connectionInfo); - - //fill the database if needed - $query="SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = '{$dbname}' AND TABLE_NAME = '{$dbtableprefix}users'"; - $result = sqlsrv_query($connection, $query); - if($result) { - $row=sqlsrv_fetch_array($result); - } - - if(!$result or $row[0] == 0) { - OC_DB::createDbFromStructure('db_structure.xml'); - } - - sqlsrv_close($connection); + self::mssql_createDatabaseStructure($dbname, $dbuser, $dbpass); } private static function mssql_createDBLogin($name, $password, $connection) { $query = "SELECT * FROM master.sys.server_principals WHERE name = '".$name."';"; $result = sqlsrv_query($connection, $query); - if ($result) { + if ($result === false) { + if ( ($errors = sqlsrv_errors() ) != null) { + $entry='DB Error: "'.print_r(sqlsrv_errors()).'"
'; + } else { + $entry = ''; + } + $entry.='Offending command was: '.$query.'
'; + echo($entry); + } else { $row = sqlsrv_fetch_array($result); - } - if (!$result or $row[0] == 0) { - $query = "CREATE LOGIN [".$name."] WITH PASSWORD = '".$password."';"; - $result = sqlsrv_query($connection, $query); - if (!$result or $result === false) { - if ( ($errors = sqlsrv_errors() ) != null) { - $entry='DB Error: "'.print_r(sqlsrv_errors()).'"
'; - } else { - $entry = ''; - } - $entry.='Offending command was: '.$query.'
'; - echo($entry); - } + if ($row === false) { + if ( ($errors = sqlsrv_errors() ) != null) { + $entry='DB Error: "'.print_r(sqlsrv_errors()).'"
'; + } else { + $entry = ''; + } + $entry.='Offending command was: '.$query.'
'; + echo($entry); + } else { + if ($row == null) { + $query = "CREATE LOGIN [".$name."] WITH PASSWORD = '".$password."';"; + $result = sqlsrv_query($connection, $query); + if (!$result or $result === false) { + if ( ($errors = sqlsrv_errors() ) != null) { + $entry='DB Error: "'.print_r(sqlsrv_errors()).'"
'; + } else { + $entry = ''; + } + $entry.='Offending command was: '.$query.'
'; + echo($entry); + } + } + } } } private static function mssql_createDBUser($name, $dbname, $connection) { $query = "SELECT * FROM [".$dbname."].sys.database_principals WHERE name = '".$name."';"; $result = sqlsrv_query($connection, $query); - if($result) { - $row=sqlsrv_fetch_array($result); + if ($result === false) { + if ( ($errors = sqlsrv_errors() ) != null) { + $entry='DB Error: "'.print_r(sqlsrv_errors()).'"
'; + } else { + $entry = ''; + } + $entry.='Offending command was: '.$query.'
'; + echo($entry); + } else { + $row = sqlsrv_fetch_array($result); + + if ($row === false) { + if ( ($errors = sqlsrv_errors() ) != null) { + $entry='DB Error: "'.print_r(sqlsrv_errors()).'"
'; + } else { + $entry = ''; + } + $entry.='Offending command was: '.$query.'
'; + echo($entry); + } else { + if ($row == null) { + $query = "USE [".$dbname."]; CREATE USER [".$name."] FOR LOGIN [".$name."];"; + $result = sqlsrv_query($connection, $query); + if (!$result || $result === false) { + if ( ($errors = sqlsrv_errors() ) != null) { + $entry = 'DB Error: "'.print_r(sqlsrv_errors()).'"
'; + } else { + $entry = ''; + } + $entry.='Offending command was: '.$query.'
'; + echo($entry); + } + } + + $query = "USE [".$dbname."]; EXEC sp_addrolemember 'db_owner', '".$name."';"; + $result = sqlsrv_query($connection, $query); + if (!$result || $result === false) { + if ( ($errors = sqlsrv_errors() ) != null) { + $entry='DB Error: "'.print_r(sqlsrv_errors()).'"
'; + } else { + $entry = ''; + } + $entry.='Offending command was: '.$query.'
'; + echo($entry); + } + } } - - if (!$result or $row[0] == 0) { - $query = "USE [".$dbname."]; CREATE USER [".$name."] FOR LOGIN [".$name."];"; - $result = sqlsrv_query($connection, $query); - if (!$result or $result === false) { - if ( ($errors = sqlsrv_errors() ) != null) { - $entry='DB Error: "'.print_r(sqlsrv_errors()).'"
'; - } else { - $entry = ''; - } - $entry.='Offending command was: '.$query.'
'; - echo($entry); - } - } - - $query = "USE [".$dbname."]; EXEC sp_addrolemember 'db_owner', '".$name."';"; - $result = sqlsrv_query($connection, $query); - if (!$result or $result === false) { - if ( ($errors = sqlsrv_errors() ) != null) { - $entry='DB Error: "'.print_r(sqlsrv_errors()).'"
'; - } else { - $entry = ''; - } - $entry.='Offending command was: '.$query.'
'; - echo($entry); - } } private static function mssql_createDatabase($dbname, $connection) { $query = "CREATE DATABASE [".$dbname."];"; $result = sqlsrv_query($connection, $query); - if (!$result or $result === false) { - if ( ($errors = sqlsrv_errors() ) != null) { - $entry='DB Error: "'.print_r(sqlsrv_errors()).'"
'; - } else { - $entry = ''; - } - $entry.='Offending command was: '.$query.'
'; - echo($entry); + if (!$result || $result === false) { + if ( ($errors = sqlsrv_errors() ) != null) { + $entry='DB Error: "'.print_r(sqlsrv_errors()).'"
'; + } else { + $entry = ''; + } + $entry.='Offending command was: '.$query.'
'; + echo($entry); } } + private static function mssql_createDatabaseStructure($dbname, $dbuser, $dbpass) { + $connectionInfo = array( "Database" => $dbname, "UID" => $dbuser, "PWD" => $dbpass); + + $connection = @sqlsrv_connect($dbhost, $connectionInfo); + + //fill the database if needed + $query = "SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = '{$dbname}' AND TABLE_NAME = '{$dbtableprefix}users'"; + $result = sqlsrv_query($connection, $query); + if ($result === false) { + if ( ($errors = sqlsrv_errors() ) != null) { + $entry='DB Error: "'.print_r(sqlsrv_errors()).'"
'; + } else { + $entry = ''; + } + $entry.='Offending command was: '.$query.'
'; + echo($entry); + } else { + $row = sqlsrv_fetch_array($result); + + if ($row === false) { + if ( ($errors = sqlsrv_errors() ) != null) { + $entry='DB Error: "'.print_r(sqlsrv_errors()).'"
'; + } else { + $entry = ''; + } + $entry.='Offending command was: '.$query.'
'; + echo($entry); + } else { + if ($row == null) { + OC_DB::createDbFromStructure('db_structure.xml'); + } + } + } + + sqlsrv_close($connection); + } /** * create .htaccess files for apache hosts From 4e5a3fbcafcaa0cdaba351dfb307b0000179c832 Mon Sep 17 00:00:00 2001 From: Administrator Date: Sun, 10 Feb 2013 14:08:00 +0100 Subject: [PATCH 04/54] - Fixed indentations. - Fixed a bug in legacy.php: there was an error that was not checked for if the table 'fscache' did not exist in the database. --- lib/db.php | 144 ++++++++++++++++++------------------- lib/files/cache/legacy.php | 6 ++ 2 files changed, 78 insertions(+), 72 deletions(-) diff --git a/lib/db.php b/lib/db.php index c3ff481e19..3ccd51737a 100644 --- a/lib/db.php +++ b/lib/db.php @@ -943,95 +943,95 @@ class PDOStatementWrapper{ } } - private function tryFixSubstringLastArgumentDataForMSSQL($input) { - $query = $this->statement->queryString; - $pos = stripos ($query, 'SUBSTRING'); - - if ( $pos === false) { - return; - } - - try { - $newQuery = ''; + private function tryFixSubstringLastArgumentDataForMSSQL($input) { + $query = $this->statement->queryString; + $pos = stripos ($query, 'SUBSTRING'); - $cArg = 0; + if ( $pos === false) { + return; + } - $inSubstring = false; + try { + $newQuery = ''; - // Create new query - for ($i = 0; $i < strlen ($query); $i++) { - if ($inSubstring == false) { - // Defines when we should start inserting values - if (substr ($query, $i, 9) == 'SUBSTRING') { - $inSubstring = true; - } - } else { - // Defines when we should stop inserting values - if (substr ($query, $i, 1) == ')') { - $inSubstring = false; - } - } + $cArg = 0; - if (substr ($query, $i, 1) == '?') { - // We found a question mark - if ($inSubstring) { - $newQuery .= $input[$cArg]; + $inSubstring = false; - // - // Remove from input array - // - array_splice ($input, $cArg, 1); - } else { - $newQuery .= substr ($query, $i, 1); - $cArg++; - } - } else { - $newQuery .= substr ($query, $i, 1); - } - } + // Create new query + for ($i = 0; $i < strlen ($query); $i++) { + if ($inSubstring == false) { + // Defines when we should start inserting values + if (substr ($query, $i, 9) == 'SUBSTRING') { + $inSubstring = true; + } + } else { + // Defines when we should stop inserting values + if (substr ($query, $i, 1) == ')') { + $inSubstring = false; + } + } - // The global data we need - $name = OC_Config::getValue( "dbname", "owncloud" ); - $host = OC_Config::getValue( "dbhost", "" ); - $user = OC_Config::getValue( "dbuser", "" ); - $pass = OC_Config::getValue( "dbpassword", "" ); - if (strpos($host,':')) { - list($host, $port) = explode(':', $host, 2); - } else { - $port = false; - } - $opts = array(); + if (substr ($query, $i, 1) == '?') { + // We found a question mark + if ($inSubstring) { + $newQuery .= $input[$cArg]; - if ($port) { - $dsn = 'sqlsrv:Server='.$host.','.$port.';Database='.$name; - } else { - $dsn = 'sqlsrv:Server='.$host.';Database='.$name; - } + // + // Remove from input array + // + array_splice ($input, $cArg, 1); + } else { + $newQuery .= substr ($query, $i, 1); + $cArg++; + } + } else { + $newQuery .= substr ($query, $i, 1); + } + } - $PDO = new PDO($dsn, $user, $pass, $opts); - $PDO->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC); - $PDO->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + // The global data we need + $name = OC_Config::getValue( "dbname", "owncloud" ); + $host = OC_Config::getValue( "dbhost", "" ); + $user = OC_Config::getValue( "dbuser", "" ); + $pass = OC_Config::getValue( "dbpassword", "" ); + if (strpos($host,':')) { + list($host, $port) = explode(':', $host, 2); + } else { + $port = false; + } + $opts = array(); - $this->statement = $PDO->prepare($newQuery); + if ($port) { + $dsn = 'sqlsrv:Server='.$host.','.$port.';Database='.$name; + } else { + $dsn = 'sqlsrv:Server='.$host.';Database='.$name; + } - $this->lastArguments = $input; - - return $input; - } catch (PDOException $e){ + $PDO = new PDO($dsn, $user, $pass, $opts); + $PDO->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC); + $PDO->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + + $this->statement = $PDO->prepare($newQuery); + + $this->lastArguments = $input; + + return $input; + } catch (PDOException $e){ $entry = 'PDO DB Error: "'.$e->getMessage().'"
'; $entry .= 'Offending command was: '.$this->statement->queryString .'
'; $entry .= 'Input parameters: ' .print_r($input, true).'
'; $entry .= 'Stack trace: ' .$e->getTraceAsString().'
'; OC_Log::write('core', $entry, OC_Log::FATAL); - OC_User::setUserId(null); + OC_User::setUserId(null); - // send http status 503 - header('HTTP/1.1 503 Service Temporarily Unavailable'); - header('Status: 503 Service Temporarily Unavailable'); - OC_Template::printErrorPage('Failed to connect to database'); - die ($entry); + // send http status 503 + header('HTTP/1.1 503 Service Temporarily Unavailable'); + header('Status: 503 Service Temporarily Unavailable'); + OC_Template::printErrorPage('Failed to connect to database'); + die ($entry); } - } + } /** * provide numRows diff --git a/lib/files/cache/legacy.php b/lib/files/cache/legacy.php index 33d4b8e7c9..bdc3cbf00b 100644 --- a/lib/files/cache/legacy.php +++ b/lib/files/cache/legacy.php @@ -51,6 +51,12 @@ class Legacy { $this->cacheHasItems = false; return false; } + + if ($result === false || property_exists($result, 'error_message_prefix')) { + $this->cacheHasItems = false; + return false; + } + $this->cacheHasItems = (bool)$result->fetchRow(); return $this->cacheHasItems; } From 0c31c3cc3a928e8ca9272d32d68163c0700697ea Mon Sep 17 00:00:00 2001 From: Thomas Mueller Date: Mon, 11 Feb 2013 23:46:32 +0100 Subject: [PATCH 05/54] fixing user for autotesting mssql --- autotest.cmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autotest.cmd b/autotest.cmd index e5ea0cf4c3..a511faef9c 100644 --- a/autotest.cmd +++ b/autotest.cmd @@ -104,7 +104,7 @@ goto:eof if "%~1" == "pgsql" dropdb -h localhost -p 5432 -U oc_autotest -w oc_autotest :: we assume a sqlexpress installation - if "%~1" == "mssql" sqlcmd -S localhost\sqlexpress -U oc_autotext -P owncloud -Q "IF EXISTS (SELECT name FROM sys.databases WHERE name=N'oc_autotest') DROP DATABASE [oc_autotest]" + if "%~1" == "mssql" sqlcmd -S localhost\sqlexpress -U oc_autotest -P owncloud -Q "IF EXISTS (SELECT name FROM sys.databases WHERE name=N'oc_autotest') DROP DATABASE [oc_autotest]" :: copy autoconfig copy /y %BASEDIR%\tests\autoconfig-%~1.php %BASEDIR%\config\autoconfig.php From b2dfdacaa1cb6d7839aed3b4d39adc6504a4beef Mon Sep 17 00:00:00 2001 From: Thomas Mueller Date: Tue, 12 Feb 2013 01:04:35 +0100 Subject: [PATCH 06/54] fixing undefined variables --- lib/setup.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/setup.php b/lib/setup.php index 893e0121ff..6f2899ed86 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -591,7 +591,7 @@ class OC_Setup { echo($entry); } } - // grant neccessary roles + // grant necessary roles $query = 'GRANT CREATE SESSION, CREATE TABLE, CREATE SEQUENCE, CREATE TRIGGER, UNLIMITED TABLESPACE TO '.$name; $stmt = oci_parse($connection, $query); if (!$stmt) { @@ -634,7 +634,7 @@ class OC_Setup { sqlsrv_close($masterConnection); - self::mssql_createDatabaseStructure($dbname, $dbuser, $dbpass); + self::mssql_createDatabaseStructure($dbhost, $dbname, $dbuser, $dbpass, $dbtableprefix); } private static function mssql_createDBLogin($name, $password, $connection) { @@ -730,7 +730,7 @@ class OC_Setup { } private static function mssql_createDatabase($dbname, $connection) { - $query = "CREATE DATABASE [".$dbname."];"; + $query = "CREATE DATABASE IF NOT EXISTS [".$dbname."];"; $result = sqlsrv_query($connection, $query); if (!$result || $result === false) { if ( ($errors = sqlsrv_errors() ) != null) { @@ -742,8 +742,10 @@ class OC_Setup { echo($entry); } } - - private static function mssql_createDatabaseStructure($dbname, $dbuser, $dbpass) { + + // private static function setupMSSQLDatabase($dbhost, $dbuser, $dbpass, $dbname, $dbtableprefix, $username) { + + private static function mssql_createDatabaseStructure($dbhost, $dbname, $dbuser, $dbpass, $dbtableprefix) { $connectionInfo = array( "Database" => $dbname, "UID" => $dbuser, "PWD" => $dbpass); $connection = @sqlsrv_connect($dbhost, $connectionInfo); From 81368510105c06be21c52a699f77da4764ae6a03 Mon Sep 17 00:00:00 2001 From: Thomas Mueller Date: Tue, 12 Feb 2013 01:05:47 +0100 Subject: [PATCH 07/54] fixing indent --- lib/setup.php | 70 +++++++++++++++++++++++++-------------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/lib/setup.php b/lib/setup.php index 6f2899ed86..a71e906a85 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -46,8 +46,8 @@ class OC_Setup { else if($dbtype == 'pgsql') $dbprettyname = 'PostgreSQL'; else if ($dbtype == 'mssql') - $dbprettyname = 'MS SQL Server'; - else + $dbprettyname = 'MS SQL Server'; + else $dbprettyname = 'Oracle'; @@ -100,7 +100,7 @@ class OC_Setup { $error[] = array( 'error' => $e->getMessage(), 'hint' => $e->getHint() - ); + ); return($error); } catch (Exception $e) { $error[] = array( @@ -154,13 +154,13 @@ class OC_Setup { return $error; } } - elseif ($dbtype == 'mssql') { + elseif ($dbtype == 'mssql') { $dbuser = $options['dbuser']; $dbpass = $options['dbpass']; $dbname = $options['dbname']; $dbhost = $options['dbhost']; $dbtableprefix = isset($options['dbtableprefix']) ? $options['dbtableprefix'] : 'oc_'; - + OC_Config::setValue('dbname', $dbname); OC_Config::setValue('dbhost', $dbhost); OC_Config::setValue('dbuser', $dbuser); @@ -176,7 +176,7 @@ class OC_Setup { ); return $error; } - } + } else { //delete the old sqlite database first, might cause infinte loops otherwise if(file_exists("$datadir/owncloud.db")) { @@ -199,7 +199,7 @@ class OC_Setup { OC_Appconfig::setValue('core', 'lastupdatedat', microtime(true)); OC_AppConfig::setValue('core', 'remote_core.css', '/core/minimizer.php'); OC_AppConfig::setValue('core', 'remote_core.js', '/core/minimizer.php'); - + OC_Group::createGroup('admin'); OC_Group::addToGroup($username, 'admin'); OC_User::login($username, $password); @@ -298,7 +298,7 @@ class OC_Setup { $query = "CREATE USER '$name'@'%' IDENTIFIED BY '$password'"; $result = mysql_query($query, $connection); if (!$result) { - throw new DatabaseSetupException($l->t("MySQL user '%s'@'%%' already exists", array($name)), + throw new DatabaseSetupException($l->t("MySQL user '%s'@'%%' already exists", array($name)), $l->t("Drop this user from MySQL.")); } } @@ -570,7 +570,7 @@ class OC_Setup { $result = oci_execute($stmt); if(!$result) { $entry = $l->t('DB Error: "%s"', array(oci_error($connection))) . '
'; - $entry .= $l->t('Offending command was: "%s", name: %s, password: %s', + $entry .= $l->t('Offending command was: "%s", name: %s, password: %s', array($query, $name, $password)) . '
'; echo($entry); } @@ -602,7 +602,7 @@ class OC_Setup { $result = oci_execute($stmt); if(!$result) { $entry = $l->t('DB Error: "%s"', array(oci_error($connection))) . '
'; - $entry .= $l->t('Offending command was: "%s", name: %s, password: %s', + $entry .= $l->t('Offending command was: "%s", name: %s, password: %s', array($query, $name, $password)) . '
'; echo($entry); } @@ -611,15 +611,15 @@ class OC_Setup { private static function setupMSSQLDatabase($dbhost, $dbuser, $dbpass, $dbname, $dbtableprefix) { //check if the database user has admin right $masterConnectionInfo = array( "Database" => "master", "UID" => $dbuser, "PWD" => $dbpass); - + $masterConnection = @sqlsrv_connect($dbhost, $masterConnectionInfo); if(!$masterConnection) { - $entry = null; - if( ($errors = sqlsrv_errors() ) != null) { - $entry='DB Error: "'.print_r(sqlsrv_errors()).'"
'; - } else { - $entry = ''; - } + $entry = null; + if( ($errors = sqlsrv_errors() ) != null) { + $entry='DB Error: "'.print_r(sqlsrv_errors()).'"
'; + } else { + $entry = ''; + } throw new Exception('MS SQL username and/or password not valid: '.$entry); } @@ -627,17 +627,17 @@ class OC_Setup { OC_Config::setValue('dbpassword', $dbpass); self::mssql_createDBLogin($dbuser, $dbpass, $masterConnection); - + self::mssql_createDatabase($dbname, $masterConnection); - + self::mssql_createDBUser($dbuser, $dbname, $masterConnection); sqlsrv_close($masterConnection); self::mssql_createDatabaseStructure($dbhost, $dbname, $dbuser, $dbpass, $dbtableprefix); - } + } - private static function mssql_createDBLogin($name, $password, $connection) { + private static function mssql_createDBLogin($name, $password, $connection) { $query = "SELECT * FROM master.sys.server_principals WHERE name = '".$name."';"; $result = sqlsrv_query($connection, $query); if ($result === false) { @@ -650,7 +650,7 @@ class OC_Setup { echo($entry); } else { $row = sqlsrv_fetch_array($result); - + if ($row === false) { if ( ($errors = sqlsrv_errors() ) != null) { $entry='DB Error: "'.print_r(sqlsrv_errors()).'"
'; @@ -671,7 +671,7 @@ class OC_Setup { } $entry.='Offending command was: '.$query.'
'; echo($entry); - } + } } } } @@ -690,7 +690,7 @@ class OC_Setup { echo($entry); } else { $row = sqlsrv_fetch_array($result); - + if ($row === false) { if ( ($errors = sqlsrv_errors() ) != null) { $entry='DB Error: "'.print_r(sqlsrv_errors()).'"
'; @@ -698,7 +698,7 @@ class OC_Setup { $entry = ''; } $entry.='Offending command was: '.$query.'
'; - echo($entry); + echo($entry); } else { if ($row == null) { $query = "USE [".$dbname."]; CREATE USER [".$name."] FOR LOGIN [".$name."];"; @@ -711,7 +711,7 @@ class OC_Setup { } $entry.='Offending command was: '.$query.'
'; echo($entry); - } + } } $query = "USE [".$dbname."]; EXEC sp_addrolemember 'db_owner', '".$name."';"; @@ -726,9 +726,9 @@ class OC_Setup { echo($entry); } } - } + } } - + private static function mssql_createDatabase($dbname, $connection) { $query = "CREATE DATABASE IF NOT EXISTS [".$dbname."];"; $result = sqlsrv_query($connection, $query); @@ -736,12 +736,12 @@ class OC_Setup { if ( ($errors = sqlsrv_errors() ) != null) { $entry='DB Error: "'.print_r(sqlsrv_errors()).'"
'; } else { - $entry = ''; + $entry = ''; } $entry.='Offending command was: '.$query.'
'; echo($entry); } - } + } // private static function setupMSSQLDatabase($dbhost, $dbuser, $dbpass, $dbname, $dbtableprefix, $username) { @@ -760,10 +760,10 @@ class OC_Setup { $entry = ''; } $entry.='Offending command was: '.$query.'
'; - echo($entry); + echo($entry); } else { $row = sqlsrv_fetch_array($result); - + if ($row === false) { if ( ($errors = sqlsrv_errors() ) != null) { $entry='DB Error: "'.print_r(sqlsrv_errors()).'"
'; @@ -771,17 +771,17 @@ class OC_Setup { $entry = ''; } $entry.='Offending command was: '.$query.'
'; - echo($entry); + echo($entry); } else { if ($row == null) { OC_DB::createDbFromStructure('db_structure.xml'); } } } - + sqlsrv_close($connection); } - + /** * create .htaccess files for apache hosts */ From 98d7e0f7cdaa53b3a8906d1a8f497f237130b44d Mon Sep 17 00:00:00 2001 From: Thomas Mueller Date: Tue, 12 Feb 2013 01:14:53 +0100 Subject: [PATCH 08/54] write any database messages / non critical errors to the log - don't pollute the browser --- lib/setup.php | 65 ++++++++++++++++++++++++++------------------------- 1 file changed, 33 insertions(+), 32 deletions(-) diff --git a/lib/setup.php b/lib/setup.php index a71e906a85..128c53269e 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -279,10 +279,11 @@ class OC_Setup { if(!$result) { $entry = $l->t('DB Error: "%s"', array(mysql_error($connection))) . '
'; $entry .= $l->t('Offending command was: "%s"', array($query)) . '
'; - echo($entry); + \OC_Log::write('setup.mssql', $entry, \OC_Log::WARN); } $query="GRANT ALL PRIVILEGES ON `$name` . * TO '$user'"; - $result = mysql_query($query, $connection); //this query will fail if there aren't the right permissons, ignore the error + //this query will fail if there aren't the right permissions, ignore the error + mysql_query($query, $connection); } private static function createDBUser($name, $password, $connection) { @@ -381,7 +382,7 @@ class OC_Setup { if(!$result) { $entry = $l->t('DB Error: "%s"', array(pg_last_error($connection))) . '
'; $entry .= $l->t('Offending command was: "%s"', array($query)) . '
'; - echo($entry); + \OC_Log::write('setup.pg', $entry, \OC_Log::WARN); } if(! pg_fetch_row($result)) { //The database does not exists... let's create it @@ -390,11 +391,11 @@ class OC_Setup { if(!$result) { $entry = $l->t('DB Error: "%s"', array(pg_last_error($connection))) . '
'; $entry .= $l->t('Offending command was: "%s"', array($query)) . '
'; - echo($entry); + \OC_Log::write('setup.pg', $entry, \OC_Log::WARN); } else { $query = "REVOKE ALL PRIVILEGES ON DATABASE \"$e_name\" FROM PUBLIC"; - $result = pg_query($connection, $query); + pg_query($connection, $query); } } } @@ -408,7 +409,7 @@ class OC_Setup { if(!$result) { $entry = $l->t('DB Error: "%s"', array(pg_last_error($connection))) . '
'; $entry .= $l->t('Offending command was: "%s"', array($query)) . '
'; - echo($entry); + \OC_Log::write('setup.pg', $entry, \OC_Log::WARN); } if(! pg_fetch_row($result)) { @@ -418,7 +419,7 @@ class OC_Setup { if(!$result) { $entry = $l->t('DB Error: "%s"', array(pg_last_error($connection))) . '
'; $entry .= $l->t('Offending command was: "%s"', array($query)) . '
'; - echo($entry); + \OC_Log::write('setup.pg', $entry, \OC_Log::WARN); } } else { // change password of the existing role @@ -427,7 +428,7 @@ class OC_Setup { if(!$result) { $entry = $l->t('DB Error: "%s"', array(pg_last_error($connection))) . '
'; $entry .= $l->t('Offending command was: "%s"', array($query)) . '
'; - echo($entry); + \OC_Log::write('setup.pg', $entry, \OC_Log::WARN); } } } @@ -454,7 +455,7 @@ class OC_Setup { if (!$stmt) { $entry = $l->t('DB Error: "%s"', array(oci_last_error($connection))) . '
'; $entry .= $l->t('Offending command was: "%s"', array($query)) . '
'; - echo($entry); + \OC_Log::write('setup.oci', $entry, \OC_Log::WARN); } $result = oci_execute($stmt); if($result) { @@ -518,9 +519,9 @@ class OC_Setup { $un = $dbtableprefix.'users'; oci_bind_by_name($stmt, ':un', $un); if (!$stmt) { - $entry = $l->t('DB Error: "%s"', array(oci_last_error($connection))) . '
'; + $entry = $l->t('DB Error: "%s"', array(oci_error($connection))) . '
'; $entry .= $l->t('Offending command was: "%s"', array($query)) . '
'; - echo($entry); + \OC_Log::write('setup.oci', $entry, \OC_Log::WARN); } $result = oci_execute($stmt); @@ -546,14 +547,14 @@ class OC_Setup { if (!$stmt) { $entry = $l->t('DB Error: "%s"', array(oci_error($connection))) . '
'; $entry .= $l->t('Offending command was: "%s"', array($query)) . '
'; - echo($entry); + \OC_Log::write('setup.oci', $entry, \OC_Log::WARN); } oci_bind_by_name($stmt, ':un', $name); $result = oci_execute($stmt); if(!$result) { $entry = $l->t('DB Error: "%s"', array(oci_error($connection))) . '
'; $entry .= $l->t('Offending command was: "%s"', array($query)) . '
'; - echo($entry); + \OC_Log::write('setup.oci', $entry, \OC_Log::WARN); } if(! oci_fetch_row($stmt)) { @@ -564,7 +565,7 @@ class OC_Setup { if (!$stmt) { $entry = $l->t('DB Error: "%s"', array(oci_error($connection))) . '
'; $entry .= $l->t('Offending command was: "%s"', array($query)) . '
'; - echo($entry); + \OC_Log::write('setup.oci', $entry, \OC_Log::WARN); } //oci_bind_by_name($stmt, ':un', $name); $result = oci_execute($stmt); @@ -572,7 +573,7 @@ class OC_Setup { $entry = $l->t('DB Error: "%s"', array(oci_error($connection))) . '
'; $entry .= $l->t('Offending command was: "%s", name: %s, password: %s', array($query, $name, $password)) . '
'; - echo($entry); + \OC_Log::write('setup.oci', $entry, \OC_Log::WARN); } } else { // change password of the existing role $query = "ALTER USER :un IDENTIFIED BY :pw"; @@ -580,7 +581,7 @@ class OC_Setup { if (!$stmt) { $entry = $l->t('DB Error: "%s"', array(oci_error($connection))) . '
'; $entry .= $l->t('Offending command was: "%s"', array($query)) . '
'; - echo($entry); + \OC_Log::write('setup.oci', $entry, \OC_Log::WARN); } oci_bind_by_name($stmt, ':un', $name); oci_bind_by_name($stmt, ':pw', $password); @@ -588,7 +589,7 @@ class OC_Setup { if(!$result) { $entry = $l->t('DB Error: "%s"', array(oci_error($connection))) . '
'; $entry .= $l->t('Offending command was: "%s"', array($query)) . '
'; - echo($entry); + \OC_Log::write('setup.oci', $entry, \OC_Log::WARN); } } // grant necessary roles @@ -597,18 +598,20 @@ class OC_Setup { if (!$stmt) { $entry = $l->t('DB Error: "%s"', array(oci_error($connection))) . '
'; $entry .= $l->t('Offending command was: "%s"', array($query)) . '
'; - echo($entry); + \OC_Log::write('setup.oci', $entry, \OC_Log::WARN); } $result = oci_execute($stmt); if(!$result) { $entry = $l->t('DB Error: "%s"', array(oci_error($connection))) . '
'; $entry .= $l->t('Offending command was: "%s", name: %s, password: %s', array($query, $name, $password)) . '
'; - echo($entry); + \OC_Log::write('setup.oci', $entry, \OC_Log::WARN); } } private static function setupMSSQLDatabase($dbhost, $dbuser, $dbpass, $dbname, $dbtableprefix) { + $l = self::getTrans(); + //check if the database user has admin right $masterConnectionInfo = array( "Database" => "master", "UID" => $dbuser, "PWD" => $dbpass); @@ -620,7 +623,7 @@ class OC_Setup { } else { $entry = ''; } - throw new Exception('MS SQL username and/or password not valid: '.$entry); + throw new Exception($l->t('MS SQL username and/or password not valid: $s', array($entry))); } OC_Config::setValue('dbuser', $dbuser); @@ -647,7 +650,7 @@ class OC_Setup { $entry = ''; } $entry.='Offending command was: '.$query.'
'; - echo($entry); + \OC_Log::write('setup.mssql', $entry, \OC_Log::WARN); } else { $row = sqlsrv_fetch_array($result); @@ -658,7 +661,7 @@ class OC_Setup { $entry = ''; } $entry.='Offending command was: '.$query.'
'; - echo($entry); + \OC_Log::write('setup.mssql', $entry, \OC_Log::WARN); } else { if ($row == null) { $query = "CREATE LOGIN [".$name."] WITH PASSWORD = '".$password."';"; @@ -670,7 +673,7 @@ class OC_Setup { $entry = ''; } $entry.='Offending command was: '.$query.'
'; - echo($entry); + \OC_Log::write('setup.mssql', $entry, \OC_Log::WARN); } } } @@ -687,7 +690,7 @@ class OC_Setup { $entry = ''; } $entry.='Offending command was: '.$query.'
'; - echo($entry); + \OC_Log::write('setup.mssql', $entry, \OC_Log::WARN); } else { $row = sqlsrv_fetch_array($result); @@ -698,7 +701,7 @@ class OC_Setup { $entry = ''; } $entry.='Offending command was: '.$query.'
'; - echo($entry); + \OC_Log::write('setup.mssql', $entry, \OC_Log::WARN); } else { if ($row == null) { $query = "USE [".$dbname."]; CREATE USER [".$name."] FOR LOGIN [".$name."];"; @@ -710,7 +713,7 @@ class OC_Setup { $entry = ''; } $entry.='Offending command was: '.$query.'
'; - echo($entry); + \OC_Log::write('setup.mssql', $entry, \OC_Log::WARN); } } @@ -723,7 +726,7 @@ class OC_Setup { $entry = ''; } $entry.='Offending command was: '.$query.'
'; - echo($entry); + \OC_Log::write('setup.mssql', $entry, \OC_Log::WARN); } } } @@ -739,12 +742,10 @@ class OC_Setup { $entry = ''; } $entry.='Offending command was: '.$query.'
'; - echo($entry); + \OC_Log::write('setup.mssql', $entry, \OC_Log::WARN); } } - // private static function setupMSSQLDatabase($dbhost, $dbuser, $dbpass, $dbname, $dbtableprefix, $username) { - private static function mssql_createDatabaseStructure($dbhost, $dbname, $dbuser, $dbpass, $dbtableprefix) { $connectionInfo = array( "Database" => $dbname, "UID" => $dbuser, "PWD" => $dbpass); @@ -760,7 +761,7 @@ class OC_Setup { $entry = ''; } $entry.='Offending command was: '.$query.'
'; - echo($entry); + \OC_Log::write('setup.mssql', $entry, \OC_Log::WARN); } else { $row = sqlsrv_fetch_array($result); @@ -771,7 +772,7 @@ class OC_Setup { $entry = ''; } $entry.='Offending command was: '.$query.'
'; - echo($entry); + \OC_Log::write('setup.mssql', $entry, \OC_Log::WARN); } else { if ($row == null) { OC_DB::createDbFromStructure('db_structure.xml'); From bcbf2e667badaae382911f9304d0811b17167af6 Mon Sep 17 00:00:00 2001 From: Thomas Mueller Date: Tue, 12 Feb 2013 01:17:01 +0100 Subject: [PATCH 09/54] fixing sql server syntax for database creation --- lib/setup.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/setup.php b/lib/setup.php index 128c53269e..4a195c3450 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -733,7 +733,7 @@ class OC_Setup { } private static function mssql_createDatabase($dbname, $connection) { - $query = "CREATE DATABASE IF NOT EXISTS [".$dbname."];"; + $query = "CREATE DATABASE [".$dbname."];"; $result = sqlsrv_query($connection, $query); if (!$result || $result === false) { if ( ($errors = sqlsrv_errors() ) != null) { From 78a3625ddfc67e7e6743a2ff6fd31e1566b174c8 Mon Sep 17 00:00:00 2001 From: Thomas Mueller Date: Thu, 14 Feb 2013 21:59:24 +0100 Subject: [PATCH 10/54] final adoptions for mssql connectivity --- lib/db.php | 7 +++++++ lib/files/cache/cache.php | 6 +++--- tests/lib/dbschema.php | 12 +++++++++--- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/lib/db.php b/lib/db.php index 3ccd51737a..903f76c8c0 100644 --- a/lib/db.php +++ b/lib/db.php @@ -404,6 +404,13 @@ class OC_DB { $query = self::prepare('SELECT lastval() AS id'); $row = $query->execute()->fetchRow(); return $row['id']; + } + if( $type == 'mssql' ) { + if($table !== null) { + $prefix = OC_Config::getValue( "dbtableprefix", "oc_" ); + $table = str_replace( '*PREFIX*', $prefix, $table ); + } + return self::$connection->lastInsertId($table); }else{ if($table !== null) { $prefix = OC_Config::getValue( "dbtableprefix", "oc_" ); diff --git a/lib/files/cache/cache.php b/lib/files/cache/cache.php index dcb6e8fd39..b61f1de448 100644 --- a/lib/files/cache/cache.php +++ b/lib/files/cache/cache.php @@ -56,7 +56,7 @@ class Cache { } else { $query = \OC_DB::prepare('INSERT INTO `*PREFIX*storages`(`id`) VALUES(?)'); $query->execute(array($this->storageId)); - $this->numericId = \OC_DB::insertid('*PREFIX*filecache'); + $this->numericId = \OC_DB::insertid('*PREFIX*storages'); } } @@ -493,8 +493,8 @@ class Cache { */ public function getIncomplete() { $query = \OC_DB::prepare('SELECT `path` FROM `*PREFIX*filecache` WHERE `storage` = ? AND `size` = -1 ORDER BY `fileid` DESC LIMIT 1'); - $query->execute(array($this->numericId)); - if ($row = $query->fetchRow()) { + $result = $query->execute(array($this->numericId)); + if ($row = $result->fetchRow()) { return $row['path']; } else { return false; diff --git a/tests/lib/dbschema.php b/tests/lib/dbschema.php index fb60ce7dbb..e20a04ef7f 100644 --- a/tests/lib/dbschema.php +++ b/tests/lib/dbschema.php @@ -91,9 +91,15 @@ class Test_DBSchema extends PHPUnit_Framework_TestCase { break; case 'pgsql': $sql = "SELECT tablename AS table_name, schemaname AS schema_name " - . "FROM pg_tables WHERE schemaname NOT LIKE 'pg_%' " - . "AND schemaname != 'information_schema' " - . "AND tablename = '".$table."'"; + . "FROM pg_tables WHERE schemaname NOT LIKE 'pg_%' " + . "AND schemaname != 'information_schema' " + . "AND tablename = '".$table."'"; + $query = OC_DB::prepare($sql); + $result = $query->execute(array()); + $exists = $result && $result->fetchOne(); + break; + case 'mssql': + $sql = "SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = '{$table}'"; $query = OC_DB::prepare($sql); $result = $query->execute(array()); $exists = $result && $result->fetchOne(); From 686254ac1170dfd76d90b3cc6bd54761ae3d6908 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Schie=C3=9Fle?= Date: Tue, 19 Feb 2013 18:45:46 +0100 Subject: [PATCH 11/54] move2trash() handles keyfiles --- apps/files_trashbin/lib/trash.php | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/apps/files_trashbin/lib/trash.php b/apps/files_trashbin/lib/trash.php index 8d54a471b4..1c0306ea90 100644 --- a/apps/files_trashbin/lib/trash.php +++ b/apps/files_trashbin/lib/trash.php @@ -37,7 +37,9 @@ class Trashbin { $view = new \OC_FilesystemView('/'. $user); if (!$view->is_dir('files_trashbin')) { $view->mkdir('files_trashbin'); - $view->mkdir("versions_trashbin"); + $view->mkdir("files_trashbin/files"); + $view->mkdir("files_trashbin/versions"); + $view->mkdir("files_trashbin/keyfiles"); } $path_parts = pathinfo($file_path); @@ -54,31 +56,38 @@ class Trashbin { } if ( ($trashbinSize = \OCP\Config::getAppValue('files_trashbin', 'size')) === null ) { - $trashbinSize = self::calculateSize(new \OC_FilesystemView('/'. $user.'/files_trashbin')); - $trashbinSize += self::calculateSize(new \OC_FilesystemView('/'. $user.'/versions_trashbin')); + $trashbinSize = self::calculateSize(new \OC_FilesystemView('/'. $user.'/files_trashbin')); } - $trashbinSize += self::copy_recursive($file_path, 'files_trashbin/'.$deleted.'.d'.$timestamp, $view); + $trashbinSize += self::copy_recursive($file_path, 'files_trashbin/files/'.$deleted.'.d'.$timestamp, $view); - if ( $view->file_exists('files_trashbin/'.$deleted.'.d'.$timestamp) ) { + if ( $view->file_exists('files_trashbin/files/'.$deleted.'.d'.$timestamp) ) { $query = \OC_DB::prepare("INSERT INTO *PREFIX*files_trash (id,timestamp,location,type,mime,user) VALUES (?,?,?,?,?,?)"); $result = $query->execute(array($deleted, $timestamp, $location, $type, $mime, $user)); if ( !$result ) { // if file couldn't be added to the database than also don't store it in the trash bin. - $view->deleteAll('files_trashbin/'.$deleted.'.d'.$timestamp); + $view->deleteAll('files_trashbin/files/'.$deleted.'.d'.$timestamp); \OC_Log::write('files_trashbin', 'trash bin database couldn\'t be updated', \OC_log::ERROR); return; } - + + // Take core of file versions if ( \OCP\App::isEnabled('files_versions') ) { if ( $view->is_dir('files_versions'.$file_path) ) { $trashbinSize += self::calculateSize(new \OC_FilesystemView('/'. $user.'/files_versions/'.$file_path)); - $view->rename('files_versions'.$file_path, 'versions_trashbin/'. $deleted.'.d'.$timestamp); + $view->rename('files_versions'.$file_path, 'files_trashbin/versions'. $deleted.'.d'.$timestamp); } else if ( $versions = \OCA\Files_Versions\Storage::getVersions($file_path) ) { foreach ($versions as $v) { $trashbinSize += $view->filesize('files_versions'.$v['path'].'.v'.$v['version']); - $view->rename('files_versions'.$v['path'].'.v'.$v['version'], 'versions_trashbin/'. $deleted.'.v'.$v['version'].'.d'.$timestamp); + $view->rename('files_versions'.$v['path'].'.v'.$v['version'], 'files_trashbin/versions'. $deleted.'.v'.$v['version'].'.d'.$timestamp); } } } + + // Take care of encryption keys + if ( \OCP\App::isEnabled('files_encryption') ) { + $trashbinSize += self::calculateSize(new \OC_FilesystemView('/'. $user.'/files_encryption/keyfiles/'.$file_path)); + $view->rename('files_encryption'.$file_path, 'files_trashbin/keyfiles'. $deleted.'.d'.$timestamp); + } + } else { \OC_Log::write('files_trashbin', 'Couldn\'t move '.$file_path.' to the trash bin', \OC_log::ERROR); } From 4d0df9614b3aed23920f99645fed7a4385034525 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Schie=C3=9Fle?= Date: Wed, 20 Feb 2013 13:34:32 +0100 Subject: [PATCH 12/54] put all trash bin content in user/files_trashbin --- apps/files_trashbin/lib/trash.php | 64 +++++++++++++++---------------- 1 file changed, 31 insertions(+), 33 deletions(-) diff --git a/apps/files_trashbin/lib/trash.php b/apps/files_trashbin/lib/trash.php index 1c0306ea90..b54805c63e 100644 --- a/apps/files_trashbin/lib/trash.php +++ b/apps/files_trashbin/lib/trash.php @@ -34,7 +34,7 @@ class Trashbin { */ public static function move2trash($file_path) { $user = \OCP\User::getUser(); - $view = new \OC_FilesystemView('/'. $user); + $view = new \OC\Files\View('/'. $user); if (!$view->is_dir('files_trashbin')) { $view->mkdir('files_trashbin'); $view->mkdir("files_trashbin/files"); @@ -87,7 +87,7 @@ class Trashbin { $trashbinSize += self::calculateSize(new \OC_FilesystemView('/'. $user.'/files_encryption/keyfiles/'.$file_path)); $view->rename('files_encryption'.$file_path, 'files_trashbin/keyfiles'. $deleted.'.d'.$timestamp); } - + } else { \OC_Log::write('files_trashbin', 'Couldn\'t move '.$file_path.' to the trash bin', \OC_log::ERROR); } @@ -127,7 +127,6 @@ class Trashbin { if ( ($trashbinSize = \OCP\Config::getAppValue('files_trashbin', 'size')) === null ) { $trashbinSize = self::calculateSize(new \OC_FilesystemView('/'. $user.'/files_trashbin')); - $trashbinSize += self::calculateSize(new \OC_FilesystemView('/'. $user.'/versions_trashbin')); } if ( $timestamp ) { $query = \OC_DB::prepare('SELECT location,type FROM *PREFIX*files_trash WHERE user=? AND id=? AND timestamp=?'); @@ -148,12 +147,12 @@ class Trashbin { $path_parts = pathinfo($filename); $result[] = array( 'location' => $path_parts['dirname'], - 'type' => $view->is_dir('/files_trashbin/'.$file) ? 'dir' : 'files', + 'type' => $view->is_dir('/files_trashbin/files/'.$file) ? 'dir' : 'files', ); $location = ''; } - $source = \OC_Filesystem::normalizePath('files_trashbin/'.$file); + $source = \OC_Filesystem::normalizePath('files_trashbin/files/'.$file); $target = \OC_Filesystem::normalizePath('files/'.$location.'/'.$filename); // we need a extension in case a file/dir with the same name already exists @@ -174,16 +173,16 @@ class Trashbin { $versionedFile = $file; } if ( $result[0]['type'] == 'dir' ) { - $trashbinSize -= self::calculateSize(new \OC_FilesystemView('/'.$user.'/'.'versions_trashbin/'. $file)); - $view->rename(\OC_Filesystem::normalizePath('versions_trashbin/'. $file), \OC_Filesystem::normalizePath('files_versions/'.$location.'/'.$filename.$ext)); + $trashbinSize -= self::calculateSize(new \OC_FilesystemView('/'.$user.'/'.'files_trashbin/versions/'. $file)); + $view->rename(\OC_Filesystem::normalizePath('files_trashbin/versions/'. $file), \OC_Filesystem::normalizePath('files_versions/'.$location.'/'.$filename.$ext)); } else if ( $versions = self::getVersionsFromTrash($versionedFile, $timestamp) ) { foreach ($versions as $v) { if ($timestamp ) { - $trashbinSize -= $view->filesize('versions_trashbin/'.$versionedFile.'.v'.$v.'.d'.$timestamp); - $view->rename('versions_trashbin/'.$versionedFile.'.v'.$v.'.d'.$timestamp, 'files_versions/'.$location.'/'.$filename.$ext.'.v'.$v); + $trashbinSize -= $view->filesize('files_trashbin/versions/'.$versionedFile.'.v'.$v.'.d'.$timestamp); + $view->rename('files_trashbin/versions/'.$versionedFile.'.v'.$v.'.d'.$timestamp, 'files_versions/'.$location.'/'.$filename.$ext.'.v'.$v); } else { - $trashbinSize -= $view->filesize('versions_trashbin/'.$versionedFile.'.v'.$v); - $view->rename('versions_trashbin/'.$versionedFile.'.v'.$v, 'files_versions/'.$location.'/'.$filename.$ext.'.v'.$v); + $trashbinSize -= $view->filesize('files_trashbin/versions/'.$versionedFile.'.v'.$v); + $view->rename('files_trashbin/versions/'.$versionedFile.'.v'.$v, 'files_versions/'.$location.'/'.$filename.$ext.'.v'.$v); } } } @@ -216,7 +215,6 @@ class Trashbin { if ( ($trashbinSize = \OCP\Config::getAppValue('files_trashbin', 'size')) === null ) { $trashbinSize = self::calculateSize(new \OC_FilesystemView('/'. $user.'/files_trashbin')); - $trashbinSize += self::calculateSize(new \OC_FilesystemView('/'. $user.'/versions_trashbin')); } if ( $timestamp ) { @@ -228,28 +226,28 @@ class Trashbin { } if ( \OCP\App::isEnabled('files_versions') ) { - if ($view->is_dir('versions_trashbin/'.$file)) { - $size += self::calculateSize(new \OC_Filesystemview('/'.$user.'/versions_trashbin/'.$file)); - $view->unlink('versions_trashbin/'.$file); + if ($view->is_dir('files_trashbin/versions/'.$file)) { + $size += self::calculateSize(new \OC_Filesystemview('/'.$user.'/files_trashbin/versions/'.$file)); + $view->unlink('files_trashbin/versions/'.$file); } else if ( $versions = self::getVersionsFromTrash($filename, $timestamp) ) { foreach ($versions as $v) { if ($timestamp ) { - $size += $view->filesize('/versions_trashbin/'.$filename.'.v'.$v.'.d'.$timestamp); - $view->unlink('/versions_trashbin/'.$filename.'.v'.$v.'.d'.$timestamp); + $size += $view->filesize('/files_trashbin/versions/'.$filename.'.v'.$v.'.d'.$timestamp); + $view->unlink('/files_trashbin/versions/'.$filename.'.v'.$v.'.d'.$timestamp); } else { - $size += $view->filesize('/versions_trashbin/'.$filename.'.v'.$v); - $view->unlink('/versions_trashbin/'.$filename.'.v'.$v); + $size += $view->filesize('/files_trashbin/versions/'.$filename.'.v'.$v); + $view->unlink('/files_trashbin/versions/'.$filename.'.v'.$v); } } } } - if ($view->is_dir('/files_trashbin/'.$file)) { - $size += self::calculateSize(new \OC_Filesystemview('/'.$user.'/files_trashbin/'.$file)); + if ($view->is_dir('/files_trashbin/files/'.$file)) { + $size += self::calculateSize(new \OC_Filesystemview('/'.$user.'/files_trashbin/files/'.$file)); } else { - $size += $view->filesize('/files_trashbin/'.$file); + $size += $view->filesize('/files_trashbin/files/'.$file); } - $view->unlink('/files_trashbin/'.$file); + $view->unlink('/files_trashbin/files/'.$file); $trashbinSize -= $size; \OCP\Config::setAppValue('files_trashbin', 'size', $trashbinSize); @@ -272,7 +270,7 @@ class Trashbin { $filename = $filename; } - $target = \OC_Filesystem::normalizePath('files_trashbin/'.$filename); + $target = \OC_Filesystem::normalizePath('files_trashbin/files/'.$filename); return $view->file_exists($target); } @@ -297,19 +295,19 @@ class Trashbin { $timestamp = $r['timestamp']; $filename = $r['id']; if ( $r['timestamp'] < $limit ) { - if ($view->is_dir('files_trashbin/'.$filename.'.d'.$timestamp)) { - $size += self::calculateSize(new \OC_FilesystemView('/'.$user.'/files_trashbin/'.$filename.'.d'.$timestamp)); + if ($view->is_dir('files_trashbin/files/'.$filename.'.d'.$timestamp)) { + $size += self::calculateSize(new \OC_FilesystemView('/'.$user.'/files_trashbin/files/'.$filename.'.d'.$timestamp)); } else { - $size += $view->filesize('files_trashbin/'.$filename.'.d'.$timestamp); + $size += $view->filesize('files_trashbin/files/'.$filename.'.d'.$timestamp); } - $view->unlink('files_trashbin/'.$filename.'.d'.$timestamp); + $view->unlink('files_trashbin/files/'.$filename.'.d'.$timestamp); if ($r['type'] == 'dir') { - $size += self::calculateSize(new \OC_FilesystemView('/'.$user.'/versions_trashbin/'.$filename.'.d'.$timestamp)); - $view->unlink('versions_trashbin/'.$filename.'.d'.$timestamp); + $size += self::calculateSize(new \OC_FilesystemView('/'.$user.'/files_trashbin/versions'.$filename.'.d'.$timestamp)); + $view->unlink('files_trashbin/versions'.$filename.'.d'.$timestamp); } else if ( $versions = self::getVersionsFromTrash($filename, $timestamp) ) { foreach ($versions as $v) { - $size += $view->filesize('versions_trashbin/'.$filename.'.v'.$v.'.d'.$timestamp); - $view->unlink('versions_trashbin/'.$filename.'.v'.$v.'.d'.$timestamp); + $size += $view->filesize('files_trashbin/versions/'.$filename.'.v'.$v.'.d'.$timestamp); + $view->unlink('files_trashbin/versions/'.$filename.'.v'.$v.'.d'.$timestamp); } } } @@ -373,7 +371,7 @@ class Trashbin { * @param $timestamp timestamp when the file was deleted */ private static function getVersionsFromTrash($filename, $timestamp) { - $view = new \OC_FilesystemView('/'.\OCP\User::getUser().'/versions_trashbin'); + $view = new \OC_FilesystemView('/'.\OCP\User::getUser().'/files_trashbin/versions'); $versionsName = \OCP\Config::getSystemValue('datadirectory').$view->getAbsolutePath($filename); $versions = array(); if ($timestamp ) { From c49e73d43cd0e775ec653fa59811381b70e3efe7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Schie=C3=9Fle?= Date: Wed, 20 Feb 2013 15:14:32 +0100 Subject: [PATCH 13/54] restore filekeys from trash bin --- apps/files_trashbin/lib/trash.php | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/apps/files_trashbin/lib/trash.php b/apps/files_trashbin/lib/trash.php index b54805c63e..cde388015e 100644 --- a/apps/files_trashbin/lib/trash.php +++ b/apps/files_trashbin/lib/trash.php @@ -82,10 +82,11 @@ class Trashbin { } } - // Take care of encryption keys - if ( \OCP\App::isEnabled('files_encryption') ) { - $trashbinSize += self::calculateSize(new \OC_FilesystemView('/'. $user.'/files_encryption/keyfiles/'.$file_path)); - $view->rename('files_encryption'.$file_path, 'files_trashbin/keyfiles'. $deleted.'.d'.$timestamp); + // Take care of encryption keys + $keyfile = \OC_Filesystem::normalizePath('files_encryption/keyfiles/'.$file_path.'.key'); + if ( \OCP\App::isEnabled('files_encryption') && $view->file_exists($keyfile) ) { + $trashbinSize += $view->filesize($keyfile); + $view->rename($keyfile, 'files_trashbin/keyfiles/'. $deleted.'.d'.$timestamp); } } else { @@ -187,7 +188,18 @@ class Trashbin { } } } - + + // Take care of encryption keys + $keyfile = 'files_trashbin/keyfiles/'.$file; + if ( \OCP\App::isEnabled('files_encryption') && $view->file_exists($keyfile) ) { + if ( $result[0]['type'] == 'dir' ) { + $trashbinSize -= self::calculateSize(new \OC_FilesystemView('/'.$user.'/'.$keyfile)); + } else { + $trashbinSize -= $view->filesize($keyfile); + } + $view->rename($keyfile, 'files_encryption/keyfiles/'. $location.'/'.$filename.'.key'); + } + if ( $timestamp ) { $query = \OC_DB::prepare('DELETE FROM *PREFIX*files_trash WHERE user=? AND id=? AND timestamp=?'); $query->execute(array($user,$filename,$timestamp)); From 4b5a662e09e1f1d0b7885b546e7b278fe263be34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Schie=C3=9Fle?= Date: Wed, 20 Feb 2013 17:58:04 +0100 Subject: [PATCH 14/54] delete keyfiles if file in trash bin gets deleted permanently --- apps/files_trashbin/lib/trash.php | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/apps/files_trashbin/lib/trash.php b/apps/files_trashbin/lib/trash.php index cde388015e..5c0cf36f5b 100644 --- a/apps/files_trashbin/lib/trash.php +++ b/apps/files_trashbin/lib/trash.php @@ -83,10 +83,14 @@ class Trashbin { } // Take care of encryption keys - $keyfile = \OC_Filesystem::normalizePath('files_encryption/keyfiles/'.$file_path.'.key'); - if ( \OCP\App::isEnabled('files_encryption') && $view->file_exists($keyfile) ) { - $trashbinSize += $view->filesize($keyfile); - $view->rename($keyfile, 'files_trashbin/keyfiles/'. $deleted.'.d'.$timestamp); + $keyfile = \OC_Filesystem::normalizePath('files_encryption/keyfiles/'.$file_path); + if ( \OCP\App::isEnabled('files_encryption') && $view->file_exists($keyfile.'.key') ) { + if ( $view->is_dir('files'.$file_path) ) { + $trashbinSize -= self::calculateSize(new \OC_FilesystemView('/'.$user.'/'.$keyfile)); + } else { + $trashbinSize += $view->filesize($keyfile.'.key'); + } + $view->rename($keyfile.'.key', 'files_trashbin/keyfiles/'. $deleted.'.d'.$timestamp); } } else { @@ -190,7 +194,7 @@ class Trashbin { } // Take care of encryption keys - $keyfile = 'files_trashbin/keyfiles/'.$file; + $keyfile = \OC_Filesystem::normalizePath('files_trashbin/keyfiles/'.$file); if ( \OCP\App::isEnabled('files_encryption') && $view->file_exists($keyfile) ) { if ( $result[0]['type'] == 'dir' ) { $trashbinSize -= self::calculateSize(new \OC_FilesystemView('/'.$user.'/'.$keyfile)); @@ -252,6 +256,17 @@ class Trashbin { } } } + } + + // Take care of encryption keys + $keyfile = \OC_Filesystem::normalizePath('files_trashbin/keyfiles/'.$file); + if ( \OCP\App::isEnabled('files_encryption') && $view->file_exists($keyfile) ) { + if ( $result[0]['type'] == 'dir' ) { + $size += self::calculateSize(new \OC_FilesystemView('/'.$user.'/'.$keyfile)); + } else { + $size += $view->filesize($keyfile); + } + $view->unlink($keyfile); } if ($view->is_dir('/files_trashbin/files/'.$file)) { From 5ce6d1fb5774bdc7dacea4c853d5412f03004e0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Schie=C3=9Fle?= Date: Wed, 20 Feb 2013 18:00:15 +0100 Subject: [PATCH 15/54] reuse delete() function in expire() --- apps/files_trashbin/lib/trash.php | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/apps/files_trashbin/lib/trash.php b/apps/files_trashbin/lib/trash.php index 5c0cf36f5b..4d230449b5 100644 --- a/apps/files_trashbin/lib/trash.php +++ b/apps/files_trashbin/lib/trash.php @@ -322,27 +322,10 @@ class Trashbin { $timestamp = $r['timestamp']; $filename = $r['id']; if ( $r['timestamp'] < $limit ) { - if ($view->is_dir('files_trashbin/files/'.$filename.'.d'.$timestamp)) { - $size += self::calculateSize(new \OC_FilesystemView('/'.$user.'/files_trashbin/files/'.$filename.'.d'.$timestamp)); - } else { - $size += $view->filesize('files_trashbin/files/'.$filename.'.d'.$timestamp); - } - $view->unlink('files_trashbin/files/'.$filename.'.d'.$timestamp); - if ($r['type'] == 'dir') { - $size += self::calculateSize(new \OC_FilesystemView('/'.$user.'/files_trashbin/versions'.$filename.'.d'.$timestamp)); - $view->unlink('files_trashbin/versions'.$filename.'.d'.$timestamp); - } else if ( $versions = self::getVersionsFromTrash($filename, $timestamp) ) { - foreach ($versions as $v) { - $size += $view->filesize('files_trashbin/versions/'.$filename.'.v'.$v.'.d'.$timestamp); - $view->unlink('files_trashbin/versions/'.$filename.'.v'.$v.'.d'.$timestamp); - } - } + $size += self::delete($filename, $timestamp); } } - - $query = \OC_DB::prepare('DELETE FROM *PREFIX*files_trash WHERE user=? AND timestampexecute(array($user,$limit)); - + $availableSpace = $availableSpace + $size; // if size limit for trash bin reached, delete oldest files in trash bin if ($availableSpace < 0) { @@ -355,8 +338,7 @@ class Trashbin { $availableSpace += $tmp; $size += $tmp; $i++; - } - + } } return $size; From 5329c9ea31a1e0c31756d4faf8a9946965032012 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Schie=C3=9Fle?= Date: Wed, 20 Feb 2013 19:18:34 +0100 Subject: [PATCH 16/54] update script which copies all trash bin related files to user/files_trashbin --- apps/files_trashbin/appinfo/update.php | 40 ++++++++++++++++++++++++++ apps/files_trashbin/appinfo/version | 2 +- 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 apps/files_trashbin/appinfo/update.php diff --git a/apps/files_trashbin/appinfo/update.php b/apps/files_trashbin/appinfo/update.php new file mode 100644 index 0000000000..b0bf79cc51 --- /dev/null +++ b/apps/files_trashbin/appinfo/update.php @@ -0,0 +1,40 @@ + Date: Wed, 20 Feb 2013 22:17:04 +0100 Subject: [PATCH 17/54] some fixes for the keyfile handling --- apps/files_trashbin/lib/trash.php | 38 +++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/apps/files_trashbin/lib/trash.php b/apps/files_trashbin/lib/trash.php index 4d230449b5..f11e5c4cbf 100644 --- a/apps/files_trashbin/lib/trash.php +++ b/apps/files_trashbin/lib/trash.php @@ -69,7 +69,7 @@ class Trashbin { return; } - // Take core of file versions + // Take care of file versions if ( \OCP\App::isEnabled('files_versions') ) { if ( $view->is_dir('files_versions'.$file_path) ) { $trashbinSize += self::calculateSize(new \OC_FilesystemView('/'. $user.'/files_versions/'.$file_path)); @@ -86,11 +86,12 @@ class Trashbin { $keyfile = \OC_Filesystem::normalizePath('files_encryption/keyfiles/'.$file_path); if ( \OCP\App::isEnabled('files_encryption') && $view->file_exists($keyfile.'.key') ) { if ( $view->is_dir('files'.$file_path) ) { - $trashbinSize -= self::calculateSize(new \OC_FilesystemView('/'.$user.'/'.$keyfile)); + $trashbinSize += self::calculateSize(new \OC_FilesystemView('/'.$user.'/'.$keyfile)); + $view->rename($keyfile, 'files_trashbin/keyfiles/'. $deleted.'.d'.$timestamp); } else { $trashbinSize += $view->filesize($keyfile.'.key'); + $view->rename($keyfile.'.key', 'files_trashbin/keyfiles/'. $deleted.'.key.d'.$timestamp); } - $view->rename($keyfile.'.key', 'files_trashbin/keyfiles/'. $deleted.'.d'.$timestamp); } } else { @@ -149,7 +150,7 @@ class Trashbin { $location = ''; } } else { - $path_parts = pathinfo($filename); + $path_parts = pathinfo($file); $result[] = array( 'location' => $path_parts['dirname'], 'type' => $view->is_dir('/files_trashbin/files/'.$file) ? 'dir' : 'files', @@ -193,15 +194,24 @@ class Trashbin { } } - // Take care of encryption keys - $keyfile = \OC_Filesystem::normalizePath('files_trashbin/keyfiles/'.$file); + // Take care of encryption keys TODO! Get '.key' in file between file name and delete date (also for permanent delete!) + $parts = pathinfo($file); + if ( $result[0]['type'] == 'dir' ) { + $keyfile = \OC_Filesystem::normalizePath('files_trashbin/keyfiles/'.$parts['dirname'].'/'.$filename); + } else { + $keyfile = \OC_Filesystem::normalizePath('files_trashbin/keyfiles/'.$parts['dirname'].'/'.$filename.'.key'); + } + if ($timestamp) { + $keyfile .= '.d'.$timestamp; + } if ( \OCP\App::isEnabled('files_encryption') && $view->file_exists($keyfile) ) { if ( $result[0]['type'] == 'dir' ) { $trashbinSize -= self::calculateSize(new \OC_FilesystemView('/'.$user.'/'.$keyfile)); + $view->rename($keyfile, 'files_encryption/keyfiles/'. $location.'/'.$filename); } else { $trashbinSize -= $view->filesize($keyfile); + $view->rename($keyfile, 'files_encryption/keyfiles/'. $location.'/'.$filename.'.key'); } - $view->rename($keyfile, 'files_encryption/keyfiles/'. $location.'/'.$filename.'.key'); } if ( $timestamp ) { @@ -258,10 +268,18 @@ class Trashbin { } } - // Take care of encryption keys - $keyfile = \OC_Filesystem::normalizePath('files_trashbin/keyfiles/'.$file); + // Take care of encryption keys + $parts = pathinfo($file); + if ( $view->is_dir('/files_trashbin/files/'.$file) ) { + $keyfile = \OC_Filesystem::normalizePath('files_trashbin/keyfiles/'.$filename); + } else { + $keyfile = \OC_Filesystem::normalizePath('files_trashbin/keyfiles/'.$filename.'.key'); + } + if ($timestamp) { + $keyfile .= '.d'.$timestamp; + } if ( \OCP\App::isEnabled('files_encryption') && $view->file_exists($keyfile) ) { - if ( $result[0]['type'] == 'dir' ) { + if ( $view->is_dir($keyfile) ) { $size += self::calculateSize(new \OC_FilesystemView('/'.$user.'/'.$keyfile)); } else { $size += $view->filesize($keyfile); From 2d6efae25714b188d4e689617b2e4ae8695b0317 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Schie=C3=9Fle?= Date: Wed, 20 Feb 2013 22:19:23 +0100 Subject: [PATCH 18/54] update path to deleted files --- apps/files_trashbin/index.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/files_trashbin/index.php b/apps/files_trashbin/index.php index a2d4cc0a44..8f8d143b4d 100644 --- a/apps/files_trashbin/index.php +++ b/apps/files_trashbin/index.php @@ -9,7 +9,7 @@ OCP\Util::addScript('files', 'fileactions'); $tmpl = new OCP\Template('files_trashbin', 'index', 'user'); $user = \OCP\User::getUser(); -$view = new OC_Filesystemview('/'.$user.'/files_trashbin'); +$view = new OC_Filesystemview('/'.$user.'/files_trashbin/files'); OCP\Util::addStyle('files', 'files'); OCP\Util::addScript('files', 'filelist'); @@ -17,8 +17,7 @@ OCP\Util::addScript('files', 'filelist'); $dir = isset($_GET['dir']) ? stripslashes($_GET['dir']) : ''; if ($dir) { - $dirlisting = true; - $view = new \OC_FilesystemView('/'.\OCP\User::getUser().'/files_trashbin'); + $dirlisting = true; $fullpath = \OCP\Config::getSystemValue('datadirectory').$view->getAbsolutePath($dir); $dirContent = opendir($fullpath); $i = 0; From fc1fba23040908fe5629f89b66a280aea5578520 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Schie=C3=9Fle?= Date: Thu, 21 Feb 2013 00:02:52 +0100 Subject: [PATCH 19/54] don't show empty trash bin message for sub folders --- apps/files_trashbin/index.php | 1 + apps/files_trashbin/templates/index.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/files_trashbin/index.php b/apps/files_trashbin/index.php index 8f8d143b4d..d575c75f1a 100644 --- a/apps/files_trashbin/index.php +++ b/apps/files_trashbin/index.php @@ -94,6 +94,7 @@ $list->assign('disableDownloadActions', true); $tmpl->assign('breadcrumb', $breadcrumbNav->fetchPage(), false); $tmpl->assign('fileList', $list->fetchPage(), false); $tmpl->assign('files', $files); +$tmpl->assign('dirlisting', $dirlisting); $tmpl->assign('dir', OC_Filesystem::normalizePath($view->getAbsolutePath())); $tmpl->printPage(); diff --git a/apps/files_trashbin/templates/index.php b/apps/files_trashbin/templates/index.php index c3e51b4bec..b62ca0af00 100644 --- a/apps/files_trashbin/templates/index.php +++ b/apps/files_trashbin/templates/index.php @@ -5,7 +5,7 @@
- +
t('Nothing in here. Your trash bin is empty!')?>
From c24ec867f9e428dd90c021736c2d92c0516e3526 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Schie=C3=9Fle?= Date: Thu, 21 Feb 2013 12:20:29 +0100 Subject: [PATCH 20/54] calculate versions size per user --- apps/files_versions/appinfo/database.xml | 35 ++++++++++++++++ apps/files_versions/appinfo/version | 2 +- apps/files_versions/lib/versions.php | 53 ++++++++++++++++++++---- 3 files changed, 80 insertions(+), 10 deletions(-) create mode 100644 apps/files_versions/appinfo/database.xml diff --git a/apps/files_versions/appinfo/database.xml b/apps/files_versions/appinfo/database.xml new file mode 100644 index 0000000000..7cfa5aa79a --- /dev/null +++ b/apps/files_versions/appinfo/database.xml @@ -0,0 +1,35 @@ + + + + *dbname* + true + false + + utf8 + + + + *dbprefix*files_versions + + + + + user + text + + true + 50 + + + size + text + + true + 50 + + + + +
+ +
diff --git a/apps/files_versions/appinfo/version b/apps/files_versions/appinfo/version index e6d5cb833c..e4c0d46e55 100644 --- a/apps/files_versions/appinfo/version +++ b/apps/files_versions/appinfo/version @@ -1 +1 @@ -1.0.2 \ No newline at end of file +1.0.3 \ No newline at end of file diff --git a/apps/files_versions/lib/versions.php b/apps/files_versions/lib/versions.php index ba9f8ba41c..415830a9a0 100644 --- a/apps/files_versions/lib/versions.php +++ b/apps/files_versions/lib/versions.php @@ -45,6 +45,37 @@ class Storage { return array($uid, $filename); } + /** + * get current size of all versions from a given user + * + * @param $user user who owns the versions + * @return mixed versions size or false if no versions size is stored + */ + private static function getVersionsSize($user) { + $query = \OC_DB::prepare('SELECT size FROM *PREFIX*files_versions WHERE user=?'); + $result = $query->execute(array($user))->fetchAll(); + + if ($result) { + return $result[0]['size']; + } + return false; + } + + /** + * write to the database how much space is in use for versions + * + * @param $user owner of the versions + * @param $size size of the versions + */ + private static function setVersionsSize($user, $size) { + if ( self::getVersionsSize($user) === false) { + $query = \OC_DB::prepare('INSERT INTO *PREFIX*files_versions (size, user) VALUES (?, ?)'); + }else { + $query = \OC_DB::prepare('UPDATE *PREFIX*files_versions SET size=? WHERE user=?'); + } + $query->execute(array($size, $user)); + } + /** * store a new version of a file. */ @@ -73,17 +104,19 @@ class Storage { } // store a new version of a file - $result = $users_view->copy('files'.$filename, 'files_versions'.$filename.'.v'.$users_view->filemtime('files'.$filename)); - if ( ($versionsSize = \OCP\Config::getAppValue('files_versions', 'size')) === null ) { + $users_view->copy('files'.$filename, 'files_versions'.$filename.'.v'.$users_view->filemtime('files'.$filename)); + $versionsSize = self::getVersionsSize($uid); + if ( $versionsSize === false || $versionSize < 0 ) { $versionsSize = self::calculateSize($uid); } + $versionsSize += $users_view->filesize('files'.$filename); - + // expire old revisions if necessary $newSize = self::expire($filename, $versionsSize); - + if ( $newSize != $versionsSize ) { - \OCP\Config::setAppValue('files_versions', 'size', $versionsSize); + self::setVersionsSize($uid, $newSize); } } } @@ -98,14 +131,15 @@ class Storage { $abs_path = \OCP\Config::getSystemValue('datadirectory').$versions_fileview->getAbsolutePath('').$filename.'.v'; if( ($versions = self::getVersions($uid, $filename)) ) { - if ( ($versionsSize = \OCP\Config::getAppValue('files_versions', 'size')) === null ) { + $versionsSize = self::getVersionsSize($uid); + if ( $versionsSize === false || $versionsSize < 0 ) { $versionsSize = self::calculateSize($uid); } foreach ($versions as $v) { unlink($abs_path . $v['version']); $versionsSize -= $v['size']; } - \OCP\Config::setAppValue('files_versions', 'size', $versionsSize); + self::setVersionsSize($uid, $versionsSize); } } @@ -314,12 +348,13 @@ class Storage { $quota = \OCP\Util::computerFileSize(\OC_Appconfig::getValue('files', 'default_quota')); } if ( $quota == null ) { - $quota = \OC\Files\Filesystem::free_space('/'); + $quota = \OC\Files\Filesystem::free_space('/') / count(\OCP\User::getUsers()); } // make sure that we have the current size of the version history if ( $versionsSize === null ) { - if ( ($versionsSize = \OCP\Config::getAppValue('files_versions', 'size')) === null ) { + $versionsSize = self::getVersionsSize($uid); + if ( $versionsSize === false || $versionsSize < 0 ) { $versionsSize = self::calculateSize($uid); } } From 2436d01985311b3cd14c2f0dec745081ae7d3507 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Schie=C3=9Fle?= Date: Thu, 21 Feb 2013 12:37:13 +0100 Subject: [PATCH 21/54] calculate trashbin size per user --- apps/files_trashbin/appinfo/database.xml | 26 ++++++++++++ apps/files_trashbin/appinfo/version | 2 +- apps/files_trashbin/lib/trash.php | 52 ++++++++++++++++++++---- 3 files changed, 71 insertions(+), 9 deletions(-) diff --git a/apps/files_trashbin/appinfo/database.xml b/apps/files_trashbin/appinfo/database.xml index 1144a1c9a9..6f2a27866f 100644 --- a/apps/files_trashbin/appinfo/database.xml +++ b/apps/files_trashbin/appinfo/database.xml @@ -89,4 +89,30 @@ + + + *dbprefix*files_trashsize + + + + + user + text + + true + 50 + + + + size + text + + true + 50 + + + + +
+ diff --git a/apps/files_trashbin/appinfo/version b/apps/files_trashbin/appinfo/version index 49d59571fb..be58634173 100644 --- a/apps/files_trashbin/appinfo/version +++ b/apps/files_trashbin/appinfo/version @@ -1 +1 @@ -0.1 +0.3 diff --git a/apps/files_trashbin/lib/trash.php b/apps/files_trashbin/lib/trash.php index 8d54a471b4..898f897273 100644 --- a/apps/files_trashbin/lib/trash.php +++ b/apps/files_trashbin/lib/trash.php @@ -52,8 +52,9 @@ class Trashbin { } else { $type = 'file'; } - - if ( ($trashbinSize = \OCP\Config::getAppValue('files_trashbin', 'size')) === null ) { + + $trashbinSize = self::getTrashbinSize($user); + if ( $trashbinSize === false || $trashbinSize < 0 ) { $trashbinSize = self::calculateSize(new \OC_FilesystemView('/'. $user.'/files_trashbin')); $trashbinSize += self::calculateSize(new \OC_FilesystemView('/'. $user.'/versions_trashbin')); } @@ -89,7 +90,7 @@ class Trashbin { $quota = \OCP\Util::computerFileSize(\OC_Appconfig::getValue('files', 'default_quota')); } if ( $quota == null ) { - $quota = \OC\Files\Filesystem::free_space('/'); + $quota = \OC\Files\Filesystem::free_space('/') / count(\OCP\User::getUsers()); } // calculate available space for trash bin @@ -102,7 +103,8 @@ class Trashbin { } $trashbinSize -= self::expire($availableSpace); - \OCP\Config::setAppValue('files_trashbin', 'size', $trashbinSize); + + self::setTrashbinSize($user, $trashbinSize); } @@ -116,7 +118,8 @@ class Trashbin { $user = \OCP\User::getUser(); $view = new \OC_FilesystemView('/'.$user); - if ( ($trashbinSize = \OCP\Config::getAppValue('files_trashbin', 'size')) === null ) { + $trashbinSize = self::getTrashbinSize($user); + if ( $trashbinSize === false || $trashbinSize < 0 ) { $trashbinSize = self::calculateSize(new \OC_FilesystemView('/'. $user.'/files_trashbin')); $trashbinSize += self::calculateSize(new \OC_FilesystemView('/'. $user.'/versions_trashbin')); } @@ -185,7 +188,8 @@ class Trashbin { $query->execute(array($user,$filename,$timestamp)); } - \OCP\Config::setAppValue('files_trashbin', 'size', $trashbinSize); + self::setTrashbinSize($user, $trashbinSize); + return true; } else { \OC_Log::write('files_trashbin', 'Couldn\'t restore file from trash bin, '.$filename, \OC_log::ERROR); @@ -205,7 +209,8 @@ class Trashbin { $view = new \OC_FilesystemView('/'.$user); $size = 0; - if ( ($trashbinSize = \OCP\Config::getAppValue('files_trashbin', 'size')) === null ) { + $trashbinSize = self::getTrashbinSize($user); + if ( $trashbinSize === false || $trashbinSize < 0 ) { $trashbinSize = self::calculateSize(new \OC_FilesystemView('/'. $user.'/files_trashbin')); $trashbinSize += self::calculateSize(new \OC_FilesystemView('/'. $user.'/versions_trashbin')); } @@ -242,7 +247,7 @@ class Trashbin { } $view->unlink('/files_trashbin/'.$file); $trashbinSize -= $size; - \OCP\Config::setAppValue('files_trashbin', 'size', $trashbinSize); + self::setTrashbinSize($user, $trashbinSize); return $size; } @@ -429,5 +434,36 @@ class Trashbin { } return $size; } + + /** + * get current size of trash bin from a given user + * + * @param $user user who owns the trash bin + * @return mixed trash bin size or false if no trash bin size is stored + */ + private static function getTrashbinSize($user) { + $query = \OC_DB::prepare('SELECT size FROM *PREFIX*files_trashsize WHERE user=?'); + $result = $query->execute(array($user))->fetchAll(); + + if ($result) { + return $result[0]['size']; + } + return false; + } + + /** + * write to the database how much space is in use for the trash bin + * + * @param $user owner of the trash bin + * @param $size size of the trash bin + */ + private static function setTrashbinSize($user, $size) { + if ( self::getTrashbinSize($user) === false) { + $query = \OC_DB::prepare('INSERT INTO *PREFIX*files_trashsize (size, user) VALUES (?, ?)'); + }else { + $query = \OC_DB::prepare('UPDATE *PREFIX*files_trashsize SET size=? WHERE user=?'); + } + $query->execute(array($size, $user)); + } } From 0a5457c5506730bf75a319b74a5bc97169da36d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Schie=C3=9Fle?= Date: Thu, 21 Feb 2013 14:40:16 +0100 Subject: [PATCH 22/54] fix getVersions(), we need to get the correct user and filename --- apps/files_versions/ajax/getVersions.php | 4 ++-- apps/files_versions/lib/versions.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/files_versions/ajax/getVersions.php b/apps/files_versions/ajax/getVersions.php index 53fc04625c..8a8fa43080 100644 --- a/apps/files_versions/ajax/getVersions.php +++ b/apps/files_versions/ajax/getVersions.php @@ -1,11 +1,11 @@ 604800), ); - private static function getUidAndFilename($filename) { + public static function getUidAndFilename($filename) { $uid = \OC\Files\Filesystem::getOwner($filename); if ( $uid != \OCP\User::getUser() ) { $info = \OC\Files\Filesystem::getFileInfo($filename); From 859caee66a107b7e46f3d0bc615acfd112a2981d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Thu, 21 Feb 2013 16:52:18 +0100 Subject: [PATCH 23/54] use :hover pseudo class to set opacity --- apps/files/css/files.css | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/apps/files/css/files.css b/apps/files/css/files.css index dfc2e4c0e2..3cd809038b 100644 --- a/apps/files/css/files.css +++ b/apps/files/css/files.css @@ -123,6 +123,24 @@ a.action>img { max-height:16px; max-width:16px; vertical-align:text-bottom; } .selectedActions a { display:inline; margin:-.5em 0; padding:.5em !important; } .selectedActions a img { position:relative; top:.3em; } +#fileList a.action { + display:none; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; + filter: alpha(opacity=0); + opacity: 0; +} +#fileList tr:hover a.action { + display:inline; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=.5)"; + filter: alpha(opacity=.5); + opacity: .5; +} +#fileList tr:hover a.action:hover { + display:inline; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=1)"; + filter: alpha(opacity=1); + opacity: 1; +} #scanning-message{ top:40%; left:40%; position:absolute; display:none; } From 0dd7fd0599e0757abc81677ccbb8d4a6839a5f79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Thu, 21 Feb 2013 17:38:25 +0100 Subject: [PATCH 24/54] IE8 does not support window.onclick --- apps/files/js/files.js | 2 +- core/js/js.js | 2 +- search/js/result.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/files/js/files.js b/apps/files/js/files.js index 8327460cca..aeb7aedfae 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -524,7 +524,7 @@ $(document).ready(function() { crumb.text(text); } - $(window).click(function(){ + $(document).click(function(){ $('#new>ul').hide(); $('#new').removeClass('active'); $('#new li').each(function(i,element){ diff --git a/core/js/js.js b/core/js/js.js index 6d5d65403f..e373fca886 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -669,7 +669,7 @@ $(document).ready(function(){ $('#settings #expanddiv').click(function(event){ event.stopPropagation(); }); - $(window).click(function(){//hide the settings menu when clicking outside it + $(document).click(function(){//hide the settings menu when clicking outside it $('#settings #expanddiv').slideUp(200); }); diff --git a/search/js/result.js b/search/js/result.js index cadb0d0aab..78fa8efc8e 100644 --- a/search/js/result.js +++ b/search/js/result.js @@ -28,7 +28,7 @@ OC.search.showResults=function(results){ OC.search.hide(); event.stopPropagation(); }); - $(window).click(function(event){ + $(document).click(function(event){ OC.search.hide(); }); OC.search.lastResults=results; From 629097bee73d70af002a5277529a7afdca75897d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Schie=C3=9Fle?= Date: Thu, 21 Feb 2013 22:44:44 +0100 Subject: [PATCH 25/54] increase db fileds for usernames --- apps/files_trashbin/appinfo/database.xml | 4 ++-- apps/files_versions/appinfo/database.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/files_trashbin/appinfo/database.xml b/apps/files_trashbin/appinfo/database.xml index 6f2a27866f..6f12b26d05 100644 --- a/apps/files_trashbin/appinfo/database.xml +++ b/apps/files_trashbin/appinfo/database.xml @@ -26,7 +26,7 @@ text true - 50 + 64 @@ -100,7 +100,7 @@ text true - 50 + 64 diff --git a/apps/files_versions/appinfo/database.xml b/apps/files_versions/appinfo/database.xml index 7cfa5aa79a..d385477698 100644 --- a/apps/files_versions/appinfo/database.xml +++ b/apps/files_versions/appinfo/database.xml @@ -18,7 +18,7 @@ text true - 50 + 64 size From bf0b9bac8b10afccb5d98d4272ed1a311ed99042 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Fri, 22 Feb 2013 00:22:43 +0100 Subject: [PATCH 26/54] Remove unneeded code for user layout template --- core/templates/layout.user.php | 2 +- lib/template.php | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/core/templates/layout.user.php b/core/templates/layout.user.php index 2d00bdb5c8..00b60070d4 100644 --- a/core/templates/layout.user.php +++ b/core/templates/layout.user.php @@ -31,7 +31,7 @@
    - +
    diff --git a/lib/template.php b/lib/template.php index 3df5a24f94..e79c0d55c9 100644 --- a/lib/template.php +++ b/lib/template.php @@ -413,11 +413,6 @@ class OC_Template{ if( $this->renderas ) { $page = new OC_TemplateLayout($this->renderas); - if($this->renderas == 'user') { - $page->assign('requesttoken', $this->vars['requesttoken']); - $user = OC_User::getUser(); - $page->assign('displayname', OCP\User::getDisplayName($user)); - } // Add custom headers $page->assign('headers', $this->headers, false); From efe33c508e140c595a2020ceff4f5a3f4006d9c1 Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Fri, 22 Feb 2013 00:51:54 +0100 Subject: [PATCH 27/54] Don't walk objects with array_walk_recursive() --- lib/util.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/util.php b/lib/util.php index ab47e404c9..53a30cfc1b 100755 --- a/lib/util.php +++ b/lib/util.php @@ -504,10 +504,10 @@ class OC_Util { * @return array with sanitized strings or a single sanitized string, depends on the input parameter. */ public static function sanitizeHTML( &$value ) { - if (is_array($value) || is_object($value)) { + if (is_array($value)) { array_walk_recursive($value, 'OC_Util::sanitizeHTML'); } else { - $value = htmlentities($value, ENT_QUOTES, 'UTF-8'); //Specify encoding for PHP<5.4 + $value = htmlentities((string)$value, ENT_QUOTES, 'UTF-8'); //Specify encoding for PHP<5.4 } return $value; } From df76e0d1c33fc1fa9610b98a7aee41941c09eb3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Schie=C3=9Fle?= Date: Fri, 22 Feb 2013 10:05:08 +0100 Subject: [PATCH 28/54] use the same string lengths like the file cache --- apps/files_trashbin/appinfo/database.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/files_trashbin/appinfo/database.xml b/apps/files_trashbin/appinfo/database.xml index 6f12b26d05..aae334b148 100644 --- a/apps/files_trashbin/appinfo/database.xml +++ b/apps/files_trashbin/appinfo/database.xml @@ -18,7 +18,7 @@ text true - 50 + 250 @@ -42,7 +42,7 @@ text true - 200 + 512 From 5b949596867c986916568e5bea2003e04102aa71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Schie=C3=9Fle?= Date: Fri, 22 Feb 2013 14:56:50 +0100 Subject: [PATCH 29/54] using the number of writen bytes as indicator if streamCopy() was successfully. Instead check if fwrite returns the number of bytes or false --- lib/files/view.php | 3 +-- lib/helper.php | 8 +++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/files/view.php b/lib/files/view.php index 9ac08c9808..11edbadab9 100644 --- a/lib/files/view.php +++ b/lib/files/view.php @@ -361,10 +361,9 @@ class View { } else { $source = $this->fopen($path1 . $postFix1, 'r'); $target = $this->fopen($path2 . $postFix2, 'w'); - $count = \OC_Helper::streamCopy($source, $target); + $result = \OC_Helper::streamCopy($source, $target); list($storage1, $internalPath1) = Filesystem::resolvePath($absolutePath1 . $postFix1); $storage1->unlink($internalPath1); - $result = $count > 0; } if ($this->fakeRoot == Filesystem::getRoot()) { \OC_Hook::emit( diff --git a/lib/helper.php b/lib/helper.php index add5c66e7b..2c9cd36b19 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -513,11 +513,13 @@ class OC_Helper { if(!$source or !$target) { return false; } - $count=0; + $result=true; while(!feof($source)) { - $count+=fwrite($target, fread($source, 8192)); + if (fwrite($target, fread($source, 8192)) === false) { + $result = false; + } } - return $count; + return $result; } /** From d8137fdf66a513d0de4bb234d0427ff27ca40106 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Schie=C3=9Fle?= Date: Fri, 22 Feb 2013 16:43:11 +0100 Subject: [PATCH 30/54] return both, count and result if the operation succeeded or failed. Maybe in some cases it is useful to know how much bytes where copied --- apps/files_sharing/lib/sharedstorage.php | 3 ++- lib/files/storage/common.php | 4 ++-- lib/files/view.php | 8 ++++---- lib/helper.php | 9 ++++++--- lib/public/files.php | 3 ++- 5 files changed, 16 insertions(+), 11 deletions(-) diff --git a/apps/files_sharing/lib/sharedstorage.php b/apps/files_sharing/lib/sharedstorage.php index 65812b7e2f..e920329ae4 100644 --- a/apps/files_sharing/lib/sharedstorage.php +++ b/apps/files_sharing/lib/sharedstorage.php @@ -314,7 +314,8 @@ class Shared extends \OC\Files\Storage\Common { if ($this->isCreatable(dirname($path2))) { $source = $this->fopen($path1, 'r'); $target = $this->fopen($path2, 'w'); - return \OC_Helper::streamCopy($source, $target); + list ($count, $result) = \OC_Helper::streamCopy($source, $target); + return $result; } return false; } diff --git a/lib/files/storage/common.php b/lib/files/storage/common.php index 4e7a73e5d4..fd9ae844a8 100644 --- a/lib/files/storage/common.php +++ b/lib/files/storage/common.php @@ -97,8 +97,8 @@ abstract class Common implements \OC\Files\Storage\Storage { public function copy($path1, $path2) { $source=$this->fopen($path1, 'r'); $target=$this->fopen($path2, 'w'); - $count=\OC_Helper::streamCopy($source, $target); - return $count>0; + list($count, $result) = \OC_Helper::streamCopy($source, $target); + return $result; } /** diff --git a/lib/files/view.php b/lib/files/view.php index 11edbadab9..f48d0c8b22 100644 --- a/lib/files/view.php +++ b/lib/files/view.php @@ -285,7 +285,7 @@ class View { } $target = $this->fopen($path, 'w'); if ($target) { - $count = \OC_Helper::streamCopy($data, $target); + list ($count, $result) = \OC_Helper::streamCopy($data, $target); fclose($target); fclose($data); if ($this->fakeRoot == Filesystem::getRoot()) { @@ -303,7 +303,7 @@ class View { ); } \OC_FileProxy::runPostProxies('file_put_contents', $absolutePath, $count); - return $count > 0; + return $result; } else { return false; } @@ -361,7 +361,7 @@ class View { } else { $source = $this->fopen($path1 . $postFix1, 'r'); $target = $this->fopen($path2 . $postFix2, 'w'); - $result = \OC_Helper::streamCopy($source, $target); + list($count, $result) = \OC_Helper::streamCopy($source, $target); list($storage1, $internalPath1) = Filesystem::resolvePath($absolutePath1 . $postFix1); $storage1->unlink($internalPath1); } @@ -443,7 +443,7 @@ class View { } else { $source = $this->fopen($path1 . $postFix1, 'r'); $target = $this->fopen($path2 . $postFix2, 'w'); - $result = \OC_Helper::streamCopy($source, $target); + list($count, $result) = \OC_Helper::streamCopy($source, $target); } if ($this->fakeRoot == Filesystem::getRoot()) { \OC_Hook::emit( diff --git a/lib/helper.php b/lib/helper.php index 2c9cd36b19..7420a79eb2 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -513,13 +513,16 @@ class OC_Helper { if(!$source or !$target) { return false; } - $result=true; + $result = true; + $count = 0; while(!feof($source)) { - if (fwrite($target, fread($source, 8192)) === false) { + if ($c = fwrite($target, fread($source, 8192)) === false) { $result = false; + } else { + $count += $c; } } - return $result; + return array($count, $result); } /** diff --git a/lib/public/files.php b/lib/public/files.php index c2945b200e..700bf57453 100644 --- a/lib/public/files.php +++ b/lib/public/files.php @@ -62,7 +62,8 @@ class Files { * @return int the number of bytes copied */ public static function streamCopy( $source, $target ) { - return(\OC_Helper::streamCopy( $source, $target )); + list($count, $result) = \OC_Helper::streamCopy( $source, $target ); + return $count; } /** From eabfd9b69b11fd0859dee919d702b39bd50369dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Schie=C3=9Fle?= Date: Fri, 22 Feb 2013 16:45:57 +0100 Subject: [PATCH 31/54] put value assignment into brackets --- lib/helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/helper.php b/lib/helper.php index 7420a79eb2..41985ca57a 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -516,7 +516,7 @@ class OC_Helper { $result = true; $count = 0; while(!feof($source)) { - if ($c = fwrite($target, fread($source, 8192)) === false) { + if ( ( $c = fwrite($target, fread($source, 8192)) ) === false) { $result = false; } else { $count += $c; From e4e915fa3b461083f30afc4f17c627cccafcb0f8 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Fri, 22 Feb 2013 21:26:07 +0100 Subject: [PATCH 32/54] LDAP: simplify default for user home settings, fixes wrong display of default value in settings --- apps/user_ldap/lib/connection.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/apps/user_ldap/lib/connection.php b/apps/user_ldap/lib/connection.php index abbc133038..6643428afe 100644 --- a/apps/user_ldap/lib/connection.php +++ b/apps/user_ldap/lib/connection.php @@ -357,9 +357,6 @@ class Connection { case 'ldapAgentPassword': $value = base64_encode($value); break; - case 'homeFolderNamingRule': - $value = empty($value) ? 'opt:username' : $value; - break; case 'ldapBase': case 'ldapBaseUsers': case 'ldapBaseGroups': @@ -394,10 +391,10 @@ class Connection { $config = array(); foreach($trans as $dbKey => $classKey) { if($classKey == 'homeFolderNamingRule') { - if(strpos($this->config[$classKey], 'opt') === 0) { - $config[$dbKey] = ''; - } else { + if(strpos($this->config[$classKey], 'attr:') === 0) { $config[$dbKey] = substr($this->config[$classKey], 5); + } else { + $config[$dbKey] = ''; } continue; } else if((strpos($classKey, 'ldapBase') !== false) @@ -540,7 +537,7 @@ class Connection { 'ldap_cache_ttl' => 600, 'ldap_uuid_attribute' => 'auto', 'ldap_override_uuid_attribute' => 0, - 'home_folder_naming_rule' => 'opt:username', + 'home_folder_naming_rule' => '', 'ldap_turn_off_cert_check' => 0, 'ldap_configuration_active' => 1, 'ldap_attributes_for_user_search' => '', From 15f53250787c005fe38e0a615d6721180c6b8833 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Fri, 22 Feb 2013 21:39:44 +0100 Subject: [PATCH 33/54] Don't use routes when displaying error page --- lib/template.php | 4 +++- lib/templatelayout.php | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/template.php b/lib/template.php index 3df5a24f94..0f9efe6649 100644 --- a/lib/template.php +++ b/lib/template.php @@ -530,8 +530,10 @@ class OC_Template{ * @param string $hint An option hint message */ public static function printErrorPage( $error_msg, $hint = '' ) { + $content = new OC_Template( '', 'error', 'error' ); $errors = array(array('error' => $error_msg, 'hint' => $hint)); - OC_Template::printGuestPage("", "error", array("errors" => $errors)); + $content->assign( 'errors', $errors, false ); + $content->printPage(); die(); } } diff --git a/lib/templatelayout.php b/lib/templatelayout.php index 25d4033d9e..afa875b0a6 100644 --- a/lib/templatelayout.php +++ b/lib/templatelayout.php @@ -31,7 +31,7 @@ class OC_TemplateLayout extends OC_Template { } $user_displayname = OC_User::getDisplayName(); $this->assign( 'user_displayname', $user_displayname ); - } else if ($renderas == 'guest') { + } else if ($renderas == 'guest' || $renderas == 'error') { parent::__construct('core', 'layout.guest'); } else { parent::__construct('core', 'layout.base'); @@ -39,7 +39,7 @@ class OC_TemplateLayout extends OC_Template { // Add the js files $jsfiles = self::findJavascriptFiles(OC_Util::$scripts); $this->assign('jsfiles', array(), false); - if (OC_Config::getValue('installed', false)) { + if (OC_Config::getValue('installed', false) && $renderas!='error') { $this->append( 'jsfiles', OC_Helper::linkToRoute('js_config')); } if (!empty(OC_Util::$core_scripts)) { From 4e826b16735327a4c7777475f68787bb2bfc4e6a Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Sun, 24 Feb 2013 17:38:36 +0100 Subject: [PATCH 34/54] Set required owncloud version to 4.93 --- apps/files/appinfo/info.xml | 2 +- apps/files_external/appinfo/info.xml | 2 +- apps/files_sharing/appinfo/info.xml | 2 +- apps/files_versions/appinfo/info.xml | 2 +- apps/user_ldap/appinfo/info.xml | 2 +- apps/user_webdavauth/appinfo/info.xml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/files/appinfo/info.xml b/apps/files/appinfo/info.xml index 7c82c839da..3480037853 100644 --- a/apps/files/appinfo/info.xml +++ b/apps/files/appinfo/info.xml @@ -5,7 +5,7 @@ File Management AGPL Robin Appelman - 4.91 + 4.93 true diff --git a/apps/files_external/appinfo/info.xml b/apps/files_external/appinfo/info.xml index 2c04216a9f..0542b7b10a 100644 --- a/apps/files_external/appinfo/info.xml +++ b/apps/files_external/appinfo/info.xml @@ -5,7 +5,7 @@ Mount external storage sources AGPL Robin Appelman, Michael Gapczynski - 4.91 + 4.93 true diff --git a/apps/files_sharing/appinfo/info.xml b/apps/files_sharing/appinfo/info.xml index 1f24a4dde8..9a199281a7 100644 --- a/apps/files_sharing/appinfo/info.xml +++ b/apps/files_sharing/appinfo/info.xml @@ -5,7 +5,7 @@ File sharing between users AGPL Michael Gapczynski - 4.91 + 4.93 true diff --git a/apps/files_versions/appinfo/info.xml b/apps/files_versions/appinfo/info.xml index 0155f8e830..44878da5e4 100644 --- a/apps/files_versions/appinfo/info.xml +++ b/apps/files_versions/appinfo/info.xml @@ -4,7 +4,7 @@ Versions AGPL Frank Karlitschek - 4.91 + 4.93 true Versioning of files diff --git a/apps/user_ldap/appinfo/info.xml b/apps/user_ldap/appinfo/info.xml index 53269edfb3..03a4fa5233 100644 --- a/apps/user_ldap/appinfo/info.xml +++ b/apps/user_ldap/appinfo/info.xml @@ -7,7 +7,7 @@ This app is not compatible to the WebDAV user backend. AGPL Dominik Schmidt and Arthur Schiwon - 4.91 + 4.93 true diff --git a/apps/user_webdavauth/appinfo/info.xml b/apps/user_webdavauth/appinfo/info.xml index f62f03577e..76b314e48a 100755 --- a/apps/user_webdavauth/appinfo/info.xml +++ b/apps/user_webdavauth/appinfo/info.xml @@ -7,7 +7,7 @@ This app is not compatible to the LDAP user and group backend. AGPL Frank Karlitschek - 4.91 + 4.93 true From 21f3291eeedc86fb29f5c3a11b0e54da9f2a5adf Mon Sep 17 00:00:00 2001 From: Jenkins for ownCloud Date: Mon, 25 Feb 2013 00:06:17 +0100 Subject: [PATCH 35/54] [tx-robot] updated from transifex --- apps/files/l10n/he.php | 1 + apps/files_sharing/l10n/my_MM.php | 4 + apps/files_trashbin/l10n/he.php | 8 ++ apps/user_ldap/l10n/he.php | 1 + apps/user_ldap/l10n/my_MM.php | 1 + core/l10n/he.php | 7 + core/l10n/my_MM.php | 53 +++++++- l10n/he/core.po | 96 +++++++------- l10n/he/files.po | 18 +-- l10n/he/files_trashbin.po | 23 ++-- l10n/he/settings.po | 80 ++++++------ l10n/he/user_ldap.po | 116 ++++++++--------- l10n/my_MM/core.po | 194 ++++++++++++++-------------- l10n/my_MM/files_sharing.po | 16 +-- l10n/my_MM/lib.po | 8 +- l10n/my_MM/settings.po | 84 ++++++------ l10n/my_MM/user_ldap.po | 4 +- l10n/templates/core.pot | 2 +- l10n/templates/files.pot | 2 +- l10n/templates/files_encryption.pot | 2 +- l10n/templates/files_external.pot | 2 +- l10n/templates/files_sharing.pot | 2 +- l10n/templates/files_trashbin.pot | 2 +- l10n/templates/files_versions.pot | 2 +- l10n/templates/lib.pot | 2 +- l10n/templates/settings.pot | 2 +- l10n/templates/user_ldap.pot | 2 +- l10n/templates/user_webdavauth.pot | 2 +- lib/l10n/my_MM.php | 1 + settings/l10n/he.php | 1 + settings/l10n/my_MM.php | 5 +- 31 files changed, 411 insertions(+), 332 deletions(-) create mode 100644 apps/files_sharing/l10n/my_MM.php diff --git a/apps/files/l10n/he.php b/apps/files/l10n/he.php index 442eafe1c0..ca2cb14027 100644 --- a/apps/files/l10n/he.php +++ b/apps/files/l10n/he.php @@ -8,6 +8,7 @@ "Missing a temporary folder" => "תיקייה זמנית חסרה", "Failed to write to disk" => "הכתיבה לכונן נכשלה", "Files" => "קבצים", +"Delete permanently" => "מחק לצמיתות", "Delete" => "מחיקה", "Rename" => "שינוי שם", "Pending" => "ממתין", diff --git a/apps/files_sharing/l10n/my_MM.php b/apps/files_sharing/l10n/my_MM.php new file mode 100644 index 0000000000..aa574b58b0 --- /dev/null +++ b/apps/files_sharing/l10n/my_MM.php @@ -0,0 +1,4 @@ + "စကားဝှက်", +"web services under your control" => "သင်၏ထိန်းချုပ်မှု့အောက်တွင်ရှိသော Web services" +); diff --git a/apps/files_trashbin/l10n/he.php b/apps/files_trashbin/l10n/he.php index fe60eab7b7..9c767d2222 100644 --- a/apps/files_trashbin/l10n/he.php +++ b/apps/files_trashbin/l10n/he.php @@ -1,8 +1,16 @@ "בלתי אפשרי למחוק את %s לצמיתות", +"Couldn't restore %s" => "בלתי אפשרי לשחזר את %s", +"perform restore operation" => "בצע פעולת שחזור", +"delete file permanently" => "מחק קובץ לצמיתות", +"Delete permanently" => "מחק לצמיתות", "Name" => "שם", +"Deleted" => "נמחק", "1 folder" => "תיקייה אחת", "{count} folders" => "{count} תיקיות", "1 file" => "קובץ אחד", "{count} files" => "{count} קבצים", +"Nothing in here. Your trash bin is empty!" => "שום דבר כאן. סל המחזור שלך ריק!", +"Restore" => "שחזר", "Delete" => "מחיקה" ); diff --git a/apps/user_ldap/l10n/he.php b/apps/user_ldap/l10n/he.php index 5c563b7b6f..c9b0e282f1 100644 --- a/apps/user_ldap/l10n/he.php +++ b/apps/user_ldap/l10n/he.php @@ -7,6 +7,7 @@ "User Login Filter" => "סנן כניסת משתמש", "User List Filter" => "סנן רשימת משתמשים", "Group Filter" => "סנן קבוצה", +"Port" => "פורט", "in seconds. A change empties the cache." => "בשניות. שינוי מרוקן את המטמון.", "in bytes" => "בבתים", "Help" => "עזרה" diff --git a/apps/user_ldap/l10n/my_MM.php b/apps/user_ldap/l10n/my_MM.php index d7bd0adc49..ee8d3dd26f 100644 --- a/apps/user_ldap/l10n/my_MM.php +++ b/apps/user_ldap/l10n/my_MM.php @@ -1,3 +1,4 @@ "စကားဝှက်", "Help" => "အကူအညီ" ); diff --git a/core/l10n/he.php b/core/l10n/he.php index 75c378cece..1db5820bdf 100644 --- a/core/l10n/he.php +++ b/core/l10n/he.php @@ -5,6 +5,7 @@ "User %s shared the folder \"%s\" with you. It is available for download here: %s" => "המשתמש %s שיתף אתך את התיקייה „%s“. ניתן להוריד את התיקייה מכאן: %s", "Category type not provided." => "סוג הקטגוריה לא סופק.", "No category to add?" => "אין קטגוריה להוספה?", +"This category already exists: %s" => "הקטגוריה הבאה כבר קיימת: %s", "Object type not provided." => "סוג הפריט לא סופק.", "%s ID not provided." => "מזהה %s לא סופק.", "Error adding %s to favorites." => "אירעה שגיאה בעת הוספת %s למועדפים.", @@ -52,6 +53,7 @@ "Error" => "שגיאה", "The app name is not specified." => "שם היישום לא צוין.", "The required file {file} is not installed!" => "הקובץ הנדרש {file} אינו מותקן!", +"Shared" => "שותף", "Share" => "שתף", "Error while sharing" => "שגיאה במהלך השיתוף", "Error while unsharing" => "שגיאה במהלך ביטול השיתוף", @@ -82,6 +84,8 @@ "Error setting expiration date" => "אירעה שגיאה בעת הגדרת תאריך התפוגה", "Sending ..." => "מתבצעת שליחה ...", "Email sent" => "הודעת הדוא״ל נשלחה", +"The update was unsuccessful. Please report this issue to the ownCloud community." => "תהליך העדכון לא הושלם בהצלחה. נא דווח את הבעיה בקהילת ownCloud.", +"The update was successful. Redirecting you to ownCloud now." => "תהליך העדכון הסתיים בהצלחה. עכשיו מנתב אותך אל ownCloud.", "ownCloud password reset" => "איפוס הססמה של ownCloud", "Use the following link to reset your password: {link}" => "יש להשתמש בקישור הבא כדי לאפס את הססמה שלך: {link}", "You will receive a link to reset your password via Email." => "יישלח לתיבת הדוא״ל שלך קישור לאיפוס הססמה.", @@ -105,6 +109,8 @@ "Security Warning" => "אזהרת אבטחה", "No secure random number generator is available, please enable the PHP OpenSSL extension." => "אין מחולל מספרים אקראיים מאובטח, נא להפעיל את ההרחבה OpenSSL ב־PHP.", "Without a secure random number generator an attacker may be able to predict password reset tokens and take over your account." => "ללא מחולל מספרים אקראיים מאובטח תוקף יכול לנבא את מחרוזות איפוס הססמה ולהשתלט על החשבון שלך.", +"Your data directory and files are probably accessible from the internet because the .htaccess file does not work." => "תיקיית וקבצי המידע שלך כנראה נגישים מהאינטרנט מכיוון שקובץ ה.htaccess לא עובד.", +"For information how to properly configure your server, please see the documentation." => "לקבלת מידע להגדרה נכונה של השרת שלך, ראה את התיעוד.", "Create an admin account" => "יצירת חשבון מנהל", "Advanced" => "מתקדם", "Data folder" => "תיקיית נתונים", @@ -124,6 +130,7 @@ "Lost your password?" => "שכחת את ססמתך?", "remember" => "שמירת הססמה", "Log in" => "כניסה", +"Alternative Logins" => "כניסות אלטרנטיביות", "prev" => "הקודם", "next" => "הבא", "Updating ownCloud to version %s, this may take a while." => "מעדכן את ownCloud אל גרסא %s, זה עלול לקחת זמן מה." diff --git a/core/l10n/my_MM.php b/core/l10n/my_MM.php index f8d2458081..97631d4df5 100644 --- a/core/l10n/my_MM.php +++ b/core/l10n/my_MM.php @@ -1,4 +1,18 @@ "ထည့်ရန်ခေါင်းစဉ်မရှိဘူးလား", +"No categories selected for deletion." => "ဖျက်ရန်အတွက်ခေါင်းစဉ်မရွေးထားပါ", +"January" => "ဇန်နဝါရီ", +"February" => "ဖေဖော်ဝါရီ", +"March" => "မတ်", +"April" => "ဧပြီ", +"May" => "မေ", +"June" => "ဇွန်", +"July" => "ဇူလိုင်", +"August" => "ဩဂုတ်", +"September" => "စက်တင်ဘာ", +"October" => "အောက်တိုဘာ", +"November" => "နိုဝင်ဘာ", +"December" => "ဒီဇင်ဘာ", "seconds ago" => "စက္ကန့်အနည်းငယ်က", "1 minute ago" => "၁ မိနစ်အရင်က", "1 hour ago" => "၁ နာရီ အရင်က", @@ -7,7 +21,44 @@ "last month" => "ပြီးခဲ့သောလ", "last year" => "မနှစ်က", "years ago" => "နှစ် အရင်က", +"Choose" => "ရွေးချယ်", +"Cancel" => "ပယ်ဖျက်မည်", +"No" => "မဟုတ်ဘူး", +"Yes" => "ဟုတ်", +"Ok" => "အိုကေ", +"Password" => "စကားဝှက်", +"Set expiration date" => "သက်တမ်းကုန်ဆုံးမည့်ရက်သတ်မှတ်မည်", +"Expiration date" => "သက်တမ်းကုန်ဆုံးမည့်ရက်", +"Share via email:" => "အီးမေးလ်ဖြင့်ဝေမျှမည် -", +"Resharing is not allowed" => "ပြန်လည်ဝေမျှခြင်းခွင့်မပြုပါ", +"can edit" => "ပြင်ဆင်နိုင်", +"create" => "ဖန်တီးမည်", +"delete" => "ဖျက်မည်", +"share" => "ဝေမျှမည်", +"Password protected" => "စကားဝှက်ဖြင့်ကာကွယ်ထားသည်", +"You will receive a link to reset your password via Email." => "အီးမေးလ်မှတစ်ဆင့် သင်၏စကားဝှက်ကို ပြန်ဖော်ရန်အတွက် Link တစ်ခုလက်ခံရရှိပါလိမ့်မယ်။", +"Username" => "သုံးစွဲသူအမည်", +"Your password was reset" => "သင်၏စကားဝှက်ကိုပြန်ဖော်ပြီးပါပြီ။", +"To login page" => "ဝင်ရောက်သည့်စာမျက်နှာသို့", +"New password" => "စကားဝှက်အသစ်", "Users" => "သုံးစွဲသူ", "Apps" => "Apps", -"Help" => "အကူအညီ" +"Admin" => "အက်ဒမင်", +"Help" => "အကူအညီ", +"Cloud not found" => "မတွေ့ရှိမိပါ", +"Add" => "ပေါင်းထည့်", +"Security Warning" => "လုံခြုံရေးသတိပေးချက်", +"Create an admin account" => "အက်ဒမင်အကောင့်တစ်ခုဖန်တီးမည်", +"Advanced" => "အဆင့်မြင့်", +"Data folder" => "အချက်အလက်ဖိုလ်ဒါလ်", +"Database user" => "Database သုံးစွဲသူ", +"Database password" => "Database စကားဝှက်", +"Database name" => "Database အမည်", +"Finish setup" => "တပ်ဆင်ခြင်းပြီးပါပြီ။", +"web services under your control" => "သင်၏ထိန်းချုပ်မှု့အောက်တွင်ရှိသော Web services", +"Lost your password?" => "သင်၏စကားဝှက်ပျောက်သွားပြီလား။", +"remember" => "မှတ်မိစေသည်", +"Log in" => "ဝင်ရောက်ရန်", +"prev" => "ယခင်", +"next" => "နောက်သို့" ); diff --git a/l10n/he/core.po b/l10n/he/core.po index 49cfe652f2..612d193348 100644 --- a/l10n/he/core.po +++ b/l10n/he/core.po @@ -12,9 +12,9 @@ msgid "" msgstr "" "Project-Id-Version: ownCloud\n" "Report-Msgid-Bugs-To: http://bugs.owncloud.org/\n" -"POT-Creation-Date: 2013-02-22 00:06+0100\n" -"PO-Revision-Date: 2013-02-20 23:20+0000\n" -"Last-Translator: I Robot \n" +"POT-Creation-Date: 2013-02-25 00:05+0100\n" +"PO-Revision-Date: 2013-02-24 12:10+0000\n" +"Last-Translator: Gilad Naaman \n" "Language-Team: Hebrew (http://www.transifex.com/projects/p/owncloud/language/he/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -22,24 +22,24 @@ msgstr "" "Language: he\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#: ajax/share.php:85 +#: ajax/share.php:97 #, php-format msgid "User %s shared a file with you" msgstr "המשתמש %s שיתף אתך קובץ" -#: ajax/share.php:87 +#: ajax/share.php:99 #, php-format msgid "User %s shared a folder with you" msgstr "המשתמש %s שיתף אתך תיקייה" -#: ajax/share.php:89 +#: ajax/share.php:101 #, php-format msgid "" "User %s shared the file \"%s\" with you. It is available for download here: " "%s" msgstr "המשתמש %s שיתף אתך את הקובץ „%s“. ניתן להוריד את הקובץ מכאן: %s" -#: ajax/share.php:91 +#: ajax/share.php:104 #, php-format msgid "" "User %s shared the folder \"%s\" with you. It is available for download " @@ -57,7 +57,7 @@ msgstr "אין קטגוריה להוספה?" #: ajax/vcategories/add.php:37 #, php-format msgid "This category already exists: %s" -msgstr "" +msgstr "הקטגוריה הבאה כבר קיימת: %s" #: ajax/vcategories/addToFavorites.php:26 ajax/vcategories/delete.php:27 #: ajax/vcategories/favorites.php:24 @@ -85,79 +85,79 @@ msgstr "לא נבחרו קטגוריות למחיקה" msgid "Error removing %s from favorites." msgstr "שגיאה בהסרת %s מהמועדפים." -#: js/config.php:32 +#: js/config.php:34 msgid "Sunday" msgstr "יום ראשון" -#: js/config.php:32 +#: js/config.php:35 msgid "Monday" msgstr "יום שני" -#: js/config.php:32 +#: js/config.php:36 msgid "Tuesday" msgstr "יום שלישי" -#: js/config.php:32 +#: js/config.php:37 msgid "Wednesday" msgstr "יום רביעי" -#: js/config.php:32 +#: js/config.php:38 msgid "Thursday" msgstr "יום חמישי" -#: js/config.php:32 +#: js/config.php:39 msgid "Friday" msgstr "יום שישי" -#: js/config.php:32 +#: js/config.php:40 msgid "Saturday" msgstr "שבת" -#: js/config.php:33 +#: js/config.php:45 msgid "January" msgstr "ינואר" -#: js/config.php:33 +#: js/config.php:46 msgid "February" msgstr "פברואר" -#: js/config.php:33 +#: js/config.php:47 msgid "March" msgstr "מרץ" -#: js/config.php:33 +#: js/config.php:48 msgid "April" msgstr "אפריל" -#: js/config.php:33 +#: js/config.php:49 msgid "May" msgstr "מאי" -#: js/config.php:33 +#: js/config.php:50 msgid "June" msgstr "יוני" -#: js/config.php:33 +#: js/config.php:51 msgid "July" msgstr "יולי" -#: js/config.php:33 +#: js/config.php:52 msgid "August" msgstr "אוגוסט" -#: js/config.php:33 +#: js/config.php:53 msgid "September" msgstr "ספטמבר" -#: js/config.php:33 +#: js/config.php:54 msgid "October" msgstr "אוקטובר" -#: js/config.php:33 +#: js/config.php:55 msgid "November" msgstr "נובמבר" -#: js/config.php:33 +#: js/config.php:56 msgid "December" msgstr "דצמבר" @@ -258,7 +258,7 @@ msgstr "הקובץ הנדרש {file} אינו מותקן!" #: js/share.js:29 js/share.js:43 js/share.js:90 msgid "Shared" -msgstr "" +msgstr "שותף" #: js/share.js:93 msgid "Share" @@ -296,7 +296,7 @@ msgstr "שיתוף עם קישור" msgid "Password protect" msgstr "הגנה בססמה" -#: js/share.js:185 templates/installation.php:44 templates/login.php:35 +#: js/share.js:185 templates/installation.php:46 templates/login.php:35 msgid "Password" msgstr "ססמה" @@ -385,11 +385,11 @@ msgid "" "The update was unsuccessful. Please report this issue to the ownCloud " "community." -msgstr "" +msgstr "תהליך העדכון לא הושלם בהצלחה. נא דווח את הבעיה בקהילת ownCloud." #: js/update.js:18 msgid "The update was successful. Redirecting you to ownCloud now." -msgstr "" +msgstr "תהליך העדכון הסתיים בהצלחה. עכשיו מנתב אותך אל ownCloud." #: lostpassword/controller.php:48 msgid "ownCloud password reset" @@ -411,7 +411,7 @@ msgstr "איפוס שליחת דוא״ל." msgid "Request failed!" msgstr "הבקשה נכשלה!" -#: lostpassword/templates/lostpassword.php:11 templates/installation.php:39 +#: lostpassword/templates/lostpassword.php:11 templates/installation.php:40 #: templates/login.php:28 msgid "Username" msgstr "שם משתמש" @@ -492,65 +492,65 @@ msgstr "ללא מחולל מספרים אקראיים מאובטח תוקף יכ msgid "" "Your data directory and files are probably accessible from the internet " "because the .htaccess file does not work." -msgstr "" +msgstr "תיקיית וקבצי המידע שלך כנראה נגישים מהאינטרנט מכיוון שקובץ ה.htaccess לא עובד." #: templates/installation.php:32 msgid "" "For information how to properly configure your server, please see the documentation." -msgstr "" +msgstr "לקבלת מידע להגדרה נכונה של השרת שלך, ראה את התיעוד." #: templates/installation.php:36 msgid "Create an admin account" msgstr "יצירת חשבון מנהל" -#: templates/installation.php:52 +#: templates/installation.php:54 msgid "Advanced" msgstr "מתקדם" -#: templates/installation.php:54 +#: templates/installation.php:56 msgid "Data folder" msgstr "תיקיית נתונים" -#: templates/installation.php:61 +#: templates/installation.php:65 msgid "Configure the database" msgstr "הגדרת מסד הנתונים" -#: templates/installation.php:66 templates/installation.php:77 -#: templates/installation.php:87 templates/installation.php:97 +#: templates/installation.php:70 templates/installation.php:82 +#: templates/installation.php:93 templates/installation.php:104 msgid "will be used" msgstr "ינוצלו" -#: templates/installation.php:109 +#: templates/installation.php:117 msgid "Database user" msgstr "שם משתמש במסד הנתונים" -#: templates/installation.php:113 +#: templates/installation.php:122 msgid "Database password" msgstr "ססמת מסד הנתונים" -#: templates/installation.php:117 +#: templates/installation.php:127 msgid "Database name" msgstr "שם מסד הנתונים" -#: templates/installation.php:125 +#: templates/installation.php:137 msgid "Database tablespace" msgstr "מרחב הכתובות של מסד הנתונים" -#: templates/installation.php:131 +#: templates/installation.php:144 msgid "Database host" msgstr "שרת בסיס נתונים" -#: templates/installation.php:136 +#: templates/installation.php:150 msgid "Finish setup" msgstr "סיום התקנה" -#: templates/layout.guest.php:33 +#: templates/layout.guest.php:35 msgid "web services under your control" msgstr "שירותי רשת בשליטתך" -#: templates/layout.user.php:48 +#: templates/layout.user.php:53 msgid "Log out" msgstr "התנתקות" @@ -582,7 +582,7 @@ msgstr "כניסה" #: templates/login.php:49 msgid "Alternative Logins" -msgstr "" +msgstr "כניסות אלטרנטיביות" #: templates/part.pagenavi.php:3 msgid "prev" diff --git a/l10n/he/files.po b/l10n/he/files.po index aa31effeb9..569dbeb0da 100644 --- a/l10n/he/files.po +++ b/l10n/he/files.po @@ -11,8 +11,8 @@ msgid "" msgstr "" "Project-Id-Version: ownCloud\n" "Report-Msgid-Bugs-To: http://bugs.owncloud.org/\n" -"POT-Creation-Date: 2013-02-22 00:06+0100\n" -"PO-Revision-Date: 2013-02-20 23:30+0000\n" +"POT-Creation-Date: 2013-02-25 00:05+0100\n" +"PO-Revision-Date: 2013-02-24 12:30+0000\n" "Last-Translator: I Robot \n" "Language-Team: Hebrew (http://www.transifex.com/projects/p/owncloud/language/he/)\n" "MIME-Version: 1.0\n" @@ -54,27 +54,27 @@ msgid "" "the HTML form" msgstr "הקובץ שהועלה חרג מההנחיה MAX_FILE_SIZE שצוינה בטופס ה־HTML" -#: ajax/upload.php:31 +#: ajax/upload.php:30 msgid "The uploaded file was only partially uploaded" msgstr "הקובץ שהועלה הועלה בצורה חלקית" -#: ajax/upload.php:32 +#: ajax/upload.php:31 msgid "No file was uploaded" msgstr "לא הועלו קבצים" -#: ajax/upload.php:33 +#: ajax/upload.php:32 msgid "Missing a temporary folder" msgstr "תיקייה זמנית חסרה" -#: ajax/upload.php:34 +#: ajax/upload.php:33 msgid "Failed to write to disk" msgstr "הכתיבה לכונן נכשלה" -#: ajax/upload.php:52 +#: ajax/upload.php:51 msgid "Not enough storage available" msgstr "" -#: ajax/upload.php:83 +#: ajax/upload.php:82 msgid "Invalid directory." msgstr "" @@ -84,7 +84,7 @@ msgstr "קבצים" #: js/fileactions.js:125 msgid "Delete permanently" -msgstr "" +msgstr "מחק לצמיתות" #: js/fileactions.js:127 templates/index.php:91 templates/index.php:92 msgid "Delete" diff --git a/l10n/he/files_trashbin.po b/l10n/he/files_trashbin.po index fc348ed86c..0f5b6dca9e 100644 --- a/l10n/he/files_trashbin.po +++ b/l10n/he/files_trashbin.po @@ -3,13 +3,14 @@ # This file is distributed under the same license as the PACKAGE package. # # Translators: +# Gilad Naaman , 2013. msgid "" msgstr "" "Project-Id-Version: ownCloud\n" "Report-Msgid-Bugs-To: http://bugs.owncloud.org/\n" -"POT-Creation-Date: 2013-02-22 00:06+0100\n" -"PO-Revision-Date: 2013-02-20 23:32+0000\n" -"Last-Translator: I Robot \n" +"POT-Creation-Date: 2013-02-25 00:05+0100\n" +"PO-Revision-Date: 2013-02-24 12:30+0000\n" +"Last-Translator: Gilad Naaman \n" "Language-Team: Hebrew (http://www.transifex.com/projects/p/owncloud/language/he/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -20,24 +21,24 @@ msgstr "" #: ajax/delete.php:40 #, php-format msgid "Couldn't delete %s permanently" -msgstr "" +msgstr "בלתי אפשרי למחוק את %s לצמיתות" #: ajax/undelete.php:41 #, php-format msgid "Couldn't restore %s" -msgstr "" +msgstr "בלתי אפשרי לשחזר את %s" #: js/trash.js:7 js/trash.js:96 msgid "perform restore operation" -msgstr "" +msgstr "בצע פעולת שחזור" #: js/trash.js:34 msgid "delete file permanently" -msgstr "" +msgstr "מחק קובץ לצמיתות" #: js/trash.js:121 msgid "Delete permanently" -msgstr "" +msgstr "מחק לצמיתות" #: js/trash.js:151 templates/index.php:17 msgid "Name" @@ -45,7 +46,7 @@ msgstr "שם" #: js/trash.js:152 templates/index.php:27 msgid "Deleted" -msgstr "" +msgstr "נמחק" #: js/trash.js:161 msgid "1 folder" @@ -65,11 +66,11 @@ msgstr "{count} קבצים" #: templates/index.php:9 msgid "Nothing in here. Your trash bin is empty!" -msgstr "" +msgstr "שום דבר כאן. סל המחזור שלך ריק!" #: templates/index.php:20 templates/index.php:22 msgid "Restore" -msgstr "" +msgstr "שחזר" #: templates/index.php:30 templates/index.php:31 msgid "Delete" diff --git a/l10n/he/settings.po b/l10n/he/settings.po index 67cfba57dd..72e496d262 100644 --- a/l10n/he/settings.po +++ b/l10n/he/settings.po @@ -11,8 +11,8 @@ msgid "" msgstr "" "Project-Id-Version: ownCloud\n" "Report-Msgid-Bugs-To: http://bugs.owncloud.org/\n" -"POT-Creation-Date: 2013-02-22 00:06+0100\n" -"PO-Revision-Date: 2013-02-20 23:30+0000\n" +"POT-Creation-Date: 2013-02-25 00:05+0100\n" +"PO-Revision-Date: 2013-02-24 12:20+0000\n" "Last-Translator: I Robot \n" "Language-Team: Hebrew (http://www.transifex.com/projects/p/owncloud/language/he/)\n" "MIME-Version: 1.0\n" @@ -25,8 +25,8 @@ msgstr "" msgid "Unable to load list from App Store" msgstr "לא ניתן לטעון רשימה מה־App Store" -#: ajax/changedisplayname.php:23 ajax/removeuser.php:15 ajax/setquota.php:15 -#: ajax/togglegroups.php:18 +#: ajax/changedisplayname.php:23 ajax/removeuser.php:15 ajax/setquota.php:17 +#: ajax/togglegroups.php:20 msgid "Authentication error" msgstr "שגיאת הזדהות" @@ -74,12 +74,12 @@ msgstr "בקשה לא חוקית" msgid "Admins can't remove themself from the admin group" msgstr "מנהלים לא יכולים להסיר את עצמם מקבוצת המנהלים" -#: ajax/togglegroups.php:28 +#: ajax/togglegroups.php:30 #, php-format msgid "Unable to add user to group %s" msgstr "לא ניתן להוסיף משתמש לקבוצה %s" -#: ajax/togglegroups.php:34 +#: ajax/togglegroups.php:36 #, php-format msgid "Unable to remove user from group %s" msgstr "לא ניתן להסיר משתמש מהקבוצה %s" @@ -320,11 +320,11 @@ msgstr "" msgid "More" msgstr "יותר" -#: templates/admin.php:227 templates/personal.php:98 +#: templates/admin.php:227 templates/personal.php:102 msgid "Version" msgstr "גרסא" -#: templates/admin.php:230 templates/personal.php:100 +#: templates/admin.php:230 templates/personal.php:105 msgid "" "Developed by the ownCloud community, the AGPL." msgstr "פותח על די קהילתownCloud, קוד המקור מוגן ברישיון AGPL." -#: templates/apps.php:10 +#: templates/apps.php:11 msgid "Add your App" msgstr "הוספת היישום שלך" -#: templates/apps.php:11 +#: templates/apps.php:12 msgid "More Apps" msgstr "יישומים נוספים" -#: templates/apps.php:24 +#: templates/apps.php:28 msgid "Select an App" msgstr "בחירת יישום" -#: templates/apps.php:28 +#: templates/apps.php:34 msgid "See application page at apps.owncloud.com" msgstr "צפה בעמוד הישום ב apps.owncloud.com" -#: templates/apps.php:29 +#: templates/apps.php:36 msgid "-licensed by " msgstr "ברישיון לטובת " -#: templates/apps.php:31 +#: templates/apps.php:38 msgid "Update" msgstr "עדכון" -#: templates/help.php:3 +#: templates/help.php:4 msgid "User Documentation" msgstr "תיעוד משתמש" -#: templates/help.php:4 +#: templates/help.php:6 msgid "Administrator Documentation" msgstr "תיעוד מנהלים" -#: templates/help.php:6 +#: templates/help.php:9 msgid "Online Documentation" msgstr "תיעוד מקוון" -#: templates/help.php:7 +#: templates/help.php:11 msgid "Forum" msgstr "פורום" -#: templates/help.php:9 +#: templates/help.php:14 msgid "Bugtracker" msgstr "" -#: templates/help.php:11 +#: templates/help.php:17 msgid "Commercial Support" msgstr "תמיכה בתשלום" @@ -387,79 +387,79 @@ msgstr "תמיכה בתשלום" msgid "You have used %s of the available %s" msgstr "השתמשת ב־%s מתוך %s הזמינים לך" -#: templates/personal.php:14 +#: templates/personal.php:15 msgid "Get the apps to sync your files" -msgstr "" +msgstr "השג את האפליקציות על מנת לסנכרן את הקבצים שלך" -#: templates/personal.php:25 +#: templates/personal.php:26 msgid "Show First Run Wizard again" msgstr "" -#: templates/personal.php:36 templates/users.php:23 templates/users.php:79 +#: templates/personal.php:37 templates/users.php:23 templates/users.php:79 msgid "Password" msgstr "ססמה" -#: templates/personal.php:37 +#: templates/personal.php:38 msgid "Your password was changed" msgstr "הססמה שלך הוחלפה" -#: templates/personal.php:38 +#: templates/personal.php:39 msgid "Unable to change your password" msgstr "לא ניתן לשנות את הססמה שלך" -#: templates/personal.php:39 +#: templates/personal.php:40 msgid "Current password" msgstr "ססמה נוכחית" -#: templates/personal.php:40 +#: templates/personal.php:42 msgid "New password" msgstr "ססמה חדשה" -#: templates/personal.php:42 +#: templates/personal.php:44 msgid "Change password" msgstr "שינוי ססמה" -#: templates/personal.php:54 templates/users.php:78 +#: templates/personal.php:56 templates/users.php:78 msgid "Display Name" msgstr "" -#: templates/personal.php:55 +#: templates/personal.php:57 msgid "Your display name was changed" msgstr "" -#: templates/personal.php:56 +#: templates/personal.php:58 msgid "Unable to change your display name" msgstr "" -#: templates/personal.php:59 +#: templates/personal.php:61 msgid "Change display name" msgstr "" -#: templates/personal.php:68 +#: templates/personal.php:70 msgid "Email" msgstr "דוא״ל" -#: templates/personal.php:69 +#: templates/personal.php:72 msgid "Your email address" msgstr "כתובת הדוא״ל שלך" -#: templates/personal.php:70 +#: templates/personal.php:73 msgid "Fill in an email address to enable password recovery" msgstr "נא למלא את כתובת הדוא״ל שלך כדי לאפשר שחזור ססמה" -#: templates/personal.php:76 templates/personal.php:77 +#: templates/personal.php:79 templates/personal.php:80 msgid "Language" msgstr "פה" -#: templates/personal.php:82 +#: templates/personal.php:86 msgid "Help translate" msgstr "עזרה בתרגום" -#: templates/personal.php:87 +#: templates/personal.php:91 msgid "WebDAV" msgstr "" -#: templates/personal.php:89 +#: templates/personal.php:93 msgid "Use this address to connect to your ownCloud in your file manager" msgstr "השתמש בכתובת זאת על מנת להתחבר אל ownCloud דרך סייר קבצים." diff --git a/l10n/he/user_ldap.po b/l10n/he/user_ldap.po index cd67250d86..0052056c21 100644 --- a/l10n/he/user_ldap.po +++ b/l10n/he/user_ldap.po @@ -8,8 +8,8 @@ msgid "" msgstr "" "Project-Id-Version: ownCloud\n" "Report-Msgid-Bugs-To: http://bugs.owncloud.org/\n" -"POT-Creation-Date: 2013-02-08 00:10+0100\n" -"PO-Revision-Date: 2013-02-07 23:11+0000\n" +"POT-Creation-Date: 2013-02-25 00:05+0100\n" +"PO-Revision-Date: 2013-02-24 12:30+0000\n" "Last-Translator: I Robot \n" "Language-Team: Hebrew (http://www.transifex.com/projects/p/owncloud/language/he/)\n" "MIME-Version: 1.0\n" @@ -22,17 +22,17 @@ msgstr "" msgid "Failed to delete the server configuration" msgstr "" -#: ajax/testConfiguration.php:35 +#: ajax/testConfiguration.php:36 msgid "The configuration is valid and the connection could be established!" msgstr "" -#: ajax/testConfiguration.php:37 +#: ajax/testConfiguration.php:39 msgid "" "The configuration is valid, but the Bind failed. Please check the server " "settings and credentials." msgstr "" -#: ajax/testConfiguration.php:40 +#: ajax/testConfiguration.php:43 msgid "" "The configuration is invalid. Please look in the ownCloud log for further " "details." @@ -87,224 +87,224 @@ msgstr "" msgid "Server configuration" msgstr "" -#: templates/settings.php:17 +#: templates/settings.php:18 msgid "Add Server Configuration" msgstr "" -#: templates/settings.php:21 +#: templates/settings.php:23 msgid "Host" msgstr "מארח" -#: templates/settings.php:21 +#: templates/settings.php:25 msgid "" "You can omit the protocol, except you require SSL. Then start with ldaps://" msgstr "" -#: templates/settings.php:22 +#: templates/settings.php:26 msgid "Base DN" msgstr "" -#: templates/settings.php:22 +#: templates/settings.php:27 msgid "One Base DN per line" msgstr "" -#: templates/settings.php:22 +#: templates/settings.php:28 msgid "You can specify Base DN for users and groups in the Advanced tab" msgstr "" -#: templates/settings.php:23 +#: templates/settings.php:30 msgid "User DN" msgstr "DN משתמש" -#: templates/settings.php:23 +#: templates/settings.php:32 msgid "" "The DN of the client user with which the bind shall be done, e.g. " "uid=agent,dc=example,dc=com. For anonymous access, leave DN and Password " "empty." msgstr "" -#: templates/settings.php:24 +#: templates/settings.php:33 msgid "Password" msgstr "סיסמא" -#: templates/settings.php:24 +#: templates/settings.php:36 msgid "For anonymous access, leave DN and Password empty." msgstr "לגישה אנונימית, השאר את הDM והסיסמא ריקים." -#: templates/settings.php:25 +#: templates/settings.php:37 msgid "User Login Filter" msgstr "סנן כניסת משתמש" -#: templates/settings.php:25 +#: templates/settings.php:40 #, php-format msgid "" "Defines the filter to apply, when login is attempted. %%uid replaces the " "username in the login action." msgstr "" -#: templates/settings.php:25 +#: templates/settings.php:41 #, php-format msgid "use %%uid placeholder, e.g. \"uid=%%uid\"" msgstr "" -#: templates/settings.php:26 +#: templates/settings.php:42 msgid "User List Filter" msgstr "סנן רשימת משתמשים" -#: templates/settings.php:26 +#: templates/settings.php:45 msgid "Defines the filter to apply, when retrieving users." msgstr "" -#: templates/settings.php:26 +#: templates/settings.php:46 msgid "without any placeholder, e.g. \"objectClass=person\"." msgstr "" -#: templates/settings.php:27 +#: templates/settings.php:47 msgid "Group Filter" msgstr "סנן קבוצה" -#: templates/settings.php:27 +#: templates/settings.php:50 msgid "Defines the filter to apply, when retrieving groups." msgstr "" -#: templates/settings.php:27 +#: templates/settings.php:51 msgid "without any placeholder, e.g. \"objectClass=posixGroup\"." msgstr "" -#: templates/settings.php:31 +#: templates/settings.php:55 msgid "Connection Settings" msgstr "" -#: templates/settings.php:33 +#: templates/settings.php:57 msgid "Configuration Active" msgstr "" -#: templates/settings.php:33 +#: templates/settings.php:57 msgid "When unchecked, this configuration will be skipped." msgstr "" -#: templates/settings.php:34 +#: templates/settings.php:58 msgid "Port" -msgstr "" +msgstr "פורט" -#: templates/settings.php:35 +#: templates/settings.php:59 msgid "Backup (Replica) Host" msgstr "" -#: templates/settings.php:35 +#: templates/settings.php:59 msgid "" "Give an optional backup host. It must be a replica of the main LDAP/AD " "server." msgstr "" -#: templates/settings.php:36 +#: templates/settings.php:60 msgid "Backup (Replica) Port" msgstr "" -#: templates/settings.php:37 +#: templates/settings.php:61 msgid "Disable Main Server" msgstr "" -#: templates/settings.php:37 +#: templates/settings.php:61 msgid "When switched on, ownCloud will only connect to the replica server." msgstr "" -#: templates/settings.php:38 +#: templates/settings.php:62 msgid "Use TLS" msgstr "" -#: templates/settings.php:38 +#: templates/settings.php:62 msgid "Do not use it additionally for LDAPS connections, it will fail." msgstr "" -#: templates/settings.php:39 +#: templates/settings.php:63 msgid "Case insensitve LDAP server (Windows)" msgstr "" -#: templates/settings.php:40 +#: templates/settings.php:64 msgid "Turn off SSL certificate validation." msgstr "" -#: templates/settings.php:40 +#: templates/settings.php:64 msgid "" "If connection only works with this option, import the LDAP server's SSL " "certificate in your ownCloud server." msgstr "" -#: templates/settings.php:40 +#: templates/settings.php:64 msgid "Not recommended, use for testing only." msgstr "" -#: templates/settings.php:41 +#: templates/settings.php:65 msgid "in seconds. A change empties the cache." msgstr "בשניות. שינוי מרוקן את המטמון." -#: templates/settings.php:43 +#: templates/settings.php:67 msgid "Directory Settings" msgstr "" -#: templates/settings.php:45 +#: templates/settings.php:69 msgid "User Display Name Field" msgstr "" -#: templates/settings.php:45 +#: templates/settings.php:69 msgid "The LDAP attribute to use to generate the user`s ownCloud name." msgstr "" -#: templates/settings.php:46 +#: templates/settings.php:70 msgid "Base User Tree" msgstr "" -#: templates/settings.php:46 +#: templates/settings.php:70 msgid "One User Base DN per line" msgstr "" -#: templates/settings.php:47 +#: templates/settings.php:71 msgid "User Search Attributes" msgstr "" -#: templates/settings.php:47 templates/settings.php:50 +#: templates/settings.php:71 templates/settings.php:74 msgid "Optional; one attribute per line" msgstr "" -#: templates/settings.php:48 +#: templates/settings.php:72 msgid "Group Display Name Field" msgstr "" -#: templates/settings.php:48 +#: templates/settings.php:72 msgid "The LDAP attribute to use to generate the groups`s ownCloud name." msgstr "" -#: templates/settings.php:49 +#: templates/settings.php:73 msgid "Base Group Tree" msgstr "" -#: templates/settings.php:49 +#: templates/settings.php:73 msgid "One Group Base DN per line" msgstr "" -#: templates/settings.php:50 +#: templates/settings.php:74 msgid "Group Search Attributes" msgstr "" -#: templates/settings.php:51 +#: templates/settings.php:75 msgid "Group-Member association" msgstr "" -#: templates/settings.php:53 +#: templates/settings.php:77 msgid "Special Attributes" msgstr "" -#: templates/settings.php:56 +#: templates/settings.php:80 msgid "in bytes" msgstr "בבתים" -#: templates/settings.php:58 +#: templates/settings.php:82 msgid "" "Leave empty for user name (default). Otherwise, specify an LDAP/AD " "attribute." msgstr "" -#: templates/settings.php:62 +#: templates/settings.php:86 msgid "Help" msgstr "עזרה" diff --git a/l10n/my_MM/core.po b/l10n/my_MM/core.po index f681f707da..f7b5644106 100644 --- a/l10n/my_MM/core.po +++ b/l10n/my_MM/core.po @@ -8,8 +8,8 @@ msgid "" msgstr "" "Project-Id-Version: ownCloud\n" "Report-Msgid-Bugs-To: http://bugs.owncloud.org/\n" -"POT-Creation-Date: 2013-02-22 00:06+0100\n" -"PO-Revision-Date: 2013-02-21 11:20+0000\n" +"POT-Creation-Date: 2013-02-25 00:05+0100\n" +"PO-Revision-Date: 2013-02-24 11:20+0000\n" "Last-Translator: Pyae Sone \n" "Language-Team: Burmese (Myanmar) (http://www.transifex.com/projects/p/owncloud/language/my_MM/)\n" "MIME-Version: 1.0\n" @@ -18,24 +18,24 @@ msgstr "" "Language: my_MM\n" "Plural-Forms: nplurals=1; plural=0;\n" -#: ajax/share.php:85 +#: ajax/share.php:97 #, php-format msgid "User %s shared a file with you" msgstr "" -#: ajax/share.php:87 +#: ajax/share.php:99 #, php-format msgid "User %s shared a folder with you" msgstr "" -#: ajax/share.php:89 +#: ajax/share.php:101 #, php-format msgid "" "User %s shared the file \"%s\" with you. It is available for download here: " "%s" msgstr "" -#: ajax/share.php:91 +#: ajax/share.php:104 #, php-format msgid "" "User %s shared the folder \"%s\" with you. It is available for download " @@ -48,7 +48,7 @@ msgstr "" #: ajax/vcategories/add.php:30 msgid "No category to add?" -msgstr "" +msgstr "ထည့်ရန်ခေါင်းစဉ်မရှိဘူးလား" #: ajax/vcategories/add.php:37 #, php-format @@ -74,88 +74,88 @@ msgstr "" #: ajax/vcategories/delete.php:35 js/oc-vcategories.js:136 msgid "No categories selected for deletion." -msgstr "" +msgstr "ဖျက်ရန်အတွက်ခေါင်းစဉ်မရွေးထားပါ" #: ajax/vcategories/removeFromFavorites.php:35 #, php-format msgid "Error removing %s from favorites." msgstr "" -#: js/config.php:32 +#: js/config.php:34 msgid "Sunday" msgstr "" -#: js/config.php:32 +#: js/config.php:35 msgid "Monday" msgstr "" -#: js/config.php:32 +#: js/config.php:36 msgid "Tuesday" msgstr "" -#: js/config.php:32 +#: js/config.php:37 msgid "Wednesday" msgstr "" -#: js/config.php:32 +#: js/config.php:38 msgid "Thursday" msgstr "" -#: js/config.php:32 +#: js/config.php:39 msgid "Friday" msgstr "" -#: js/config.php:32 +#: js/config.php:40 msgid "Saturday" msgstr "" -#: js/config.php:33 +#: js/config.php:45 msgid "January" -msgstr "" +msgstr "ဇန်နဝါရီ" -#: js/config.php:33 +#: js/config.php:46 msgid "February" -msgstr "" +msgstr "ဖေဖော်ဝါရီ" -#: js/config.php:33 +#: js/config.php:47 msgid "March" -msgstr "" +msgstr "မတ်" -#: js/config.php:33 +#: js/config.php:48 msgid "April" -msgstr "" +msgstr "ဧပြီ" -#: js/config.php:33 +#: js/config.php:49 msgid "May" -msgstr "" +msgstr "မေ" -#: js/config.php:33 +#: js/config.php:50 msgid "June" -msgstr "" +msgstr "ဇွန်" -#: js/config.php:33 +#: js/config.php:51 msgid "July" -msgstr "" +msgstr "ဇူလိုင်" -#: js/config.php:33 +#: js/config.php:52 msgid "August" -msgstr "" +msgstr "ဩဂုတ်" -#: js/config.php:33 +#: js/config.php:53 msgid "September" -msgstr "" +msgstr "စက်တင်ဘာ" -#: js/config.php:33 +#: js/config.php:54 msgid "October" -msgstr "" +msgstr "အောက်တိုဘာ" -#: js/config.php:33 +#: js/config.php:55 msgid "November" -msgstr "" +msgstr "နိုဝင်ဘာ" -#: js/config.php:33 +#: js/config.php:56 msgid "December" -msgstr "" +msgstr "ဒီဇင်ဘာ" #: js/js.js:286 msgid "Settings" @@ -215,23 +215,23 @@ msgstr "နှစ် အရင်က" #: js/oc-dialogs.js:126 msgid "Choose" -msgstr "" +msgstr "ရွေးချယ်" #: js/oc-dialogs.js:146 js/oc-dialogs.js:166 msgid "Cancel" -msgstr "" +msgstr "ပယ်ဖျက်မည်" #: js/oc-dialogs.js:162 msgid "No" -msgstr "" +msgstr "မဟုတ်ဘူး" #: js/oc-dialogs.js:163 msgid "Yes" -msgstr "" +msgstr "ဟုတ်" #: js/oc-dialogs.js:180 msgid "Ok" -msgstr "" +msgstr "အိုကေ" #: js/oc-vcategories.js:5 js/oc-vcategories.js:85 js/oc-vcategories.js:102 #: js/oc-vcategories.js:117 js/oc-vcategories.js:132 js/oc-vcategories.js:162 @@ -292,9 +292,9 @@ msgstr "" msgid "Password protect" msgstr "" -#: js/share.js:185 templates/installation.php:44 templates/login.php:35 +#: js/share.js:185 templates/installation.php:46 templates/login.php:35 msgid "Password" -msgstr "" +msgstr "စကားဝှက်" #: js/share.js:189 msgid "Email link to person" @@ -306,15 +306,15 @@ msgstr "" #: js/share.js:194 msgid "Set expiration date" -msgstr "" +msgstr "သက်တမ်းကုန်ဆုံးမည့်ရက်သတ်မှတ်မည်" #: js/share.js:195 msgid "Expiration date" -msgstr "" +msgstr "သက်တမ်းကုန်ဆုံးမည့်ရက်" #: js/share.js:227 msgid "Share via email:" -msgstr "" +msgstr "အီးမေးလ်ဖြင့်ဝေမျှမည် -" #: js/share.js:229 msgid "No people found" @@ -322,7 +322,7 @@ msgstr "" #: js/share.js:256 msgid "Resharing is not allowed" -msgstr "" +msgstr "ပြန်လည်ဝေမျှခြင်းခွင့်မပြုပါ" #: js/share.js:292 msgid "Shared in {item} with {user}" @@ -334,7 +334,7 @@ msgstr "" #: js/share.js:325 msgid "can edit" -msgstr "" +msgstr "ပြင်ဆင်နိုင်" #: js/share.js:327 msgid "access control" @@ -342,7 +342,7 @@ msgstr "" #: js/share.js:330 msgid "create" -msgstr "" +msgstr "ဖန်တီးမည်" #: js/share.js:333 msgid "update" @@ -350,15 +350,15 @@ msgstr "" #: js/share.js:336 msgid "delete" -msgstr "" +msgstr "ဖျက်မည်" #: js/share.js:339 msgid "share" -msgstr "" +msgstr "ဝေမျှမည်" #: js/share.js:373 js/share.js:569 msgid "Password protected" -msgstr "" +msgstr "စကားဝှက်ဖြင့်ကာကွယ်ထားသည်" #: js/share.js:582 msgid "Error unsetting expiration date" @@ -397,7 +397,7 @@ msgstr "" #: lostpassword/templates/lostpassword.php:3 msgid "You will receive a link to reset your password via Email." -msgstr "" +msgstr "အီးမေးလ်မှတစ်ဆင့် သင်၏စကားဝှက်ကို ပြန်ဖော်ရန်အတွက် Link တစ်ခုလက်ခံရရှိပါလိမ့်မယ်။" #: lostpassword/templates/lostpassword.php:5 msgid "Reset email send." @@ -407,10 +407,10 @@ msgstr "" msgid "Request failed!" msgstr "" -#: lostpassword/templates/lostpassword.php:11 templates/installation.php:39 +#: lostpassword/templates/lostpassword.php:11 templates/installation.php:40 #: templates/login.php:28 msgid "Username" -msgstr "" +msgstr "သုံးစွဲသူအမည်" #: lostpassword/templates/lostpassword.php:14 msgid "Request reset" @@ -418,15 +418,15 @@ msgstr "" #: lostpassword/templates/resetpassword.php:4 msgid "Your password was reset" -msgstr "" +msgstr "သင်၏စကားဝှက်ကိုပြန်ဖော်ပြီးပါပြီ။" #: lostpassword/templates/resetpassword.php:5 msgid "To login page" -msgstr "" +msgstr "ဝင်ရောက်သည့်စာမျက်နှာသို့" #: lostpassword/templates/resetpassword.php:8 msgid "New password" -msgstr "" +msgstr "စကားဝှက်အသစ်" #: lostpassword/templates/resetpassword.php:11 msgid "Reset password" @@ -446,7 +446,7 @@ msgstr "Apps" #: strings.php:8 msgid "Admin" -msgstr "" +msgstr "အက်ဒမင်" #: strings.php:9 msgid "Help" @@ -458,7 +458,7 @@ msgstr "" #: templates/404.php:12 msgid "Cloud not found" -msgstr "" +msgstr "မတွေ့ရှိမိပါ" #: templates/edit_categories_dialog.php:4 msgid "Edit categories" @@ -466,11 +466,11 @@ msgstr "" #: templates/edit_categories_dialog.php:16 msgid "Add" -msgstr "" +msgstr "ပေါင်းထည့်" #: templates/installation.php:23 templates/installation.php:30 msgid "Security Warning" -msgstr "" +msgstr "လုံခြုံရေးသတိပေးချက်" #: templates/installation.php:24 msgid "" @@ -499,54 +499,54 @@ msgstr "" #: templates/installation.php:36 msgid "Create an admin account" -msgstr "" - -#: templates/installation.php:52 -msgid "Advanced" -msgstr "" +msgstr "အက်ဒမင်အကောင့်တစ်ခုဖန်တီးမည်" #: templates/installation.php:54 -msgid "Data folder" -msgstr "" +msgid "Advanced" +msgstr "အဆင့်မြင့်" -#: templates/installation.php:61 +#: templates/installation.php:56 +msgid "Data folder" +msgstr "အချက်အလက်ဖိုလ်ဒါလ်" + +#: templates/installation.php:65 msgid "Configure the database" msgstr "" -#: templates/installation.php:66 templates/installation.php:77 -#: templates/installation.php:87 templates/installation.php:97 +#: templates/installation.php:70 templates/installation.php:82 +#: templates/installation.php:93 templates/installation.php:104 msgid "will be used" msgstr "" -#: templates/installation.php:109 -msgid "Database user" -msgstr "" - -#: templates/installation.php:113 -msgid "Database password" -msgstr "" - #: templates/installation.php:117 -msgid "Database name" -msgstr "" +msgid "Database user" +msgstr "Database သုံးစွဲသူ" -#: templates/installation.php:125 +#: templates/installation.php:122 +msgid "Database password" +msgstr "Database စကားဝှက်" + +#: templates/installation.php:127 +msgid "Database name" +msgstr "Database အမည်" + +#: templates/installation.php:137 msgid "Database tablespace" msgstr "" -#: templates/installation.php:131 +#: templates/installation.php:144 msgid "Database host" msgstr "" -#: templates/installation.php:136 +#: templates/installation.php:150 msgid "Finish setup" -msgstr "" +msgstr "တပ်ဆင်ခြင်းပြီးပါပြီ။" -#: templates/layout.guest.php:33 +#: templates/layout.guest.php:35 msgid "web services under your control" -msgstr "" +msgstr "သင်၏ထိန်းချုပ်မှု့အောက်တွင်ရှိသော Web services" -#: templates/layout.user.php:48 +#: templates/layout.user.php:53 msgid "Log out" msgstr "" @@ -566,15 +566,15 @@ msgstr "" #: templates/login.php:19 msgid "Lost your password?" -msgstr "" +msgstr "သင်၏စကားဝှက်ပျောက်သွားပြီလား။" #: templates/login.php:41 msgid "remember" -msgstr "" +msgstr "မှတ်မိစေသည်" #: templates/login.php:43 msgid "Log in" -msgstr "" +msgstr "ဝင်ရောက်ရန်" #: templates/login.php:49 msgid "Alternative Logins" @@ -582,11 +582,11 @@ msgstr "" #: templates/part.pagenavi.php:3 msgid "prev" -msgstr "" +msgstr "ယခင်" #: templates/part.pagenavi.php:20 msgid "next" -msgstr "" +msgstr "နောက်သို့" #: templates/update.php:3 #, php-format diff --git a/l10n/my_MM/files_sharing.po b/l10n/my_MM/files_sharing.po index 2886a4d02b..6c66538b0e 100644 --- a/l10n/my_MM/files_sharing.po +++ b/l10n/my_MM/files_sharing.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: ownCloud\n" "Report-Msgid-Bugs-To: http://bugs.owncloud.org/\n" -"POT-Creation-Date: 2013-02-21 00:14+0100\n" +"POT-Creation-Date: 2013-02-25 00:05+0100\n" "PO-Revision-Date: 2012-08-12 22:35+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: Burmese (Myanmar) (http://www.transifex.com/projects/p/owncloud/language/my_MM/)\n" @@ -19,30 +19,30 @@ msgstr "" #: templates/authenticate.php:4 msgid "Password" -msgstr "" +msgstr "စကားဝှက်" #: templates/authenticate.php:6 msgid "Submit" msgstr "" -#: templates/public.php:9 +#: templates/public.php:10 #, php-format msgid "%s shared the folder %s with you" msgstr "" -#: templates/public.php:11 +#: templates/public.php:13 #, php-format msgid "%s shared the file %s with you" msgstr "" -#: templates/public.php:14 templates/public.php:30 +#: templates/public.php:19 templates/public.php:37 msgid "Download" msgstr "" -#: templates/public.php:29 +#: templates/public.php:34 msgid "No preview available for" msgstr "" -#: templates/public.php:35 +#: templates/public.php:43 msgid "web services under your control" -msgstr "" +msgstr "သင်၏ထိန်းချုပ်မှု့အောက်တွင်ရှိသော Web services" diff --git a/l10n/my_MM/lib.po b/l10n/my_MM/lib.po index 436088e71e..b2c72b85c5 100644 --- a/l10n/my_MM/lib.po +++ b/l10n/my_MM/lib.po @@ -8,8 +8,8 @@ msgid "" msgstr "" "Project-Id-Version: ownCloud\n" "Report-Msgid-Bugs-To: http://bugs.owncloud.org/\n" -"POT-Creation-Date: 2013-02-22 00:06+0100\n" -"PO-Revision-Date: 2013-02-21 11:20+0000\n" +"POT-Creation-Date: 2013-02-25 00:05+0100\n" +"PO-Revision-Date: 2013-02-24 08:40+0000\n" "Last-Translator: Pyae Sone \n" "Language-Team: Burmese (Myanmar) (http://www.transifex.com/projects/p/owncloud/language/my_MM/)\n" "MIME-Version: 1.0\n" @@ -40,7 +40,7 @@ msgstr "Apps" #: app.php:406 msgid "Admin" -msgstr "" +msgstr "အက်ဒမင်" #: files.php:202 msgid "ZIP download is turned off." @@ -178,7 +178,7 @@ msgid "" "because the WebDAV interface seems to be broken." msgstr "" -#: setup.php:651 +#: setup.php:650 #, php-format msgid "Please double check the installation guides." msgstr "" diff --git a/l10n/my_MM/settings.po b/l10n/my_MM/settings.po index ce5041c02e..bb7c8afa2d 100644 --- a/l10n/my_MM/settings.po +++ b/l10n/my_MM/settings.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: ownCloud\n" "Report-Msgid-Bugs-To: http://bugs.owncloud.org/\n" -"POT-Creation-Date: 2013-02-22 00:06+0100\n" +"POT-Creation-Date: 2013-02-25 00:05+0100\n" "PO-Revision-Date: 2011-07-25 16:05+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: Burmese (Myanmar) (http://www.transifex.com/projects/p/owncloud/language/my_MM/)\n" @@ -21,8 +21,8 @@ msgstr "" msgid "Unable to load list from App Store" msgstr "" -#: ajax/changedisplayname.php:23 ajax/removeuser.php:15 ajax/setquota.php:15 -#: ajax/togglegroups.php:18 +#: ajax/changedisplayname.php:23 ajax/removeuser.php:15 ajax/setquota.php:17 +#: ajax/togglegroups.php:20 msgid "Authentication error" msgstr "ခွင့်ပြုချက်မအောင်မြင်" @@ -70,12 +70,12 @@ msgstr "" msgid "Admins can't remove themself from the admin group" msgstr "" -#: ajax/togglegroups.php:28 +#: ajax/togglegroups.php:30 #, php-format msgid "Unable to add user to group %s" msgstr "" -#: ajax/togglegroups.php:34 +#: ajax/togglegroups.php:36 #, php-format msgid "Unable to remove user from group %s" msgstr "" @@ -167,7 +167,7 @@ msgstr "" #: templates/admin.php:15 msgid "Security Warning" -msgstr "" +msgstr "လုံခြုံရေးသတိပေးချက်" #: templates/admin.php:18 msgid "" @@ -316,11 +316,11 @@ msgstr "" msgid "More" msgstr "" -#: templates/admin.php:227 templates/personal.php:98 +#: templates/admin.php:227 templates/personal.php:102 msgid "Version" msgstr "" -#: templates/admin.php:230 templates/personal.php:100 +#: templates/admin.php:230 templates/personal.php:105 msgid "" "Developed by the ownCloud community, the AGPL." msgstr "" -#: templates/apps.php:10 +#: templates/apps.php:11 msgid "Add your App" msgstr "" -#: templates/apps.php:11 +#: templates/apps.php:12 msgid "More Apps" msgstr "" -#: templates/apps.php:24 +#: templates/apps.php:28 msgid "Select an App" msgstr "" -#: templates/apps.php:28 +#: templates/apps.php:34 msgid "See application page at apps.owncloud.com" msgstr "" -#: templates/apps.php:29 +#: templates/apps.php:36 msgid "-licensed by " msgstr "" -#: templates/apps.php:31 +#: templates/apps.php:38 msgid "Update" msgstr "" -#: templates/help.php:3 +#: templates/help.php:4 msgid "User Documentation" msgstr "" -#: templates/help.php:4 +#: templates/help.php:6 msgid "Administrator Documentation" msgstr "" -#: templates/help.php:6 +#: templates/help.php:9 msgid "Online Documentation" msgstr "" -#: templates/help.php:7 +#: templates/help.php:11 msgid "Forum" msgstr "" -#: templates/help.php:9 +#: templates/help.php:14 msgid "Bugtracker" msgstr "" -#: templates/help.php:11 +#: templates/help.php:17 msgid "Commercial Support" msgstr "" @@ -383,79 +383,79 @@ msgstr "" msgid "You have used %s of the available %s" msgstr "" -#: templates/personal.php:14 +#: templates/personal.php:15 msgid "Get the apps to sync your files" msgstr "" -#: templates/personal.php:25 +#: templates/personal.php:26 msgid "Show First Run Wizard again" msgstr "" -#: templates/personal.php:36 templates/users.php:23 templates/users.php:79 +#: templates/personal.php:37 templates/users.php:23 templates/users.php:79 msgid "Password" -msgstr "" +msgstr "စကားဝှက်" -#: templates/personal.php:37 +#: templates/personal.php:38 msgid "Your password was changed" msgstr "" -#: templates/personal.php:38 +#: templates/personal.php:39 msgid "Unable to change your password" msgstr "" -#: templates/personal.php:39 +#: templates/personal.php:40 msgid "Current password" msgstr "" -#: templates/personal.php:40 -msgid "New password" -msgstr "" - #: templates/personal.php:42 +msgid "New password" +msgstr "စကားဝှက်အသစ်" + +#: templates/personal.php:44 msgid "Change password" msgstr "" -#: templates/personal.php:54 templates/users.php:78 +#: templates/personal.php:56 templates/users.php:78 msgid "Display Name" msgstr "" -#: templates/personal.php:55 +#: templates/personal.php:57 msgid "Your display name was changed" msgstr "" -#: templates/personal.php:56 +#: templates/personal.php:58 msgid "Unable to change your display name" msgstr "" -#: templates/personal.php:59 +#: templates/personal.php:61 msgid "Change display name" msgstr "" -#: templates/personal.php:68 +#: templates/personal.php:70 msgid "Email" msgstr "" -#: templates/personal.php:69 +#: templates/personal.php:72 msgid "Your email address" msgstr "" -#: templates/personal.php:70 +#: templates/personal.php:73 msgid "Fill in an email address to enable password recovery" msgstr "" -#: templates/personal.php:76 templates/personal.php:77 +#: templates/personal.php:79 templates/personal.php:80 msgid "Language" msgstr "" -#: templates/personal.php:82 +#: templates/personal.php:86 msgid "Help translate" msgstr "" -#: templates/personal.php:87 +#: templates/personal.php:91 msgid "WebDAV" msgstr "" -#: templates/personal.php:89 +#: templates/personal.php:93 msgid "Use this address to connect to your ownCloud in your file manager" msgstr "" diff --git a/l10n/my_MM/user_ldap.po b/l10n/my_MM/user_ldap.po index e990717a5f..918b95dbf3 100644 --- a/l10n/my_MM/user_ldap.po +++ b/l10n/my_MM/user_ldap.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: ownCloud\n" "Report-Msgid-Bugs-To: http://bugs.owncloud.org/\n" -"POT-Creation-Date: 2013-02-22 00:06+0100\n" +"POT-Creation-Date: 2013-02-25 00:05+0100\n" "PO-Revision-Date: 2012-08-12 22:45+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: Burmese (Myanmar) (http://www.transifex.com/projects/p/owncloud/language/my_MM/)\n" @@ -124,7 +124,7 @@ msgstr "" #: templates/settings.php:33 msgid "Password" -msgstr "" +msgstr "စကားဝှက်" #: templates/settings.php:36 msgid "For anonymous access, leave DN and Password empty." diff --git a/l10n/templates/core.pot b/l10n/templates/core.pot index cecc39cb73..2a8f0615ac 100644 --- a/l10n/templates/core.pot +++ b/l10n/templates/core.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: ownCloud Core 5.0.0\n" "Report-Msgid-Bugs-To: translations@owncloud.org\n" -"POT-Creation-Date: 2013-02-24 00:06+0100\n" +"POT-Creation-Date: 2013-02-25 00:05+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/l10n/templates/files.pot b/l10n/templates/files.pot index 47515fcf17..fc6f66258f 100644 --- a/l10n/templates/files.pot +++ b/l10n/templates/files.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: ownCloud Core 5.0.0\n" "Report-Msgid-Bugs-To: translations@owncloud.org\n" -"POT-Creation-Date: 2013-02-24 00:05+0100\n" +"POT-Creation-Date: 2013-02-25 00:05+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/l10n/templates/files_encryption.pot b/l10n/templates/files_encryption.pot index 473f5d0f60..eecfc2b566 100644 --- a/l10n/templates/files_encryption.pot +++ b/l10n/templates/files_encryption.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: ownCloud Core 5.0.0\n" "Report-Msgid-Bugs-To: translations@owncloud.org\n" -"POT-Creation-Date: 2013-02-24 00:05+0100\n" +"POT-Creation-Date: 2013-02-25 00:05+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/l10n/templates/files_external.pot b/l10n/templates/files_external.pot index 950996cb1d..45d9ce016f 100644 --- a/l10n/templates/files_external.pot +++ b/l10n/templates/files_external.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: ownCloud Core 5.0.0\n" "Report-Msgid-Bugs-To: translations@owncloud.org\n" -"POT-Creation-Date: 2013-02-24 00:05+0100\n" +"POT-Creation-Date: 2013-02-25 00:05+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/l10n/templates/files_sharing.pot b/l10n/templates/files_sharing.pot index 56f2cef992..3dd2659404 100644 --- a/l10n/templates/files_sharing.pot +++ b/l10n/templates/files_sharing.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: ownCloud Core 5.0.0\n" "Report-Msgid-Bugs-To: translations@owncloud.org\n" -"POT-Creation-Date: 2013-02-24 00:05+0100\n" +"POT-Creation-Date: 2013-02-25 00:05+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/l10n/templates/files_trashbin.pot b/l10n/templates/files_trashbin.pot index 7e19dd1d50..c0d9911e2a 100644 --- a/l10n/templates/files_trashbin.pot +++ b/l10n/templates/files_trashbin.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: ownCloud Core 5.0.0\n" "Report-Msgid-Bugs-To: translations@owncloud.org\n" -"POT-Creation-Date: 2013-02-24 00:05+0100\n" +"POT-Creation-Date: 2013-02-25 00:05+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/l10n/templates/files_versions.pot b/l10n/templates/files_versions.pot index 3f528d866d..2854191572 100644 --- a/l10n/templates/files_versions.pot +++ b/l10n/templates/files_versions.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: ownCloud Core 5.0.0\n" "Report-Msgid-Bugs-To: translations@owncloud.org\n" -"POT-Creation-Date: 2013-02-24 00:05+0100\n" +"POT-Creation-Date: 2013-02-25 00:05+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/l10n/templates/lib.pot b/l10n/templates/lib.pot index 521c5013b5..854f33470c 100644 --- a/l10n/templates/lib.pot +++ b/l10n/templates/lib.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: ownCloud Core 5.0.0\n" "Report-Msgid-Bugs-To: translations@owncloud.org\n" -"POT-Creation-Date: 2013-02-24 00:06+0100\n" +"POT-Creation-Date: 2013-02-25 00:05+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/l10n/templates/settings.pot b/l10n/templates/settings.pot index 04c6396995..c6fe848769 100644 --- a/l10n/templates/settings.pot +++ b/l10n/templates/settings.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: ownCloud Core 5.0.0\n" "Report-Msgid-Bugs-To: translations@owncloud.org\n" -"POT-Creation-Date: 2013-02-24 00:06+0100\n" +"POT-Creation-Date: 2013-02-25 00:05+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/l10n/templates/user_ldap.pot b/l10n/templates/user_ldap.pot index 396d0c8eae..d4c1c33115 100644 --- a/l10n/templates/user_ldap.pot +++ b/l10n/templates/user_ldap.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: ownCloud Core 5.0.0\n" "Report-Msgid-Bugs-To: translations@owncloud.org\n" -"POT-Creation-Date: 2013-02-24 00:05+0100\n" +"POT-Creation-Date: 2013-02-25 00:05+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/l10n/templates/user_webdavauth.pot b/l10n/templates/user_webdavauth.pot index f76cd4d18f..496d3c2f46 100644 --- a/l10n/templates/user_webdavauth.pot +++ b/l10n/templates/user_webdavauth.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: ownCloud Core 5.0.0\n" "Report-Msgid-Bugs-To: translations@owncloud.org\n" -"POT-Creation-Date: 2013-02-24 00:05+0100\n" +"POT-Creation-Date: 2013-02-25 00:05+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/lib/l10n/my_MM.php b/lib/l10n/my_MM.php index cee6f65d22..d725a06a3a 100644 --- a/lib/l10n/my_MM.php +++ b/lib/l10n/my_MM.php @@ -2,6 +2,7 @@ "Help" => "အကူအညီ", "Users" => "သုံးစွဲသူ", "Apps" => "Apps", +"Admin" => "အက်ဒမင်", "ZIP download is turned off." => "ZIP ဒေါင်းလုတ်ကိုပိတ်ထားသည်", "Files need to be downloaded one by one." => "ဖိုင်များသည် တစ်ခုပြီး တစ်ခုဒေါင်းလုတ်ချရန်လိုအပ်သည်", "Back to Files" => "ဖိုင်သို့ပြန်သွားမည်", diff --git a/settings/l10n/he.php b/settings/l10n/he.php index 20e97b3ffd..196dc4d146 100644 --- a/settings/l10n/he.php +++ b/settings/l10n/he.php @@ -39,6 +39,7 @@ "Forum" => "פורום", "Commercial Support" => "תמיכה בתשלום", "You have used %s of the available %s" => "השתמשת ב־%s מתוך %s הזמינים לך", +"Get the apps to sync your files" => "השג את האפליקציות על מנת לסנכרן את הקבצים שלך", "Password" => "ססמה", "Your password was changed" => "הססמה שלך הוחלפה", "Unable to change your password" => "לא ניתן לשנות את הססמה שלך", diff --git a/settings/l10n/my_MM.php b/settings/l10n/my_MM.php index de234d9643..a332c4d8ce 100644 --- a/settings/l10n/my_MM.php +++ b/settings/l10n/my_MM.php @@ -1,3 +1,6 @@ "ခွင့်ပြုချက်မအောင်မြင်" +"Authentication error" => "ခွင့်ပြုချက်မအောင်မြင်", +"Security Warning" => "လုံခြုံရေးသတိပေးချက်", +"Password" => "စကားဝှက်", +"New password" => "စကားဝှက်အသစ်" ); From ebcb778a99e11c4c0f13ccd6bcdf11c2a0c21bc8 Mon Sep 17 00:00:00 2001 From: Thomas Mueller Date: Mon, 25 Feb 2013 10:12:47 +0100 Subject: [PATCH 36/54] remove the check for session data folder - causes trouble on some environments let's try to find another solution for =C6 --- lib/util.php | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/lib/util.php b/lib/util.php index 87facda180..dd56e0308a 100755 --- a/lib/util.php +++ b/lib/util.php @@ -275,19 +275,6 @@ class OC_Util { $web_server_restart= false; } - $handler = ini_get("session.save_handler"); - if($handler == "files") { - $tmpDir = session_save_path(); - if($tmpDir != "") { - if(!@is_writable($tmpDir)) { - $errors[]=array('error' => 'The temporary folder used by PHP to save the session data' - .' is either incorrect or not writable! Please check : '.session_save_path().'
    ', - 'hint'=>'Please ask your server administrator to grant write access' - .' or define another temporary folder.'); - } - } - } - if($web_server_restart) { $errors[]=array('error'=>'PHP modules have been installed, but they are still listed as missing?
    ', 'hint'=>'Please ask your server administrator to restart the web server.'); From 736d5deaeec3a7238af7bfd420c7122b321a277a Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Mon, 25 Feb 2013 11:39:32 +0100 Subject: [PATCH 37/54] version checks for apps now use all three version numbers and fixed bug that would not do the version check correctly for the second version --- lib/app.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/app.php b/lib/app.php index e653c30b2d..a5618be84f 100644 --- a/lib/app.php +++ b/lib/app.php @@ -223,7 +223,8 @@ class OC_App{ // check if the app is compatible with this version of ownCloud $info=OC_App::getAppInfo($app); $version=OC_Util::getVersion(); - if(!isset($info['require']) or ($version[0]>$info['require'])) { + $fullVersion = (float) ($version[0] . '.' . $version[1] . $version[2]); + if(!isset($info['require']) or ($fullVersion < (float) $info['require'])) { OC_Log::write('core', 'App "'.$info['name'].'" can\'t be installed because it is' .' not compatible with this version of ownCloud', @@ -851,7 +852,8 @@ class OC_App{ foreach($apps as $app) { // check if the app is compatible with this version of ownCloud $info = OC_App::getAppInfo($app); - if(!isset($info['require']) or (($version[0].'.'.$version[1])>$info['require'])) { + $fullVersion = (float) ($version[0] . '.' . $version[1] . $version[2]); + if(!isset($info['require']) or ($fullVersion < (float) $info['require'])) { OC_Log::write('core', 'App "'.$info['name'].'" ('.$app.') can\'t be used because it is' .' not compatible with this version of ownCloud', From ecd40f0abc8328692df44a2b082fb2ba5dcfbbd2 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Mon, 25 Feb 2013 11:40:55 +0100 Subject: [PATCH 38/54] spaces to tabs --- lib/app.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/app.php b/lib/app.php index a5618be84f..91bb833b0d 100644 --- a/lib/app.php +++ b/lib/app.php @@ -223,8 +223,8 @@ class OC_App{ // check if the app is compatible with this version of ownCloud $info=OC_App::getAppInfo($app); $version=OC_Util::getVersion(); - $fullVersion = (float) ($version[0] . '.' . $version[1] . $version[2]); - if(!isset($info['require']) or ($fullVersion < (float) $info['require'])) { + $fullVersion = (float) ($version[0] . '.' . $version[1] . $version[2]); + if(!isset($info['require']) or ($fullVersion < (float) $info['require'])) { OC_Log::write('core', 'App "'.$info['name'].'" can\'t be installed because it is' .' not compatible with this version of ownCloud', @@ -852,8 +852,8 @@ class OC_App{ foreach($apps as $app) { // check if the app is compatible with this version of ownCloud $info = OC_App::getAppInfo($app); - $fullVersion = (float) ($version[0] . '.' . $version[1] . $version[2]); - if(!isset($info['require']) or ($fullVersion < (float) $info['require'])) { + $fullVersion = (float) ($version[0] . '.' . $version[1] . $version[2]); + if(!isset($info['require']) or ($fullVersion < (float) $info['require'])) { OC_Log::write('core', 'App "'.$info['name'].'" ('.$app.') can\'t be used because it is' .' not compatible with this version of ownCloud', From 5bf3d286f02474c99dd52b2680594c9ed272f92a Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Mon, 25 Feb 2013 12:38:00 +0100 Subject: [PATCH 39/54] created unittests and factored out version test into seperate method --- lib/app.php | 36 ++++++++++++++++++++++++++++---- tests/lib/app.php | 52 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+), 4 deletions(-) create mode 100644 tests/lib/app.php diff --git a/lib/app.php b/lib/app.php index 91bb833b0d..2eb43a582e 100644 --- a/lib/app.php +++ b/lib/app.php @@ -223,8 +223,7 @@ class OC_App{ // check if the app is compatible with this version of ownCloud $info=OC_App::getAppInfo($app); $version=OC_Util::getVersion(); - $fullVersion = (float) ($version[0] . '.' . $version[1] . $version[2]); - if(!isset($info['require']) or ($fullVersion < (float) $info['require'])) { + if(!isset($info['require']) or !self::isAppVersionCompatible($version, $info['require'])) { OC_Log::write('core', 'App "'.$info['name'].'" can\'t be installed because it is' .' not compatible with this version of ownCloud', @@ -852,8 +851,7 @@ class OC_App{ foreach($apps as $app) { // check if the app is compatible with this version of ownCloud $info = OC_App::getAppInfo($app); - $fullVersion = (float) ($version[0] . '.' . $version[1] . $version[2]); - if(!isset($info['require']) or ($fullVersion < (float) $info['require'])) { + if(!isset($info['require']) or !self::isAppVersionCompatible($version, $info['require'])) { OC_Log::write('core', 'App "'.$info['name'].'" ('.$app.') can\'t be used because it is' .' not compatible with this version of ownCloud', @@ -864,6 +862,36 @@ class OC_App{ } } + + /** + * Compares the app version with the owncloud version to see if the app + * requires a newer version than the currently active one + * @param array $owncloudVersions array with 3 entries: major minor bugfix + * @param string $appRequired the required version from the xml + * major.minor.bugfix + * @return boolean true if compatible, otherwise false + */ + public static function isAppVersionCompatible($owncloudVersions, $appRequired){ + $appVersions = explode('.', $appRequired); + + for($i=0; $i + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ + +class Test_App extends PHPUnit_Framework_TestCase { + + + public function testIsAppVersionCompatibleSingleOCNumber(){ + $oc = array(4); + $app = '4.0'; + + $this->assertTrue(OC_App::isAppVersionCompatible($oc, $app)); + } + + + public function testIsAppVersionCompatibleMultipleOCNumber(){ + $oc = array(4, 3, 1); + $app = '4.3'; + + $this->assertTrue(OC_App::isAppVersionCompatible($oc, $app)); + } + + + public function testIsAppVersionCompatibleMultipleAppNumber(){ + $oc = array(4); + $app = '4'; + + $this->assertTrue(OC_App::isAppVersionCompatible($oc, $app)); + } + + + public function testIsAppVersionCompatibleSingleAppNumber(){ + $oc = array(4, 3); + $app = '4'; + + $this->assertTrue(OC_App::isAppVersionCompatible($oc, $app)); + } + + + public function testIsAppVersionCompatibleShouldFail(){ + $oc = array(4, 3, 1); + $app = '4.3.2'; + + $this->assertFalse(OC_App::isAppVersionCompatible($oc, $app)); + } + + +} \ No newline at end of file From 8068051ca42395db7386db3f8993276ad1b1007b Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Mon, 25 Feb 2013 12:47:34 +0100 Subject: [PATCH 40/54] more tests to fail the version check --- tests/lib/app.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tests/lib/app.php b/tests/lib/app.php index 2bcc34d332..9cab36903a 100644 --- a/tests/lib/app.php +++ b/tests/lib/app.php @@ -25,7 +25,7 @@ class Test_App extends PHPUnit_Framework_TestCase { } - public function testIsAppVersionCompatibleMultipleAppNumber(){ + public function testIsAppVersionCompatibleSingleNumber(){ $oc = array(4); $app = '4'; @@ -48,5 +48,19 @@ class Test_App extends PHPUnit_Framework_TestCase { $this->assertFalse(OC_App::isAppVersionCompatible($oc, $app)); } + public function testIsAppVersionCompatibleShouldFailTwoVersionNumbers(){ + $oc = array(4, 3, 1); + $app = '4.4'; + + $this->assertFalse(OC_App::isAppVersionCompatible($oc, $app)); + } + + + public function testIsAppVersionCompatibleShouldFailOneVersionNumbers(){ + $oc = array(4, 3, 1); + $app = '5'; + + $this->assertFalse(OC_App::isAppVersionCompatible($oc, $app)); + } } \ No newline at end of file From 7ebbecd81f433bfdd3353d7be26cb462af423eb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Schie=C3=9Fle?= Date: Mon, 25 Feb 2013 14:09:20 +0100 Subject: [PATCH 41/54] always use "===" --- apps/files_trashbin/lib/trash.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/files_trashbin/lib/trash.php b/apps/files_trashbin/lib/trash.php index 83fc424834..d4ab5ee7db 100644 --- a/apps/files_trashbin/lib/trash.php +++ b/apps/files_trashbin/lib/trash.php @@ -102,10 +102,10 @@ class Trashbin { // get available disk space for user $quota = \OCP\Util::computerFileSize(\OC_Preferences::getValue($user, 'files', 'quota')); - if ( $quota == null ) { + if ( $quota === null ) { $quota = \OCP\Util::computerFileSize(\OC_Appconfig::getValue('files', 'default_quota')); } - if ( $quota == null ) { + if ( $quota === null ) { $quota = \OC\Files\Filesystem::free_space('/'); } @@ -181,7 +181,7 @@ class Trashbin { } else { $versionedFile = $file; } - if ( $result[0]['type'] == 'dir' ) { + if ( $result[0]['type'] === 'dir' ) { $trashbinSize -= self::calculateSize(new \OC_FilesystemView('/'.$user.'/'.'files_trashbin/versions/'. $file)); $view->rename(\OC_Filesystem::normalizePath('files_trashbin/versions/'. $file), \OC_Filesystem::normalizePath('files_versions/'.$location.'/'.$filename.$ext)); } else if ( $versions = self::getVersionsFromTrash($versionedFile, $timestamp) ) { @@ -199,7 +199,7 @@ class Trashbin { // Take care of encryption keys TODO! Get '.key' in file between file name and delete date (also for permanent delete!) $parts = pathinfo($file); - if ( $result[0]['type'] == 'dir' ) { + if ( $result[0]['type'] === 'dir' ) { $keyfile = \OC_Filesystem::normalizePath('files_trashbin/keyfiles/'.$parts['dirname'].'/'.$filename); } else { $keyfile = \OC_Filesystem::normalizePath('files_trashbin/keyfiles/'.$parts['dirname'].'/'.$filename.'.key'); @@ -208,7 +208,7 @@ class Trashbin { $keyfile .= '.d'.$timestamp; } if ( \OCP\App::isEnabled('files_encryption') && $view->file_exists($keyfile) ) { - if ( $result[0]['type'] == 'dir' ) { + if ( $result[0]['type'] === 'dir' ) { $trashbinSize -= self::calculateSize(new \OC_FilesystemView('/'.$user.'/'.$keyfile)); $view->rename($keyfile, 'files_encryption/keyfiles/'. $location.'/'.$filename); } else { From 7da97550df61e7a82463b91139e8f18923765bc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Schie=C3=9Fle?= Date: Mon, 25 Feb 2013 14:12:56 +0100 Subject: [PATCH 42/54] some final code clean-up --- apps/files_trashbin/lib/trash.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/apps/files_trashbin/lib/trash.php b/apps/files_trashbin/lib/trash.php index d4ab5ee7db..5963f9a1b7 100644 --- a/apps/files_trashbin/lib/trash.php +++ b/apps/files_trashbin/lib/trash.php @@ -56,8 +56,9 @@ class Trashbin { } else { $type = 'file'; } - - if ( ($trashbinSize = \OCP\Config::getAppValue('files_trashbin', 'size')) === null ) { + + $trashbinSize = \OCP\Config::getAppValue('files_trashbin', 'size'); + if ( $trashbinSize === null ) { $trashbinSize = self::calculateSize(new \OC_FilesystemView('/'. $user.'/files_trashbin')); } $trashbinSize += self::copy_recursive($file_path, 'files_trashbin/files/'.$deleted.'.d'.$timestamp, $view); @@ -133,7 +134,8 @@ class Trashbin { $user = \OCP\User::getUser(); $view = new \OC_FilesystemView('/'.$user); - if ( ($trashbinSize = \OCP\Config::getAppValue('files_trashbin', 'size')) === null ) { + $trashbinSize = \OCP\Config::getAppValue('files_trashbin', 'size'); + if ( $trashbinSize === null ) { $trashbinSize = self::calculateSize(new \OC_FilesystemView('/'. $user.'/files_trashbin')); } if ( $timestamp ) { @@ -242,7 +244,8 @@ class Trashbin { $view = new \OC_FilesystemView('/'.$user); $size = 0; - if ( ($trashbinSize = \OCP\Config::getAppValue('files_trashbin', 'size')) === null ) { + $trashbinSize = \OCP\Config::getAppValue('files_trashbin', 'size'); + if ( $trashbinSize === null ) { $trashbinSize = self::calculateSize(new \OC_FilesystemView('/'. $user.'/files_trashbin')); } From e30b3f64e09acfd813f13d1c54872e484ec03382 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Schie=C3=9Fle?= Date: Mon, 25 Feb 2013 14:29:31 +0100 Subject: [PATCH 43/54] fix line endings --- apps/files_trashbin/lib/trash.php | 188 +++++++++++++++--------------- 1 file changed, 94 insertions(+), 94 deletions(-) diff --git a/apps/files_trashbin/lib/trash.php b/apps/files_trashbin/lib/trash.php index 032df86a61..8f745f8203 100644 --- a/apps/files_trashbin/lib/trash.php +++ b/apps/files_trashbin/lib/trash.php @@ -36,77 +36,77 @@ class Trashbin { */ public static function move2trash($file_path) { $user = \OCP\User::getUser(); - $view = new \OC\Files\View('/'. $user); - if (!$view->is_dir('files_trashbin')) { - $view->mkdir('files_trashbin'); + $view = new \OC\Files\View('/'. $user); + if (!$view->is_dir('files_trashbin')) { + $view->mkdir('files_trashbin'); $view->mkdir("files_trashbin/files"); $view->mkdir("files_trashbin/versions"); - $view->mkdir("files_trashbin/keyfiles"); - } - - $path_parts = pathinfo($file_path); - - $deleted = $path_parts['basename']; - $location = $path_parts['dirname']; - $timestamp = time(); - $mime = $view->getMimeType('files'.$file_path); - - if ( $view->is_dir('files'.$file_path) ) { - $type = 'dir'; - } else { - $type = 'file'; + $view->mkdir("files_trashbin/keyfiles"); + } + + $path_parts = pathinfo($file_path); + + $deleted = $path_parts['basename']; + $location = $path_parts['dirname']; + $timestamp = time(); + $mime = $view->getMimeType('files'.$file_path); + + if ( $view->is_dir('files'.$file_path) ) { + $type = 'dir'; + } else { + $type = 'file'; } - $trashbinSize = self::getTrashbinSize($user); + $trashbinSize = self::getTrashbinSize($user); if ( $trashbinSize === false || $trashbinSize < 0 ) { $trashbinSize = self::calculateSize(new \OC_FilesystemView('/'. $user.'/files_trashbin')); } $trashbinSize += self::copy_recursive($file_path, 'files_trashbin/files/'.$deleted.'.d'.$timestamp, $view); - if ( $view->file_exists('files_trashbin/files/'.$deleted.'.d'.$timestamp) ) { + if ( $view->file_exists('files_trashbin/files/'.$deleted.'.d'.$timestamp) ) { $query = \OC_DB::prepare("INSERT INTO *PREFIX*files_trash (id,timestamp,location,type,mime,user) VALUES (?,?,?,?,?,?)"); $result = $query->execute(array($deleted, $timestamp, $location, $type, $mime, $user)); if ( !$result ) { // if file couldn't be added to the database than also don't store it in the trash bin. $view->deleteAll('files_trashbin/files/'.$deleted.'.d'.$timestamp); \OC_Log::write('files_trashbin', 'trash bin database couldn\'t be updated', \OC_log::ERROR); return; - } + } - // Take care of file versions - if ( \OCP\App::isEnabled('files_versions') ) { + // Take care of file versions + if ( \OCP\App::isEnabled('files_versions') ) { if ( $view->is_dir('files_versions'.$file_path) ) { - $trashbinSize += self::calculateSize(new \OC_FilesystemView('/'. $user.'/files_versions/'.$file_path)); - $view->rename('files_versions'.$file_path, 'files_trashbin/versions'. $deleted.'.d'.$timestamp); - } else if ( $versions = \OCA\Files_Versions\Storage::getVersions($file_path) ) { + $trashbinSize += self::calculateSize(new \OC_FilesystemView('/'. $user.'/files_versions/'.$file_path)); + $view->rename('files_versions'.$file_path, 'files_trashbin/versions'. $deleted.'.d'.$timestamp); + } else if ( $versions = \OCA\Files_Versions\Storage::getVersions($file_path) ) { foreach ($versions as $v) { - $trashbinSize += $view->filesize('files_versions'.$v['path'].'.v'.$v['version']); - $view->rename('files_versions'.$v['path'].'.v'.$v['version'], 'files_trashbin/versions'. $deleted.'.v'.$v['version'].'.d'.$timestamp); - } + $trashbinSize += $view->filesize('files_versions'.$v['path'].'.v'.$v['version']); + $view->rename('files_versions'.$v['path'].'.v'.$v['version'], 'files_trashbin/versions'. $deleted.'.v'.$v['version'].'.d'.$timestamp); + } } } // Take care of encryption keys - $keyfile = \OC_Filesystem::normalizePath('files_encryption/keyfiles/'.$file_path); + $keyfile = \OC_Filesystem::normalizePath('files_encryption/keyfiles/'.$file_path); if ( \OCP\App::isEnabled('files_encryption') && $view->file_exists($keyfile.'.key') ) { if ( $view->is_dir('files'.$file_path) ) { $trashbinSize += self::calculateSize(new \OC_FilesystemView('/'.$user.'/'.$keyfile)); $view->rename($keyfile, 'files_trashbin/keyfiles/'. $deleted.'.d'.$timestamp); - } else { + } else { $trashbinSize += $view->filesize($keyfile.'.key'); $view->rename($keyfile.'.key', 'files_trashbin/keyfiles/'. $deleted.'.key.d'.$timestamp); - } + } } } else { \OC_Log::write('files_trashbin', 'Couldn\'t move '.$file_path.' to the trash bin', \OC_log::ERROR); } - // get available disk space for user - $quota = \OCP\Util::computerFileSize(\OC_Preferences::getValue($user, 'files', 'quota')); - if ( $quota === null ) { - $quota = \OCP\Util::computerFileSize(\OC_Appconfig::getValue('files', 'default_quota')); - } - if ( $quota === null ) { + // get available disk space for user + $quota = \OCP\Util::computerFileSize(\OC_Preferences::getValue($user, 'files', 'quota')); + if ( $quota === null ) { + $quota = \OCP\Util::computerFileSize(\OC_Appconfig::getValue('files', 'default_quota')); + } + if ( $quota === null ) { $quota = \OC\Files\Filesystem::free_space('/') / count(\OCP\User::getUsers()); } @@ -121,7 +121,7 @@ class Trashbin { $trashbinSize -= self::expire($availableSpace); - self::setTrashbinSize($user, $trashbinSize); + self::setTrashbinSize($user, $trashbinSize); } @@ -186,9 +186,9 @@ class Trashbin { $versionedFile = $file; } if ( $result[0]['type'] === 'dir' ) { - $trashbinSize -= self::calculateSize(new \OC_FilesystemView('/'.$user.'/'.'files_trashbin/versions/'. $file)); - $view->rename(\OC_Filesystem::normalizePath('files_trashbin/versions/'. $file), \OC_Filesystem::normalizePath('files_versions/'.$location.'/'.$filename.$ext)); - } else if ( $versions = self::getVersionsFromTrash($versionedFile, $timestamp) ) { + $trashbinSize -= self::calculateSize(new \OC_FilesystemView('/'.$user.'/'.'files_trashbin/versions/'. $file)); + $view->rename(\OC_Filesystem::normalizePath('files_trashbin/versions/'. $file), \OC_Filesystem::normalizePath('files_versions/'.$location.'/'.$filename.$ext)); + } else if ( $versions = self::getVersionsFromTrash($versionedFile, $timestamp) ) { foreach ($versions as $v) { if ($timestamp ) { $trashbinSize -= $view->filesize('files_trashbin/versions/'.$versionedFile.'.v'.$v.'.d'.$timestamp); @@ -196,8 +196,8 @@ class Trashbin { } else { $trashbinSize -= $view->filesize('files_trashbin/versions/'.$versionedFile.'.v'.$v); $view->rename('files_trashbin/versions/'.$versionedFile.'.v'.$v, 'files_versions/'.$location.'/'.$filename.$ext.'.v'.$v); - } - } + } + } } } @@ -210,15 +210,15 @@ class Trashbin { } if ($timestamp) { $keyfile .= '.d'.$timestamp; - } + } if ( \OCP\App::isEnabled('files_encryption') && $view->file_exists($keyfile) ) { - if ( $result[0]['type'] === 'dir' ) { + if ( $result[0]['type'] === 'dir' ) { $trashbinSize -= self::calculateSize(new \OC_FilesystemView('/'.$user.'/'.$keyfile)); $view->rename($keyfile, 'files_encryption/keyfiles/'. $location.'/'.$filename); } else { $trashbinSize -= $view->filesize($keyfile); $view->rename($keyfile, 'files_encryption/keyfiles/'. $location.'/'.$filename.'.key'); - } + } } if ( $timestamp ) { @@ -245,7 +245,7 @@ class Trashbin { public static function delete($filename, $timestamp=null) { $user = \OCP\User::getUser(); $view = new \OC_FilesystemView('/'.$user); - $size = 0; + $size = 0; $trashbinSize = self::getTrashbinSize($user); if ( $trashbinSize === false || $trashbinSize < 0 ) { @@ -278,23 +278,23 @@ class Trashbin { } // Take care of encryption keys - $parts = pathinfo($file); - if ( $view->is_dir('/files_trashbin/files/'.$file) ) { - $keyfile = \OC_Filesystem::normalizePath('files_trashbin/keyfiles/'.$filename); - } else { - $keyfile = \OC_Filesystem::normalizePath('files_trashbin/keyfiles/'.$filename.'.key'); - } - if ($timestamp) { - $keyfile .= '.d'.$timestamp; - } - if ( \OCP\App::isEnabled('files_encryption') && $view->file_exists($keyfile) ) { - if ( $view->is_dir($keyfile) ) { - $size += self::calculateSize(new \OC_FilesystemView('/'.$user.'/'.$keyfile)); - } else { - $size += $view->filesize($keyfile); - } - $view->unlink($keyfile); - } + $parts = pathinfo($file); + if ( $view->is_dir('/files_trashbin/files/'.$file) ) { + $keyfile = \OC_Filesystem::normalizePath('files_trashbin/keyfiles/'.$filename); + } else { + $keyfile = \OC_Filesystem::normalizePath('files_trashbin/keyfiles/'.$filename.'.key'); + } + if ($timestamp) { + $keyfile .= '.d'.$timestamp; + } + if ( \OCP\App::isEnabled('files_encryption') && $view->file_exists($keyfile) ) { + if ( $view->is_dir($keyfile) ) { + $size += self::calculateSize(new \OC_FilesystemView('/'.$user.'/'.$keyfile)); + } else { + $size += $view->filesize($keyfile); + } + $view->unlink($keyfile); + } if ($view->is_dir('/files_trashbin/files/'.$file)) { $size += self::calculateSize(new \OC_Filesystemview('/'.$user.'/files_trashbin/files/'.$file)); @@ -304,7 +304,7 @@ class Trashbin { $view->unlink('/files_trashbin/files/'.$file); $trashbinSize -= $size; self::setTrashbinSize($user, $trashbinSize); - + return $size; } @@ -477,35 +477,35 @@ class Trashbin { return $size; } - /** - * get current size of trash bin from a given user - * - * @param $user user who owns the trash bin - * @return mixed trash bin size or false if no trash bin size is stored - */ - private static function getTrashbinSize($user) { - $query = \OC_DB::prepare('SELECT size FROM *PREFIX*files_trashsize WHERE user=?'); - $result = $query->execute(array($user))->fetchAll(); - - if ($result) { - return $result[0]['size']; - } - return false; - } - - /** - * write to the database how much space is in use for the trash bin - * - * @param $user owner of the trash bin - * @param $size size of the trash bin - */ - private static function setTrashbinSize($user, $size) { - if ( self::getTrashbinSize($user) === false) { - $query = \OC_DB::prepare('INSERT INTO *PREFIX*files_trashsize (size, user) VALUES (?, ?)'); - }else { - $query = \OC_DB::prepare('UPDATE *PREFIX*files_trashsize SET size=? WHERE user=?'); - } - $query->execute(array($size, $user)); + /** + * get current size of trash bin from a given user + * + * @param $user user who owns the trash bin + * @return mixed trash bin size or false if no trash bin size is stored + */ + private static function getTrashbinSize($user) { + $query = \OC_DB::prepare('SELECT size FROM *PREFIX*files_trashsize WHERE user=?'); + $result = $query->execute(array($user))->fetchAll(); + + if ($result) { + return $result[0]['size']; + } + return false; + } + + /** + * write to the database how much space is in use for the trash bin + * + * @param $user owner of the trash bin + * @param $size size of the trash bin + */ + private static function setTrashbinSize($user, $size) { + if ( self::getTrashbinSize($user) === false) { + $query = \OC_DB::prepare('INSERT INTO *PREFIX*files_trashsize (size, user) VALUES (?, ?)'); + }else { + $query = \OC_DB::prepare('UPDATE *PREFIX*files_trashsize SET size=? WHERE user=?'); + } + $query->execute(array($size, $user)); } } From 664e7a3fc2e1ee4ea82026cfadbf17f34570ad6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Mon, 25 Feb 2013 15:08:14 +0100 Subject: [PATCH 44/54] use distance option to delay dragging in sane browsers --- apps/files/js/files.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/files/js/files.js b/apps/files/js/files.js index 74b2e48fb0..6b9b23657d 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -863,6 +863,10 @@ var dragOptions={ $('#fileList tr td.filename').addClass('ui-draggable'); } } +// sane browsers support using the distance option +if ( ! $.browser.msie) { + dragOptions['distance'] = 20; +} var folderDropOptions={ drop: function( event, ui ) { From 272f854ce685f3f44312fd4cb15858bbbd993276 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Schie=C3=9Fle?= Date: Mon, 25 Feb 2013 15:34:36 +0100 Subject: [PATCH 45/54] fix getVersion call --- apps/files_trashbin/lib/trash.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/files_trashbin/lib/trash.php b/apps/files_trashbin/lib/trash.php index 8f745f8203..a04545e326 100644 --- a/apps/files_trashbin/lib/trash.php +++ b/apps/files_trashbin/lib/trash.php @@ -77,7 +77,7 @@ class Trashbin { if ( $view->is_dir('files_versions'.$file_path) ) { $trashbinSize += self::calculateSize(new \OC_FilesystemView('/'. $user.'/files_versions/'.$file_path)); $view->rename('files_versions'.$file_path, 'files_trashbin/versions'. $deleted.'.d'.$timestamp); - } else if ( $versions = \OCA\Files_Versions\Storage::getVersions($file_path) ) { + } else if ( $versions = \OCA\Files_Versions\Storage::getVersions($user, $file_path) ) { foreach ($versions as $v) { $trashbinSize += $view->filesize('files_versions'.$v['path'].'.v'.$v['version']); $view->rename('files_versions'.$v['path'].'.v'.$v['version'], 'files_trashbin/versions'. $deleted.'.v'.$v['version'].'.d'.$timestamp); From b917646516b7a5756992f6606a601efc480d0872 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Schie=C3=9Fle?= Date: Mon, 25 Feb 2013 16:12:44 +0100 Subject: [PATCH 46/54] fix quota calculation --- apps/files_trashbin/lib/trash.php | 10 +++++----- apps/files_versions/lib/versions.php | 10 ++++++---- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/apps/files_trashbin/lib/trash.php b/apps/files_trashbin/lib/trash.php index a04545e326..d4d5ad96cf 100644 --- a/apps/files_trashbin/lib/trash.php +++ b/apps/files_trashbin/lib/trash.php @@ -96,20 +96,21 @@ class Trashbin { $view->rename($keyfile.'.key', 'files_trashbin/keyfiles/'. $deleted.'.key.d'.$timestamp); } } - } else { \OC_Log::write('files_trashbin', 'Couldn\'t move '.$file_path.' to the trash bin', \OC_log::ERROR); } // get available disk space for user - $quota = \OCP\Util::computerFileSize(\OC_Preferences::getValue($user, 'files', 'quota')); + $quota = \OC_Preferences::getValue($user, 'files', 'quota'); if ( $quota === null ) { - $quota = \OCP\Util::computerFileSize(\OC_Appconfig::getValue('files', 'default_quota')); + $quota = \OC_Appconfig::getValue('files', 'default_quota'); } if ( $quota === null ) { $quota = \OC\Files\Filesystem::free_space('/') / count(\OCP\User::getUsers()); + } else { + $quota = \OCP\Util::computerFileSize($quota); } - + // calculate available space for trash bin $rootInfo = $view->getFileInfo('/files'); $free = $quota-$rootInfo['size']; // remaining free space for user @@ -118,7 +119,6 @@ class Trashbin { } else { $availableSpace = $free-$trashbinSize; } - $trashbinSize -= self::expire($availableSpace); self::setTrashbinSize($user, $trashbinSize); diff --git a/apps/files_versions/lib/versions.php b/apps/files_versions/lib/versions.php index 05c1bf53e4..778fefd8a7 100644 --- a/apps/files_versions/lib/versions.php +++ b/apps/files_versions/lib/versions.php @@ -350,12 +350,14 @@ class Storage { $versions_fileview = new \OC\Files\View('/'.$uid.'/files_versions'); // get available disk space for user - $quota = \OCP\Util::computerFileSize(\OC_Preferences::getValue($uid, 'files', 'quota')); - if ( $quota == null ) { - $quota = \OCP\Util::computerFileSize(\OC_Appconfig::getValue('files', 'default_quota')); + $quota = \OC_Preferences::getValue($uid, 'files', 'quota'); + if ( $quota === null ) { + $quota = \OC_Appconfig::getValue('files', 'default_quota'); } - if ( $quota == null ) { + if ( $quota === null ) { $quota = \OC\Files\Filesystem::free_space('/') / count(\OCP\User::getUsers()); + } else { + $quota = \OCP\Util::computerFileSize($quota); } // make sure that we have the current size of the version history From 3009b43e3d54c3191f9282e626d6fcaf9cd042e7 Mon Sep 17 00:00:00 2001 From: Frank Karlitschek Date: Mon, 25 Feb 2013 16:30:11 +0100 Subject: [PATCH 47/54] use a 5 sec timeout for the webdav check --- lib/util.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/util.php b/lib/util.php index 87facda180..f2a43e4210 100755 --- a/lib/util.php +++ b/lib/util.php @@ -569,11 +569,16 @@ class OC_Util { if (!function_exists('curl_init')) { return true; } - $settings = array( 'baseUri' => OC_Helper::linkToRemote('webdav'), ); + // save the old timeout so that we can restore it later + $old_timeout=ini_get("default_socket_timeout"); + + // use a 5 sec timeout for the check. Should be enough for local requests. + ini_set("default_socket_timeout", 5); + $client = new \Sabre_DAV_Client($settings); $return = true; @@ -587,6 +592,9 @@ class OC_Util { $return = false; } + // restore the original timeout + ini_set("default_socket_timeout", $old_timeout); + return $return; } From dbf2bfc8cd3bf399b4964f7979b5442f2e2f4d64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Schie=C3=9Fle?= Date: Mon, 25 Feb 2013 16:22:06 +0100 Subject: [PATCH 48/54] delete table row if file was deleted instead of just hide it --- apps/files/js/filelist.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index ea721059c3..f5f3f3ba0c 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -334,7 +334,7 @@ var FileList={ if (result.status == 'success') { $.each(files,function(index,file){ var files = $('tr').filterAttr('data-file',file); - files.hide(); + files.remove(); files.find('input[type="checkbox"]').removeAttr('checked'); files.removeClass('selected'); }); From 1d83d76b457666bad4637bbae87fceead853d87a Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Mon, 25 Feb 2013 17:50:17 +0100 Subject: [PATCH 49/54] fixed bug that prevented a newly created file to be opened with registered files actions --- apps/files/js/files.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/files/js/files.js b/apps/files/js/files.js index 6b9b23657d..464f770368 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -595,7 +595,7 @@ $(document).ready(function() { var date=new Date(); FileList.addFile(name,0,date,false,hidden); var tr=$('tr').filterAttr('data-file',name); - tr.data('mime','text/plain').data('id',result.data.id); + tr.attr('data-mime','text/plain'); tr.attr('data-id', result.data.id); getMimeIcon('text/plain',function(path){ tr.find('td.filename').attr('style','background-image:url('+path+')'); From 55c72617c6a582f25f3769872ad09d0494049a5f Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Mon, 25 Feb 2013 18:37:05 +0100 Subject: [PATCH 50/54] set http 500 when session could not be started to prevent serving of empty files see #1049 --- lib/base.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/base.php b/lib/base.php index b5439c00ab..16aa7bff30 100644 --- a/lib/base.php +++ b/lib/base.php @@ -320,8 +320,11 @@ class OC { // set the session name to the instance id - which is unique session_name(OC_Util::getInstanceId()); - // (re)-initialize session - session_start(); + // if session cant be started break with http 500 error + if (session_start() === false){ + header('HTTP/1.1 500 Internal Server Error'); + exit(1); + } // regenerate session id periodically to avoid session fixation if (!isset($_SESSION['SID_CREATED'])) { From bc2fefed59f2d3f662e34332065a3ba02cccdd6f Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Mon, 25 Feb 2013 18:42:09 +0100 Subject: [PATCH 51/54] write an error log when session could not be initialized --- lib/base.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/base.php b/lib/base.php index 16aa7bff30..3ca2daccd2 100644 --- a/lib/base.php +++ b/lib/base.php @@ -322,6 +322,8 @@ class OC { // if session cant be started break with http 500 error if (session_start() === false){ + OC_Log::write('core', 'Session could not be initialized', + OC_Log::ERROR); header('HTTP/1.1 500 Internal Server Error'); exit(1); } From aba60dba287cefdc6fbdcc14437af1d4ab6a12bc Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Mon, 25 Feb 2013 18:47:34 +0100 Subject: [PATCH 52/54] added simple error message for the browser --- lib/base.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/base.php b/lib/base.php index 3ca2daccd2..156edebc13 100644 --- a/lib/base.php +++ b/lib/base.php @@ -324,6 +324,8 @@ class OC { if (session_start() === false){ OC_Log::write('core', 'Session could not be initialized', OC_Log::ERROR); + echo 'Session could not be initialized. Please contact your system'; + echo ' administrator'; header('HTTP/1.1 500 Internal Server Error'); exit(1); } From 7f7b8bc07aedf9da93eecc8163cb9c98a4821eb0 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Mon, 25 Feb 2013 19:17:29 +0100 Subject: [PATCH 53/54] use error template --- lib/base.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/base.php b/lib/base.php index 156edebc13..f9bb1bb11b 100644 --- a/lib/base.php +++ b/lib/base.php @@ -324,10 +324,16 @@ class OC { if (session_start() === false){ OC_Log::write('core', 'Session could not be initialized', OC_Log::ERROR); - echo 'Session could not be initialized. Please contact your system'; - echo ' administrator'; + header('HTTP/1.1 500 Internal Server Error'); - exit(1); + $error = 'Session could not be initialized. Please contact your '; + $error .= 'system administrator'; + + $tmpl = new OC_Template('', 'error', 'guest'); + $tmpl->assign('errors', array(1 => array('error' => $error))); + $tmpl->printPage(); + + exit(); } // regenerate session id periodically to avoid session fixation From a533bb6dcd4a68927c21b63a83830d79384320a5 Mon Sep 17 00:00:00 2001 From: Frank Karlitschek Date: Mon, 25 Feb 2013 20:00:40 +0100 Subject: [PATCH 54/54] 5 beta 2 --- lib/util.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/util.php b/lib/util.php index 0d608db53a..ae6b4646e1 100755 --- a/lib/util.php +++ b/lib/util.php @@ -75,7 +75,7 @@ class OC_Util { public static function getVersion() { // hint: We only can count up. Reset minor/patchlevel when // updating major/minor version number. - return array(4, 93, 10); + return array(4, 94, 10); } /** @@ -83,7 +83,7 @@ class OC_Util { * @return string */ public static function getVersionString() { - return '5.0 beta 1'; + return '5.0 beta 2'; } /**