aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/files_encryption/l10n/uk.php43
-rw-r--r--apps/files_external/l10n/uk.php39
-rw-r--r--apps/files_external/lib/amazons3.php104
-rwxr-xr-xapps/files_external/lib/dropbox.php1
-rw-r--r--apps/files_external/lib/ftp.php2
-rw-r--r--apps/files_external/lib/google.php1
-rw-r--r--apps/files_external/lib/sftp.php39
-rw-r--r--apps/files_external/lib/swift.php130
-rw-r--r--l10n/templates/core.pot2
-rw-r--r--l10n/templates/files.pot2
-rw-r--r--l10n/templates/files_encryption.pot2
-rw-r--r--l10n/templates/files_external.pot2
-rw-r--r--l10n/templates/files_sharing.pot2
-rw-r--r--l10n/templates/files_trashbin.pot2
-rw-r--r--l10n/templates/files_versions.pot2
-rw-r--r--l10n/templates/lib.pot2
-rw-r--r--l10n/templates/private.pot2
-rw-r--r--l10n/templates/settings.pot2
-rw-r--r--l10n/templates/user_ldap.pot2
-rw-r--r--l10n/templates/user_webdavauth.pot2
-rw-r--r--lib/base.php17
-rw-r--r--lib/l10n/uk.php9
-rw-r--r--lib/private/app.php2
-rw-r--r--lib/private/db.php1
-rw-r--r--lib/private/diagnostics/event.php89
-rw-r--r--lib/private/diagnostics/eventlogger.php41
-rw-r--r--lib/private/diagnostics/nulleventlogger.php43
-rw-r--r--lib/private/diagnostics/nullquerylogger.php31
-rw-r--r--lib/private/diagnostics/query.php57
-rw-r--r--lib/private/diagnostics/querylogger.php47
-rw-r--r--lib/private/route/router.php5
-rw-r--r--lib/private/server.php53
-rw-r--r--lib/private/share/share.php6
-rwxr-xr-xlib/private/util.php4
-rw-r--r--lib/public/diagnostics/ievent.php36
-rw-r--r--lib/public/diagnostics/ieventlogger.php39
-rw-r--r--lib/public/diagnostics/iquery.php26
-rw-r--r--lib/public/diagnostics/iquerylogger.php27
-rw-r--r--lib/public/iservercontainer.php16
-rw-r--r--settings/l10n/cs_CZ.php2
40 files changed, 798 insertions, 136 deletions
diff --git a/apps/files_encryption/l10n/uk.php b/apps/files_encryption/l10n/uk.php
index 42c6cd39a61..674d5445bb7 100644
--- a/apps/files_encryption/l10n/uk.php
+++ b/apps/files_encryption/l10n/uk.php
@@ -1,9 +1,50 @@
<?php
$TRANSLATIONS = array(
"Unknown error" => "Невідома помилка",
+"Missing recovery key password" => "Відсутній пароль ключа відновлення",
+"Please repeat the recovery key password" => "Введіть ще раз пароль для ключа відновлення",
+"Repeated recovery key password does not match the provided recovery key password" => "Введені паролі ключа відновлення не співпадають",
+"Recovery key successfully enabled" => "Ключ відновлення підключено",
+"Could not disable recovery key. Please check your recovery key password!" => "Не вдалося відключити ключ відновлення. Будь ласка, перевірте пароль ключа відновлення!",
+"Recovery key successfully disabled" => "Ключ відновлення відключено",
+"Please provide the old recovery password" => "Будь ласка, введіть старий пароль відновлення",
+"Please provide a new recovery password" => "Будь ласка, введіть новий пароль відновлення",
+"Please repeat the new recovery password" => "Будь ласка, введіть новий пароль відновлення ще раз",
+"Password successfully changed." => "Пароль змінено.",
+"Could not change the password. Maybe the old password was not correct." => "Не вдалося змінити пароль. Можливо ви неправильно ввели старий пароль.",
+"Private key password successfully updated." => "Пароль секретного ключа оновлено.",
+"Could not update the private key password. Maybe the old password was not correct." => "Не вдалося оновити пароль секретного ключа. Можливо ви не правильно ввели старий пароль.",
+"File recovery settings updated" => "Налаштування файла відновлення оновлено",
+"Could not update file recovery" => "Не вдалося оновити файл відновлення ",
+"Encryption app not initialized! Maybe the encryption app was re-enabled during your session. Please try to log out and log back in to initialize the encryption app." => "Додаток шифрувння не ініціалізовано! Можливо цей додаток редагувався під час вашої сесії. Будь ласка, спробуйте вийти і зайти знову щоб проініціалізувати додаток шифрування.",
+"Your private key is not valid! Likely your password was changed outside of %s (e.g. your corporate directory). You can update your private key password in your personal settings to recover access to your encrypted files." => "Ваш секретний ключ не дійсний! Ймовірно ваш пароль був змінений ззовні %s (наприклад, корпоративний каталог). Ви можете оновити секретний ключ в особистих налаштуваннях на сторінці відновлення доступу до зашифрованих файлів.",
+"Can not decrypt this file, probably this is a shared file. Please ask the file owner to reshare the file with you." => "Не можу розшифрувати цей файл, можливо він опублікований. Будь ласка, попросіть власника опублікувати його заново.",
+"Unknown error. Please check your system settings or contact your administrator" => "Невідома помилка. Будь ласка, перевірте налаштування системи або зверніться до адміністратора.",
+"Missing requirements." => "Відсутні вимоги.",
+"Please make sure that PHP 5.3.3 or newer is installed and that OpenSSL together with the PHP extension is enabled and configured properly. For now, the encryption app has been disabled." => "Будь ласка, впевніться, що встановлена версія PHP 5.3.3 або новіша, а також, що OpenSSL та інші розширення PHP підключені та вірно налаштовані. На даний момент додаток шифрування відключений.",
+"Following users are not set up for encryption:" => "Для наступних користувачів шифрування не налаштоване:",
+"Initial encryption started... This can take some time. Please wait." => "Початкове шифрування почалося... Це може зайняти деякий час. Будь ласка, почекайте.",
+"Initial encryption running... Please try again later." => "Початкове шифрування працює... Це може зайняти деякий час. Будь ласка, почекайте.",
+"Go directly to your %spersonal settings%s." => "Перейти навпростець до ваших %spersonal settings%s.",
"Encryption" => "Шифрування",
"Encryption App is enabled but your keys are not initialized, please log-out and log-in again" => "Доданок шифрування ввімкнено, але ваші ключі не ініціалізовано, вийдіть та зайдіть знову",
+"Enable recovery key (allow to recover users files in case of password loss):" => "Ввімкнути ключ відновлення (дозволяє користувачам відновлювати файли при втраті паролю):",
+"Recovery key password" => "Пароль ключа відновлення",
+"Repeat Recovery key password" => "Введіть ще раз пароль ключа відновлення",
"Enabled" => "Увімкнено",
-"Change Password" => "Змінити Пароль"
+"Disabled" => "Вимкнено",
+"Change recovery key password:" => "Змінити пароль ключа відновлення:",
+"Old Recovery key password" => "Старий пароль ключа відновлення",
+"New Recovery key password" => "Новий пароль ключа відновлення",
+"Repeat New Recovery key password" => "Введіть ще раз новий пароль ключа відновлення",
+"Change Password" => "Змінити Пароль",
+"Your private key password no longer matches your log-in password." => "Пароль вашого закритого ключа більше не відповідає паролю від вашого облікового запису.",
+"Set your old private key password to your current log-in password:" => "Замініть старий пароль від закритого ключа на новий пароль входу:",
+" If you don't remember your old password you can ask your administrator to recover your files." => "Якщо ви не пам'ятаєте ваш старий пароль, ви можете звернутися до адміністратора щоб його відновити.",
+"Old log-in password" => "Старий пароль входу",
+"Current log-in password" => "Поточний пароль входу",
+"Update Private Key Password" => "Оновити пароль для закритого ключа",
+"Enable password recovery:" => "Ввімкнути відновлення паролю:",
+"Enabling this option will allow you to reobtain access to your encrypted files in case of password loss" => "Включення цієї опції дозволить вам отримати доступ до своїх зашифрованих файлів у випадку втрати паролю"
);
$PLURAL_FORMS = "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);";
diff --git a/apps/files_external/l10n/uk.php b/apps/files_external/l10n/uk.php
index 7ad93be519a..2c0c3081a5f 100644
--- a/apps/files_external/l10n/uk.php
+++ b/apps/files_external/l10n/uk.php
@@ -1,31 +1,70 @@
<?php
$TRANSLATIONS = array(
+"Fetching request tokens failed. Verify that your Dropbox app key and secret are correct." => "Помилка при отримані токенів. Перевірте правильність вашого секретного ключа та ключ додатка.",
+"Fetching access tokens failed. Verify that your Dropbox app key and secret are correct." => "Помилка при отримані токена доступу. Перевірте правильність вашого секретного ключа та ключ додатка.",
"Please provide a valid Dropbox app key and secret." => "Будь ласка, надайте дійсний ключ та пароль Dropbox.",
+"Step 1 failed. Exception: %s" => "1-й крок невдалий. Виключення: %s",
+"Step 2 failed. Exception: %s" => "2-й крок невдалий. Виключення: %s",
"External storage" => "Зовнішнє сховище",
+"Local" => "Локально",
"Location" => "Місце",
+"Amazon S3" => "Amazon S3",
+"Key" => "Ключ",
+"Secret" => "Секрет",
+"Bucket" => "Кошик",
+"Amazon S3 and compliant" => "Amazon S3 та сумісний",
+"Access Key" => "Ключ доступа",
+"Secret Key" => "Секретний ключ",
+"Hostname" => "Ім'я хоста",
"Port" => "Порт",
"Region" => "Регіон",
+"Enable SSL" => "Включити SSL",
+"Enable Path Style" => "Включити стиль шляху",
+"App key" => "Ключ додатку",
+"App secret" => "Секретний ключ додатку",
"Host" => "Хост",
"Username" => "Ім'я користувача",
"Password" => "Пароль",
+"Root" => "Батьківський каталог",
+"Secure ftps://" => "Захищений ftps://",
+"Client ID" => "Ідентифікатор клієнта",
+"Client secret" => "Ключ клієнта",
"OpenStack Object Storage" => "OpenStack Object Storage",
"Region (optional for OpenStack Object Storage)" => "Регіон (опціонально для OpenStack Object Storage)",
+"API Key (required for Rackspace Cloud Files)" => "Ключ API (обов'язково для Rackspace Cloud Files)",
+"Tenantname (required for OpenStack Object Storage)" => "Ім'я орендатора (обов'язково для OpenStack Object Storage)",
"Password (required for OpenStack Object Storage)" => "Пароль (обов’язково для OpenStack Object Storage)",
"Service Name (required for OpenStack Object Storage)" => "Назва сервісу (обов’язково для OpenStack Object Storage)",
+"URL of identity endpoint (required for OpenStack Object Storage)" => "URL підтвердження кінцевої точки (обов'язково для OpenStack Object Storage)",
+"Timeout of HTTP requests in seconds" => "Тайм-аут HTTP запитів на секунду",
"Share" => "Поділитися",
+"SMB / CIFS using OC login" => "SMB / CIFS з використанням логіна OC",
+"Username as share" => "Ім'я для відкритого доступу",
"URL" => "URL",
+"Secure https://" => "Захищений https://",
+"Remote subfolder" => "Віддалений підкаталог",
"Access granted" => "Доступ дозволено",
"Error configuring Dropbox storage" => "Помилка при налаштуванні сховища Dropbox",
"Grant access" => "Дозволити доступ",
"Error configuring Google Drive storage" => "Помилка при налаштуванні сховища Google Drive",
"Personal" => "Особисте",
+"System" => "Система",
+"All users. Type to select user or group." => "Всі користувачі. Введіть ім'я користувача або групи.",
+"(group)" => "(група)",
"Saved" => "Збереженно",
+"<b>Note:</b> " => "<b>Примітка:</b>",
+" and " => "та",
+"<b>Note:</b> The cURL support in PHP is not enabled or installed. Mounting of %s is not possible. Please ask your system administrator to install it." => "<b>Примітка:</b> Підтримку cURL в PHP не ввімкнено чи не встановлена. Під'єднатися до %s неможливо. Зверніться до системного адміністратора.",
+"<b>Note:</b> The FTP support in PHP is not enabled or installed. Mounting of %s is not possible. Please ask your system administrator to install it." => "<b>Примітка:</b> Підтримку FTP в PHP не ввімкнено чи не встановлена. Під'єднатися до %s неможливо. Зверніться до системного адміністратора.",
+"<b>Note:</b> \"%s\" is not installed. Mounting of %s is not possible. Please ask your system administrator to install it." => "<b>Примітка:</b> \"%s\" не встановлено. Під'єднатися до %s неможливо. Зверніться до системного адміністратора.",
"You don't have any external storages" => "У вас немає зовнішніх сховищ",
"Name" => "Ім'я",
"Storage type" => "Тип сховища",
+"Scope" => "Область",
"External Storage" => "Зовнішні сховища",
"Folder name" => "Ім'я теки",
"Configuration" => "Налаштування",
+"Available for" => "Доступний для",
"Add storage" => "Додати сховище",
"Delete" => "Видалити",
"Enable User External Storage" => "Активувати користувацькі зовнішні сховища",
diff --git a/apps/files_external/lib/amazons3.php b/apps/files_external/lib/amazons3.php
index 808de16c8a8..da919236f8f 100644
--- a/apps/files_external/lib/amazons3.php
+++ b/apps/files_external/lib/amazons3.php
@@ -111,34 +111,6 @@ class AmazonS3 extends \OC\Files\Storage\Common {
$params['port'] = ($params['use_ssl'] === 'false') ? 80 : 443;
}
$base_url = $scheme . '://' . $params['hostname'] . ':' . $params['port'] . '/';
-
- $this->connection = S3Client::factory(array(
- 'key' => $params['key'],
- 'secret' => $params['secret'],
- 'base_url' => $base_url,
- 'region' => $params['region']
- ));
-
- if (!$this->connection->isValidBucketName($this->bucket)) {
- throw new \Exception("The configured bucket name is invalid.");
- }
-
- if (!$this->connection->doesBucketExist($this->bucket)) {
- try {
- $this->connection->createBucket(array(
- 'Bucket' => $this->bucket
- ));
- $this->connection->waitUntilBucketExists(array(
- 'Bucket' => $this->bucket,
- 'waiter.interval' => 1,
- 'waiter.max_attempts' => 15
- ));
- $this->testTimeout();
- } catch (S3Exception $e) {
- \OCP\Util::logException('files_external', $e);
- throw new \Exception('Creation of bucket failed. '.$e->getMessage());
- }
- }
}
/**
@@ -181,7 +153,7 @@ class AmazonS3 extends \OC\Files\Storage\Common {
}
try {
- $this->connection->putObject(array(
+ $this->getConnection()->putObject(array(
'Bucket' => $this->bucket,
'Key' => $path . '/',
'ContentType' => 'httpd/unix-directory'
@@ -216,7 +188,7 @@ class AmazonS3 extends \OC\Files\Storage\Common {
protected function clearBucket() {
try {
- $this->connection->clearBucket($this->bucket);
+ $this->getConnection()->clearBucket($this->bucket);
return true;
// clearBucket() is not working with Ceph, so if it fails we try the slower approach
} catch (\Exception $e) {
@@ -237,9 +209,9 @@ class AmazonS3 extends \OC\Files\Storage\Common {
// to delete all objects prefixed with the path.
do {
// instead of the iterator, manually loop over the list ...
- $objects = $this->connection->listObjects($params);
+ $objects = $this->getConnection()->listObjects($params);
// ... so we can delete the files in batches
- $this->connection->deleteObjects(array(
+ $this->getConnection()->deleteObjects(array(
'Bucket' => $this->bucket,
'Objects' => $objects['Contents']
));
@@ -264,7 +236,7 @@ class AmazonS3 extends \OC\Files\Storage\Common {
try {
$files = array();
- $result = $this->connection->getIterator('ListObjects', array(
+ $result = $this->getConnection()->getIterator('ListObjects', array(
'Bucket' => $this->bucket,
'Delimiter' => '/',
'Prefix' => $path
@@ -299,7 +271,7 @@ class AmazonS3 extends \OC\Files\Storage\Common {
$stat['size'] = -1; //unknown
$stat['mtime'] = time() - $this->rescanDelay * 1000;
} else {
- $result = $this->connection->headObject(array(
+ $result = $this->getConnection()->headObject(array(
'Bucket' => $this->bucket,
'Key' => $path
));
@@ -328,10 +300,10 @@ class AmazonS3 extends \OC\Files\Storage\Common {
}
try {
- if ($this->connection->doesObjectExist($this->bucket, $path)) {
+ if ($this->getConnection()->doesObjectExist($this->bucket, $path)) {
return 'file';
}
- if ($this->connection->doesObjectExist($this->bucket, $path.'/')) {
+ if ($this->getConnection()->doesObjectExist($this->bucket, $path.'/')) {
return 'dir';
}
} catch (S3Exception $e) {
@@ -350,7 +322,7 @@ class AmazonS3 extends \OC\Files\Storage\Common {
}
try {
- $this->connection->deleteObject(array(
+ $this->getConnection()->deleteObject(array(
'Bucket' => $this->bucket,
'Key' => $path
));
@@ -373,7 +345,7 @@ class AmazonS3 extends \OC\Files\Storage\Common {
self::$tmpFiles[$tmpFile] = $path;
try {
- $this->connection->getObject(array(
+ $this->getConnection()->getObject(array(
'Bucket' => $this->bucket,
'Key' => $path,
'SaveAs' => $tmpFile
@@ -421,7 +393,7 @@ class AmazonS3 extends \OC\Files\Storage\Common {
return 'httpd/unix-directory';
} else if ($this->file_exists($path)) {
try {
- $result = $this->connection->headObject(array(
+ $result = $this->getConnection()->headObject(array(
'Bucket' => $this->bucket,
'Key' => $path
));
@@ -449,7 +421,7 @@ class AmazonS3 extends \OC\Files\Storage\Common {
if ($fileType === 'dir' && ! $this->isRoot($path)) {
$path .= '/';
}
- $this->connection->copyObject(array(
+ $this->getConnection()->copyObject(array(
'Bucket' => $this->bucket,
'Key' => $this->cleanKey($path),
'Metadata' => $metadata,
@@ -457,11 +429,13 @@ class AmazonS3 extends \OC\Files\Storage\Common {
));
$this->testTimeout();
} else {
- $this->connection->putObject(array(
+ $mimeType = \OC_Helper::getMimetypeDetector()->detectPath($path);
+ $this->getConnection()->putObject(array(
'Bucket' => $this->bucket,
'Key' => $this->cleanKey($path),
'Metadata' => $metadata,
- 'Body' => ''
+ 'Body' => '',
+ 'ContentType' => $mimeType
));
$this->testTimeout();
}
@@ -479,7 +453,7 @@ class AmazonS3 extends \OC\Files\Storage\Common {
if ($this->is_file($path1)) {
try {
- $this->connection->copyObject(array(
+ $this->getConnection()->copyObject(array(
'Bucket' => $this->bucket,
'Key' => $this->cleanKey($path2),
'CopySource' => S3Client::encodeKey($this->bucket . '/' . $path1)
@@ -493,7 +467,7 @@ class AmazonS3 extends \OC\Files\Storage\Common {
$this->remove($path2);
try {
- $this->connection->copyObject(array(
+ $this->getConnection()->copyObject(array(
'Bucket' => $this->bucket,
'Key' => $path2 . '/',
'CopySource' => S3Client::encodeKey($this->bucket . '/' . $path1 . '/')
@@ -551,7 +525,7 @@ class AmazonS3 extends \OC\Files\Storage\Common {
}
public function test() {
- $test = $this->connection->getBucketAcl(array(
+ $test = $this->getConnection()->getBucketAcl(array(
'Bucket' => $this->bucket,
));
if (isset($test) && !is_null($test->getPath('Owner/ID'))) {
@@ -564,7 +538,45 @@ class AmazonS3 extends \OC\Files\Storage\Common {
return $this->id;
}
+ /**
+ * Returns the connection
+ *
+ * @return S3Client connected client
+ * @throws \Exception if connection could not be made
+ */
public function getConnection() {
+ if (!is_null($this->connection)) {
+ return $this->connection;
+ }
+
+ $this->connection = S3Client::factory(array(
+ 'key' => $params['key'],
+ 'secret' => $params['secret'],
+ 'base_url' => $base_url,
+ 'region' => $params['region']
+ ));
+
+ if (!$this->connection->isValidBucketName($this->bucket)) {
+ throw new \Exception("The configured bucket name is invalid.");
+ }
+
+ if (!$this->connection->doesBucketExist($this->bucket)) {
+ try {
+ $this->connection->createBucket(array(
+ 'Bucket' => $this->bucket
+ ));
+ $this->connection->waitUntilBucketExists(array(
+ 'Bucket' => $this->bucket,
+ 'waiter.interval' => 1,
+ 'waiter.max_attempts' => 15
+ ));
+ $this->testTimeout();
+ } catch (S3Exception $e) {
+ \OCP\Util::logException('files_external', $e);
+ throw new \Exception('Creation of bucket failed. '.$e->getMessage());
+ }
+ }
+
return $this->connection;
}
@@ -574,7 +586,7 @@ class AmazonS3 extends \OC\Files\Storage\Common {
}
try {
- $this->connection->putObject(array(
+ $this->getConnection()->putObject(array(
'Bucket' => $this->bucket,
'Key' => $this->cleanKey(self::$tmpFiles[$tmpFile]),
'SourceFile' => $tmpFile,
diff --git a/apps/files_external/lib/dropbox.php b/apps/files_external/lib/dropbox.php
index 9f297d22dcb..cc1e628f851 100755
--- a/apps/files_external/lib/dropbox.php
+++ b/apps/files_external/lib/dropbox.php
@@ -44,6 +44,7 @@ class Dropbox extends \OC\Files\Storage\Common {
$this->id = 'dropbox::'.$params['app_key'] . $params['token']. '/' . $this->root;
$oauth = new \Dropbox_OAuth_Curl($params['app_key'], $params['app_secret']);
$oauth->setToken($params['token'], $params['token_secret']);
+ // note: Dropbox_API connection is lazy
$this->dropbox = new \Dropbox_API($oauth, 'auto');
} else {
throw new \Exception('Creating \OC\Files\Storage\Dropbox storage failed');
diff --git a/apps/files_external/lib/ftp.php b/apps/files_external/lib/ftp.php
index 2650a94f85e..4a995d21157 100644
--- a/apps/files_external/lib/ftp.php
+++ b/apps/files_external/lib/ftp.php
@@ -39,7 +39,7 @@ class FTP extends \OC\Files\Storage\StreamWrapper{
$this->root .= '/';
}
} else {
- throw new \Exception();
+ throw new \Exception('Creating \OC\Files\Storage\FTP storage failed');
}
}
diff --git a/apps/files_external/lib/google.php b/apps/files_external/lib/google.php
index 5d238a363de..62b0f182e98 100644
--- a/apps/files_external/lib/google.php
+++ b/apps/files_external/lib/google.php
@@ -52,6 +52,7 @@ class Google extends \OC\Files\Storage\Common {
$client->setScopes(array('https://www.googleapis.com/auth/drive'));
$client->setUseObjects(true);
$client->setAccessToken($params['token']);
+ // note: API connection is lazy
$this->service = new \Google_DriveService($client);
$token = json_decode($params['token'], true);
$this->id = 'google::'.substr($params['client_id'], 0, 30).$token['created'];
diff --git a/apps/files_external/lib/sftp.php b/apps/files_external/lib/sftp.php
index aec56d088d5..f0a6f145422 100644
--- a/apps/files_external/lib/sftp.php
+++ b/apps/files_external/lib/sftp.php
@@ -53,6 +53,18 @@ class SFTP extends \OC\Files\Storage\Common {
if (substr($this->root, -1, 1) != '/') {
$this->root .= '/';
}
+ }
+
+ /**
+ * Returns the connection.
+ *
+ * @return \Net_SFTP connected client instance
+ * @throws \Exception when the connection failed
+ */
+ public function getConnection() {
+ if (!is_null($this->client)) {
+ return $this->client;
+ }
$hostKeys = $this->readHostKeys();
$this->client = new \Net_SFTP($this->host);
@@ -71,6 +83,7 @@ class SFTP extends \OC\Files\Storage\Common {
if (!$this->client->login($this->user, $this->password)) {
throw new \Exception('Login failed');
}
+ return $this->client;
}
public function test() {
@@ -81,7 +94,7 @@ class SFTP extends \OC\Files\Storage\Common {
) {
return false;
}
- return $this->client->nlist() !== false;
+ return $this->getConnection()->nlist() !== false;
}
public function getId(){
@@ -149,7 +162,7 @@ class SFTP extends \OC\Files\Storage\Common {
public function mkdir($path) {
try {
- return $this->client->mkdir($this->absPath($path));
+ return $this->getConnection()->mkdir($this->absPath($path));
} catch (\Exception $e) {
return false;
}
@@ -157,7 +170,7 @@ class SFTP extends \OC\Files\Storage\Common {
public function rmdir($path) {
try {
- return $this->client->delete($this->absPath($path), true);
+ return $this->getConnection()->delete($this->absPath($path), true);
} catch (\Exception $e) {
return false;
}
@@ -165,7 +178,7 @@ class SFTP extends \OC\Files\Storage\Common {
public function opendir($path) {
try {
- $list = $this->client->nlist($this->absPath($path));
+ $list = $this->getConnection()->nlist($this->absPath($path));
if ($list === false) {
return false;
}
@@ -186,7 +199,7 @@ class SFTP extends \OC\Files\Storage\Common {
public function filetype($path) {
try {
- $stat = $this->client->stat($this->absPath($path));
+ $stat = $this->getConnection()->stat($this->absPath($path));
if ($stat['type'] == NET_SFTP_TYPE_REGULAR) {
return 'file';
}
@@ -202,7 +215,7 @@ class SFTP extends \OC\Files\Storage\Common {
public function file_exists($path) {
try {
- return $this->client->stat($this->absPath($path)) !== false;
+ return $this->getConnection()->stat($this->absPath($path)) !== false;
} catch (\Exception $e) {
return false;
}
@@ -210,7 +223,7 @@ class SFTP extends \OC\Files\Storage\Common {
public function unlink($path) {
try {
- return $this->client->delete($this->absPath($path), true);
+ return $this->getConnection()->delete($this->absPath($path), true);
} catch (\Exception $e) {
return false;
}
@@ -237,7 +250,7 @@ class SFTP extends \OC\Files\Storage\Common {
case 'x+':
case 'c':
case 'c+':
- $context = stream_context_create(array('sftp' => array('session' => $this->client)));
+ $context = stream_context_create(array('sftp' => array('session' => $this->getConnection())));
return fopen($this->constructUrl($path), $mode, false, $context);
}
} catch (\Exception $e) {
@@ -251,7 +264,7 @@ class SFTP extends \OC\Files\Storage\Common {
return false;
}
if (!$this->file_exists($path)) {
- $this->client->put($this->absPath($path), '');
+ $this->getConnection()->put($this->absPath($path), '');
} else {
return false;
}
@@ -262,11 +275,11 @@ class SFTP extends \OC\Files\Storage\Common {
}
public function getFile($path, $target) {
- $this->client->get($path, $target);
+ $this->getConnection()->get($path, $target);
}
public function uploadFile($path, $target) {
- $this->client->put($target, $path, NET_SFTP_LOCAL_FILE);
+ $this->getConnection()->put($target, $path, NET_SFTP_LOCAL_FILE);
}
public function rename($source, $target) {
@@ -274,7 +287,7 @@ class SFTP extends \OC\Files\Storage\Common {
if (!$this->is_dir($target) && $this->file_exists($target)) {
$this->unlink($target);
}
- return $this->client->rename(
+ return $this->getConnection()->rename(
$this->absPath($source),
$this->absPath($target)
);
@@ -285,7 +298,7 @@ class SFTP extends \OC\Files\Storage\Common {
public function stat($path) {
try {
- $stat = $this->client->stat($this->absPath($path));
+ $stat = $this->getConnection()->stat($this->absPath($path));
$mtime = $stat ? $stat['mtime'] : -1;
$size = $stat ? $stat['size'] : 0;
diff --git a/apps/files_external/lib/swift.php b/apps/files_external/lib/swift.php
index 6a1e12986fb..79effc04874 100644
--- a/apps/files_external/lib/swift.php
+++ b/apps/files_external/lib/swift.php
@@ -49,6 +49,12 @@ class Swift extends \OC\Files\Storage\Common {
*/
private $bucket;
/**
+ * Connection parameters
+ *
+ * @var array
+ */
+ private $params;
+ /**
* @var array
*/
private static $tmpFiles = array();
@@ -86,7 +92,7 @@ class Swift extends \OC\Files\Storage\Common {
*/
private function doesObjectExist($path) {
try {
- $this->container->getPartialObject($path);
+ $this->getContainer()->getPartialObject($path);
return true;
} catch (ClientErrorResponseException $e) {
\OCP\Util::writeLog('files_external', $e->getMessage(), \OCP\Util::ERROR);
@@ -113,41 +119,7 @@ class Swift extends \OC\Files\Storage\Common {
$params['service_name'] = 'cloudFiles';
}
- $settings = array(
- 'username' => $params['user'],
- );
-
- if (!empty($params['password'])) {
- $settings['password'] = $params['password'];
- } else if (!empty($params['key'])) {
- $settings['apiKey'] = $params['key'];
- }
-
- if (!empty($params['tenant'])) {
- $settings['tenantName'] = $params['tenant'];
- }
-
- if (!empty($params['timeout'])) {
- $settings['timeout'] = $params['timeout'];
- }
-
- if (isset($settings['apiKey'])) {
- $this->anchor = new Rackspace($params['url'], $settings);
- } else {
- $this->anchor = new OpenStack($params['url'], $settings);
- }
-
- $this->connection = $this->anchor->objectStoreService($params['service_name'], $params['region']);
-
- try {
- $this->container = $this->connection->getContainer($this->bucket);
- } catch (ClientErrorResponseException $e) {
- $this->container = $this->connection->createContainer($this->bucket);
- }
-
- if (!$this->file_exists('.')) {
- $this->mkdir('.');
- }
+ $this->params = $params;
}
public function mkdir($path) {
@@ -165,7 +137,7 @@ class Swift extends \OC\Files\Storage\Common {
$customHeaders = array('content-type' => 'httpd/unix-directory');
$metadataHeaders = DataObject::stockHeaders(array());
$allHeaders = $customHeaders + $metadataHeaders;
- $this->container->uploadObject($path, '', $allHeaders);
+ $this->getContainer()->uploadObject($path, '', $allHeaders);
} catch (Exceptions\CreateUpdateError $e) {
\OCP\Util::writeLog('files_external', $e->getMessage(), \OCP\Util::ERROR);
return false;
@@ -205,7 +177,7 @@ class Swift extends \OC\Files\Storage\Common {
}
try {
- $this->container->dataObject()->setName($path . '/')->delete();
+ $this->getContainer()->dataObject()->setName($path . '/')->delete();
} catch (Exceptions\DeleteError $e) {
\OCP\Util::writeLog('files_external', $e->getMessage(), \OCP\Util::ERROR);
return false;
@@ -228,7 +200,7 @@ class Swift extends \OC\Files\Storage\Common {
try {
$files = array();
/** @var OpenCloud\Common\Collection $objects */
- $objects = $this->container->objectList(array(
+ $objects = $this->getContainer()->objectList(array(
'prefix' => $path,
'delimiter' => '/'
));
@@ -261,7 +233,7 @@ class Swift extends \OC\Files\Storage\Common {
try {
/** @var DataObject $object */
- $object = $this->container->getPartialObject($path);
+ $object = $this->getContainer()->getPartialObject($path);
} catch (ClientErrorResponseException $e) {
\OCP\Util::writeLog('files_external', $e->getMessage(), \OCP\Util::ERROR);
return false;
@@ -314,7 +286,7 @@ class Swift extends \OC\Files\Storage\Common {
}
try {
- $this->container->dataObject()->setName($path)->delete();
+ $this->getContainer()->dataObject()->setName($path)->delete();
} catch (ClientErrorResponseException $e) {
\OCP\Util::writeLog('files_external', $e->getMessage(), \OCP\Util::ERROR);
return false;
@@ -332,7 +304,7 @@ class Swift extends \OC\Files\Storage\Common {
$tmpFile = \OC_Helper::tmpFile();
self::$tmpFiles[$tmpFile] = $path;
try {
- $object = $this->container->getObject($path);
+ $object = $this->getContainer()->getObject($path);
} catch (ClientErrorResponseException $e) {
\OCP\Util::writeLog('files_external', $e->getMessage(), \OCP\Util::ERROR);
return false;
@@ -385,7 +357,7 @@ class Swift extends \OC\Files\Storage\Common {
if ($this->is_dir($path)) {
return 'httpd/unix-directory';
} else if ($this->file_exists($path)) {
- $object = $this->container->getPartialObject($path);
+ $object = $this->getContainer()->getPartialObject($path);
return $object->getContentType();
}
return false;
@@ -402,14 +374,15 @@ class Swift extends \OC\Files\Storage\Common {
$path .= '/';
}
- $object = $this->container->getPartialObject($path);
+ $object = $this->getContainer()->getPartialObject($path);
$object->saveMetadata($metadata);
return true;
} else {
- $customHeaders = array('content-type' => 'text/plain');
+ $mimeType = \OC_Helper::getMimetypeDetector()->detectPath($path);
+ $customHeaders = array('content-type' => $mimeType);
$metadataHeaders = DataObject::stockHeaders($metadata);
$allHeaders = $customHeaders + $metadataHeaders;
- $this->container->uploadObject($path, '', $allHeaders);
+ $this->getContainer()->uploadObject($path, '', $allHeaders);
return true;
}
}
@@ -425,7 +398,7 @@ class Swift extends \OC\Files\Storage\Common {
$this->unlink($path2);
try {
- $source = $this->container->getPartialObject($path1);
+ $source = $this->getContainer()->getPartialObject($path1);
$source->copy($this->bucket . '/' . $path2);
} catch (ClientErrorResponseException $e) {
\OCP\Util::writeLog('files_external', $e->getMessage(), \OCP\Util::ERROR);
@@ -438,7 +411,7 @@ class Swift extends \OC\Files\Storage\Common {
$this->unlink($path2);
try {
- $source = $this->container->getPartialObject($path1 . '/');
+ $source = $this->getContainer()->getPartialObject($path1 . '/');
$source->copy($this->bucket . '/' . $path2 . '/');
} catch (ClientErrorResponseException $e) {
\OCP\Util::writeLog('files_external', $e->getMessage(), \OCP\Util::ERROR);
@@ -496,16 +469,75 @@ class Swift extends \OC\Files\Storage\Common {
return $this->id;
}
+ /**
+ * Returns the connection
+ *
+ * @return OpenCloud\ObjectStore\Service connected client
+ * @throws \Exception if connection could not be made
+ */
public function getConnection() {
+ if (!is_null($this->connection)) {
+ return $this->connection;
+ }
+
+ $settings = array(
+ 'username' => $this->params['user'],
+ );
+
+ if (!empty($this->params['password'])) {
+ $settings['password'] = $this->params['password'];
+ } else if (!empty($this->params['key'])) {
+ $settings['apiKey'] = $this->params['key'];
+ }
+
+ if (!empty($this->params['tenant'])) {
+ $settings['tenantName'] = $this->params['tenant'];
+ }
+
+ if (!empty($this->params['timeout'])) {
+ $settings['timeout'] = $this->params['timeout'];
+ }
+
+ if (isset($settings['apiKey'])) {
+ $this->anchor = new Rackspace($this->params['url'], $settings);
+ } else {
+ $this->anchor = new OpenStack($this->params['url'], $settings);
+ }
+
+ $this->connection = $this->anchor->objectStoreService($this->params['service_name'], $this->params['region']);
+
return $this->connection;
}
+ /**
+ * Returns the initialized object store container.
+ *
+ * @return OpenCloud\ObjectStore\Resource\Container
+ */
+ public function getContainer() {
+ if (!is_null($this->container)) {
+ return $this->container;
+ }
+
+ try {
+ $this->container = $this->getConnection()->getContainer($this->bucket);
+ } catch (ClientErrorResponseException $e) {
+ $this->container = $this->getConnection()->createContainer($this->bucket);
+ }
+
+ if (!$this->file_exists('.')) {
+ $this->mkdir('.');
+ }
+
+ return $this->container;
+ }
+
public function writeBack($tmpFile) {
if (!isset(self::$tmpFiles[$tmpFile])) {
return false;
}
$fileData = fopen($tmpFile, 'r');
- $this->container->uploadObject(self::$tmpFiles[$tmpFile], $fileData);
+ $this->getContainer()->uploadObject(self::$tmpFiles[$tmpFile], $fileData);
unlink($tmpFile);
}
diff --git a/l10n/templates/core.pot b/l10n/templates/core.pot
index aef8e464cd5..bb688f4b822 100644
--- a/l10n/templates/core.pot
+++ b/l10n/templates/core.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ownCloud Core 6.0.0\n"
"Report-Msgid-Bugs-To: translations@owncloud.org\n"
-"POT-Creation-Date: 2014-10-21 01:54-0400\n"
+"POT-Creation-Date: 2014-10-22 01:54-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
diff --git a/l10n/templates/files.pot b/l10n/templates/files.pot
index b2e43c8e205..85bcc6e9e38 100644
--- a/l10n/templates/files.pot
+++ b/l10n/templates/files.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ownCloud Core 6.0.0\n"
"Report-Msgid-Bugs-To: translations@owncloud.org\n"
-"POT-Creation-Date: 2014-10-21 01:54-0400\n"
+"POT-Creation-Date: 2014-10-22 01:54-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
diff --git a/l10n/templates/files_encryption.pot b/l10n/templates/files_encryption.pot
index 079ed7f85ab..1ed72859ac1 100644
--- a/l10n/templates/files_encryption.pot
+++ b/l10n/templates/files_encryption.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ownCloud Core 6.0.0\n"
"Report-Msgid-Bugs-To: translations@owncloud.org\n"
-"POT-Creation-Date: 2014-10-21 01:54-0400\n"
+"POT-Creation-Date: 2014-10-22 01:54-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
diff --git a/l10n/templates/files_external.pot b/l10n/templates/files_external.pot
index 815a84e8b8a..de40b8e4104 100644
--- a/l10n/templates/files_external.pot
+++ b/l10n/templates/files_external.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ownCloud Core 6.0.0\n"
"Report-Msgid-Bugs-To: translations@owncloud.org\n"
-"POT-Creation-Date: 2014-10-21 01:54-0400\n"
+"POT-Creation-Date: 2014-10-22 01:54-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
diff --git a/l10n/templates/files_sharing.pot b/l10n/templates/files_sharing.pot
index 07546d52bb2..ce322589b9b 100644
--- a/l10n/templates/files_sharing.pot
+++ b/l10n/templates/files_sharing.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ownCloud Core 6.0.0\n"
"Report-Msgid-Bugs-To: translations@owncloud.org\n"
-"POT-Creation-Date: 2014-10-21 01:54-0400\n"
+"POT-Creation-Date: 2014-10-22 01:54-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
diff --git a/l10n/templates/files_trashbin.pot b/l10n/templates/files_trashbin.pot
index 101b4a57b71..a96d07ab85f 100644
--- a/l10n/templates/files_trashbin.pot
+++ b/l10n/templates/files_trashbin.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ownCloud Core 6.0.0\n"
"Report-Msgid-Bugs-To: translations@owncloud.org\n"
-"POT-Creation-Date: 2014-10-21 01:54-0400\n"
+"POT-Creation-Date: 2014-10-22 01:54-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
diff --git a/l10n/templates/files_versions.pot b/l10n/templates/files_versions.pot
index b1d6fb906be..de554c9148f 100644
--- a/l10n/templates/files_versions.pot
+++ b/l10n/templates/files_versions.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ownCloud Core 6.0.0\n"
"Report-Msgid-Bugs-To: translations@owncloud.org\n"
-"POT-Creation-Date: 2014-10-21 01:54-0400\n"
+"POT-Creation-Date: 2014-10-22 01:54-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
diff --git a/l10n/templates/lib.pot b/l10n/templates/lib.pot
index 793e7c0f937..e2624fb4a1e 100644
--- a/l10n/templates/lib.pot
+++ b/l10n/templates/lib.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ownCloud Core 6.0.0\n"
"Report-Msgid-Bugs-To: translations@owncloud.org\n"
-"POT-Creation-Date: 2014-10-21 01:54-0400\n"
+"POT-Creation-Date: 2014-10-22 01:54-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
diff --git a/l10n/templates/private.pot b/l10n/templates/private.pot
index d6960e54646..2a22b412e4c 100644
--- a/l10n/templates/private.pot
+++ b/l10n/templates/private.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ownCloud Core 6.0.0\n"
"Report-Msgid-Bugs-To: translations@owncloud.org\n"
-"POT-Creation-Date: 2014-10-21 01:54-0400\n"
+"POT-Creation-Date: 2014-10-22 01:54-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
diff --git a/l10n/templates/settings.pot b/l10n/templates/settings.pot
index 6dd60aa218c..017a2103699 100644
--- a/l10n/templates/settings.pot
+++ b/l10n/templates/settings.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ownCloud Core 6.0.0\n"
"Report-Msgid-Bugs-To: translations@owncloud.org\n"
-"POT-Creation-Date: 2014-10-21 01:54-0400\n"
+"POT-Creation-Date: 2014-10-22 01:54-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
diff --git a/l10n/templates/user_ldap.pot b/l10n/templates/user_ldap.pot
index 5a479a27a9a..f25ec075da4 100644
--- a/l10n/templates/user_ldap.pot
+++ b/l10n/templates/user_ldap.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ownCloud Core 6.0.0\n"
"Report-Msgid-Bugs-To: translations@owncloud.org\n"
-"POT-Creation-Date: 2014-10-21 01:54-0400\n"
+"POT-Creation-Date: 2014-10-22 01:54-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
diff --git a/l10n/templates/user_webdavauth.pot b/l10n/templates/user_webdavauth.pot
index c00dfd1ab86..a02461b3eb2 100644
--- a/l10n/templates/user_webdavauth.pot
+++ b/l10n/templates/user_webdavauth.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ownCloud Core 6.0.0\n"
"Report-Msgid-Bugs-To: translations@owncloud.org\n"
-"POT-Creation-Date: 2014-10-21 01:54-0400\n"
+"POT-Creation-Date: 2014-10-22 01:54-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
diff --git a/lib/base.php b/lib/base.php
index 5ba8d3829ca..23f0e594510 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -444,6 +444,7 @@ class OC {
public static function init() {
// register autoloader
+ $loaderStart = microtime(true);
require_once __DIR__ . '/autoloader.php';
self::$loader = new \OC\Autoloader();
self::$loader->registerPrefix('Doctrine\\Common', 'doctrine/common/lib');
@@ -453,6 +454,13 @@ class OC {
self::$loader->registerPrefix('Patchwork', '3rdparty');
self::$loader->registerPrefix('Pimple', '3rdparty/Pimple');
spl_autoload_register(array(self::$loader, 'load'));
+ $loaderEnd = microtime(true);
+
+ // setup the basic server
+ self::initPaths();
+ self::$server = new \OC\Server();
+ \OC::$server->getEventLogger()->log('autoloader', 'Autoloader', $loaderStart, $loaderEnd);
+ \OC::$server->getEventLogger()->start('boot', 'Initialize');
// set some stuff
//ob_start();
@@ -469,7 +477,6 @@ class OC {
if (get_magic_quotes_gpc() == 1) {
ini_set('magic_quotes_runtime', 0);
}
-
//try to configure php to enable big file uploads.
//this doesn´t work always depending on the webserver and php configuration.
//Let´s try to overwrite some defaults anyways
@@ -485,9 +492,9 @@ class OC {
@ini_set('file_uploads', '50');
self::handleAuthHeaders();
- self::initPaths();
self::registerAutoloaderCache();
+
OC_Util::isSetLocaleWorking();
// setup 3rdparty autoloader
@@ -516,9 +523,8 @@ class OC {
stream_wrapper_register('quota', 'OC\Files\Stream\Quota');
stream_wrapper_register('oc', 'OC\Files\Stream\OC');
- // setup the basic server
- self::$server = new \OC\Server();
+ \OC::$server->getEventLogger()->start('init_session', 'Initialize session');
self::initTemplateEngine();
OC_App::loadApps(array('session'));
if (self::$CLI) {
@@ -526,6 +532,7 @@ class OC {
} else {
self::initSession();
}
+ \OC::$server->getEventLogger()->end('init_session');
self::checkConfig();
self::checkInstalled();
self::checkSSL();
@@ -612,6 +619,7 @@ class OC {
exit();
}
+ \OC::$server->getEventLogger()->end('boot');
}
private static function registerLocalAddressBook() {
@@ -701,6 +709,7 @@ class OC {
* Handle the request
*/
public static function handleRequest() {
+ \OC::$server->getEventLogger()->start('handle_request', 'Handle request');
// load all the classpaths from the enabled apps so they are available
// in the routing files of each app
OC::loadAppClassPaths();
diff --git a/lib/l10n/uk.php b/lib/l10n/uk.php
index 7c507a00dd7..6a151d62026 100644
--- a/lib/l10n/uk.php
+++ b/lib/l10n/uk.php
@@ -1,16 +1,25 @@
<?php
$TRANSLATIONS = array(
"Cannot write into \"config\" directory!" => "Не можу писати у каталог \"config\"!",
+"This can usually be fixed by giving the webserver write access to the config directory" => "Зазвичай це можна виправити, надавши веб-серверу права на запис в теці конфігурації",
+"See %s" => "Перегляд %s",
+"This can usually be fixed by %sgiving the webserver write access to the config directory%s." => "Зазвичай це можна виправити, %sнадавши веб-серверу права на запис в теці конфігурації%s.",
"Sample configuration detected" => "Виявлено приклад конфігурації",
+"It has been detected that the sample configuration has been copied. This can break your installation and is unsupported. Please read the documentation before performing changes on config.php" => "Була виявлена конфігурація з прикладу. Це може нашкодити вашій системі та не підтримується. Будь ласка, зверніться до документації перед внесенням змін в файл config.php",
"Help" => "Допомога",
"Personal" => "Особисте",
"Settings" => "Налаштування",
"Users" => "Користувачі",
"Admin" => "Адмін",
"Recommended" => "Рекомендуємо",
+"App \\\"%s\\\" can't be installed because it is not compatible with this version of ownCloud." => "Додаток \\\"%s\\\" не встановлено через несумісність з даною версією ownCloud.",
+"No app name specified" => "Не вказано ім'я додатку",
"Unknown filetype" => "Невідомий тип файлу",
"Invalid image" => "Невірне зображення",
"web services under your control" => "підконтрольні Вам веб-сервіси",
+"App directory already exists" => "Тека додатку вже існує",
+"Can't create app folder. Please fix permissions. %s" => "Неможливо створити теку додатку. Будь ласка, виправте права доступу. %s",
+"No source specified when installing app" => "Не вказано джерело при встановлені додатку",
"Application is not enabled" => "Додаток не увімкнений",
"Authentication error" => "Помилка автентифікації",
"Token expired. Please reload page." => "Строк дії токена скінчився. Будь ласка, перезавантажте сторінку.",
diff --git a/lib/private/app.php b/lib/private/app.php
index a97db7b5e53..8fcffbad950 100644
--- a/lib/private/app.php
+++ b/lib/private/app.php
@@ -89,6 +89,7 @@ class OC_App {
*/
public static function loadApp($app, $checkUpgrade = true) {
if (is_file(self::getAppPath($app) . '/appinfo/app.php')) {
+ \OC::$server->getEventLogger()->start('load_app_' . $app, 'Load app: ' . $app);
if ($checkUpgrade and self::shouldUpgrade($app)) {
throw new \OC\NeedsUpdateException();
}
@@ -100,6 +101,7 @@ class OC_App {
// enabled for groups
self::$enabledAppsCache = array();
}
+ \OC::$server->getEventLogger()->end('load_app_' . $app);
}
}
diff --git a/lib/private/db.php b/lib/private/db.php
index 80163415a90..ba069977d35 100644
--- a/lib/private/db.php
+++ b/lib/private/db.php
@@ -91,6 +91,7 @@ class OC_DB {
try {
self::$connection = $factory->getConnection($type, $connectionParams);
+ self::$connection->getConfiguration()->setSQLLogger(\OC::$server->getQueryLogger());
} catch(\Doctrine\DBAL\DBALException $e) {
OC_Log::write('core', $e->getMessage(), OC_Log::FATAL);
OC_User::setUserId(null);
diff --git a/lib/private/diagnostics/event.php b/lib/private/diagnostics/event.php
new file mode 100644
index 00000000000..af5d2ff8840
--- /dev/null
+++ b/lib/private/diagnostics/event.php
@@ -0,0 +1,89 @@
+<?php
+/**
+ * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC\Diagnostics;
+
+use OCP\Diagnostics\IEvent;
+
+class Event implements IEvent {
+ /**
+ * @var string
+ */
+ protected $id;
+
+ /**
+ * @var float
+ */
+ protected $start;
+
+ /**
+ * @var float
+ */
+ protected $end;
+
+ /**
+ * @var string
+ */
+ protected $description;
+
+ /**
+ * @param string $id
+ * @param string $description
+ * @param float $start
+ */
+ public function __construct($id, $description, $start) {
+ $this->id = $id;
+ $this->description = $description;
+ $this->start = $start;
+ }
+
+ /**
+ * @param float $time
+ */
+ public function end($time) {
+ $this->end = $time;
+ }
+
+ /**
+ * @return float
+ */
+ public function getStart() {
+ return $this->start;
+ }
+
+ /**
+ * @return string
+ */
+ public function getId() {
+ return $this->id;
+ }
+
+ /**
+ * @return string
+ */
+ public function getDescription() {
+ return $this->description;
+ }
+
+ /**
+ * @return float
+ */
+ public function getEnd() {
+ return $this->end;
+ }
+
+ /**
+ * @return float
+ */
+ public function getDuration() {
+ if (!$this->end) {
+ $this->end = microtime(true);
+ }
+ return $this->end - $this->start;
+ }
+}
diff --git a/lib/private/diagnostics/eventlogger.php b/lib/private/diagnostics/eventlogger.php
new file mode 100644
index 00000000000..9e557ebd304
--- /dev/null
+++ b/lib/private/diagnostics/eventlogger.php
@@ -0,0 +1,41 @@
+<?php
+/**
+ * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC\Diagnostics;
+
+use OCP\Diagnostics\IEventLogger;
+
+class EventLogger implements IEventLogger {
+ /**
+ * @var \OC\Diagnostics\Event[]
+ */
+ private $events = array();
+
+ public function start($id, $description) {
+ $this->events[$id] = new Event($id, $description, microtime(true));
+ }
+
+ public function end($id) {
+ if (isset($this->events[$id])) {
+ $timing = $this->events[$id];
+ $timing->end(microtime(true));
+ }
+ }
+
+ public function log($id, $description, $start, $end) {
+ $this->events[$id] = new Event($id, $description, $start);
+ $this->events[$id]->end($end);
+ }
+
+ /**
+ * @return \OCP\Diagnostics\IEvent[]
+ */
+ public function getEvents() {
+ return $this->events;
+ }
+}
diff --git a/lib/private/diagnostics/nulleventlogger.php b/lib/private/diagnostics/nulleventlogger.php
new file mode 100644
index 00000000000..bf203cbfefd
--- /dev/null
+++ b/lib/private/diagnostics/nulleventlogger.php
@@ -0,0 +1,43 @@
+<?php
+/**
+ * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC\Diagnostics;
+
+use OCP\Diagnostics\IEventLogger;
+
+/**
+ * Dummy event logger that doesn't actually log anything
+ */
+class NullEventLogger implements IEventLogger {
+ /**
+ * Mark the start of an event
+ *
+ * @param $id
+ * @param $description
+ */
+ public function start($id, $description) {
+ }
+
+ /**
+ * Mark the end of an event
+ *
+ * @param $id
+ */
+ public function end($id) {
+ }
+
+ public function log($id, $description, $start, $end) {
+ }
+
+ /**
+ * @return \OCP\Diagnostics\IEvent[]
+ */
+ public function getEvents() {
+ return array();
+ }
+}
diff --git a/lib/private/diagnostics/nullquerylogger.php b/lib/private/diagnostics/nullquerylogger.php
new file mode 100644
index 00000000000..8467b4dd26c
--- /dev/null
+++ b/lib/private/diagnostics/nullquerylogger.php
@@ -0,0 +1,31 @@
+<?php
+/**
+ * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC\Diagnostics;
+
+use OCP\Diagnostics\IQueryLogger;
+
+class NullQueryLogger implements IQueryLogger {
+ /**
+ * @param string $sql
+ * @param array $params
+ * @param array $types
+ */
+ public function startQuery($sql, array $params = null, array $types = null) {
+ }
+
+ public function stopQuery() {
+ }
+
+ /**
+ * @return \OCP\Diagnostics\IQuery[]
+ */
+ public function getQueries() {
+ return array();
+ }
+}
diff --git a/lib/private/diagnostics/query.php b/lib/private/diagnostics/query.php
new file mode 100644
index 00000000000..d50d7592636
--- /dev/null
+++ b/lib/private/diagnostics/query.php
@@ -0,0 +1,57 @@
+<?php
+/**
+ * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC\Diagnostics;
+
+use OCP\Diagnostics\IQuery;
+
+class Query implements IQuery {
+ private $sql;
+
+ private $params;
+
+ private $start;
+
+ private $end;
+
+ /**
+ * @param string $sql
+ * @param array $params
+ * @param int $start
+ */
+ public function __construct($sql, $params, $start) {
+ $this->sql = $sql;
+ $this->params = $params;
+ $this->start = $start;
+ }
+
+ public function end($time) {
+ $this->end = $time;
+ }
+
+ /**
+ * @return array
+ */
+ public function getParams() {
+ return $this->params;
+ }
+
+ /**
+ * @return string
+ */
+ public function getSql() {
+ return $this->sql;
+ }
+
+ /**
+ * @return int
+ */
+ public function getDuration() {
+ return $this->end - $this->start;
+ }
+}
diff --git a/lib/private/diagnostics/querylogger.php b/lib/private/diagnostics/querylogger.php
new file mode 100644
index 00000000000..1f80f907173
--- /dev/null
+++ b/lib/private/diagnostics/querylogger.php
@@ -0,0 +1,47 @@
+<?php
+/**
+ * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC\Diagnostics;
+
+use OCP\Diagnostics\IQueryLogger;
+
+class QueryLogger implements IQueryLogger {
+ /**
+ * @var \OC\Diagnostics\Query
+ */
+ protected $activeQuery;
+
+ /**
+ * @var \OC\Diagnostics\Query[]
+ */
+ protected $queries = array();
+
+ /**
+ * @param string $sql
+ * @param array $params
+ * @param array $types
+ */
+ public function startQuery($sql, array $params = null, array $types = null) {
+ $this->activeQuery = new Query($sql, $params, microtime(true));
+ }
+
+ public function stopQuery() {
+ if ($this->activeQuery) {
+ $this->activeQuery->end(microtime(true));
+ $this->queries[] = $this->activeQuery;
+ $this->activeQuery = null;
+ }
+ }
+
+ /**
+ * @return \OCP\Diagnostics\IQuery[]
+ */
+ public function getQueries() {
+ return $this->queries;
+ }
+}
diff --git a/lib/private/route/router.php b/lib/private/route/router.php
index aa3d05dcb85..645d6141964 100644
--- a/lib/private/route/router.php
+++ b/lib/private/route/router.php
@@ -106,6 +106,7 @@ class Router implements IRouter {
* @return void
*/
public function loadRoutes($app = null) {
+ $requestedApp = $app;
if ($this->loaded) {
return;
}
@@ -123,6 +124,7 @@ class Router implements IRouter {
$routingFiles = array();
}
}
+ \OC::$server->getEventLogger()->start('loadroutes' . $requestedApp, 'Loading Routes');
foreach ($routingFiles as $app => $file) {
if (!isset($this->loadedApps[$app])) {
$this->loadedApps[$app] = true;
@@ -145,6 +147,7 @@ class Router implements IRouter {
$collection->addPrefix('/ocs');
$this->root->addCollection($collection);
}
+ \OC::$server->getEventLogger()->end('loadroutes' . $requestedApp);
}
/**
@@ -236,6 +239,7 @@ class Router implements IRouter {
}
}
+ \OC::$server->getEventLogger()->start('run_route', 'Run route');
if (isset($parameters['action'])) {
$action = $parameters['action'];
if (!is_callable($action)) {
@@ -249,6 +253,7 @@ class Router implements IRouter {
} else {
throw new \Exception('no action available');
}
+ \OC::$server->getEventLogger()->end('run_route');
}
/**
diff --git a/lib/private/server.php b/lib/private/server.php
index d2728d2b6ef..f7ffee484ea 100644
--- a/lib/private/server.php
+++ b/lib/private/server.php
@@ -6,12 +6,16 @@ use OC\AppFramework\Http\Request;
use OC\AppFramework\Db\Db;
use OC\AppFramework\Utility\SimpleContainer;
use OC\Cache\UserCache;
+use OC\Diagnostics\NullQueryLogger;
+use OC\Diagnostics\EventLogger;
+use OC\Diagnostics\QueryLogger;
use OC\Security\CertificateManager;
use OC\DB\ConnectionWrapper;
use OC\Files\Node\Root;
use OC\Files\View;
use OC\Security\Crypto;
use OC\Security\SecureRandom;
+use OC\Diagnostics\NullEventLogger;
use OCP\IServerContainer;
use OCP\ISession;
use OC\Tagging\TagMapper;
@@ -24,7 +28,6 @@ use OC\Tagging\TagMapper;
* TODO: hookup all manager classes
*/
class Server extends SimpleContainer implements IServerContainer {
-
function __construct() {
$this->registerService('ContactsManager', function ($c) {
return new ContactsManager();
@@ -59,8 +62,8 @@ class Server extends SimpleContainer implements IServerContainer {
'env' => $_ENV,
'cookies' => $_COOKIE,
'method' => (isset($_SERVER) && isset($_SERVER['REQUEST_METHOD']))
- ? $_SERVER['REQUEST_METHOD']
- : null,
+ ? $_SERVER['REQUEST_METHOD']
+ : null,
'urlParams' => $urlParams,
'requesttoken' => $requestToken,
), $stream
@@ -208,10 +211,10 @@ class Server extends SimpleContainer implements IServerContainer {
$this->registerService('Search', function ($c) {
return new Search();
});
- $this->registerService('SecureRandom', function($c) {
+ $this->registerService('SecureRandom', function ($c) {
return new SecureRandom();
});
- $this->registerService('Crypto', function($c) {
+ $this->registerService('Crypto', function ($c) {
return new Crypto(\OC::$server->getConfig(), \OC::$server->getSecureRandom());
});
$this->registerService('Db', function ($c) {
@@ -221,6 +224,21 @@ class Server extends SimpleContainer implements IServerContainer {
$config = $c->query('AllConfig');
return new HTTPHelper($config);
});
+ $this->registerService('EventLogger', function ($c) {
+ /** @var Server $c */
+ if (defined('DEBUG') and DEBUG) {
+ return new EventLogger();
+ } else {
+ return new NullEventLogger();
+ }
+ });
+ $this->registerService('QueryLogger', function ($c) {
+ if (defined('DEBUG') and DEBUG) {
+ return new QueryLogger();
+ } else {
+ return new NullQueryLogger();
+ }
+ });
}
/**
@@ -285,7 +303,7 @@ class Server extends SimpleContainer implements IServerContainer {
* @return \OCP\Files\Folder
*/
function getUserFolder($userId = null) {
- if($userId === null) {
+ if ($userId === null) {
$user = $this->getUserSession()->getUser();
if (!$user) {
return null;
@@ -528,6 +546,7 @@ class Server extends SimpleContainer implements IServerContainer {
/**
* Returns an instance of the HTTP helper class
+ *
* @return \OC\HTTPHelper
*/
function getHTTPHelper() {
@@ -559,4 +578,26 @@ class Server extends SimpleContainer implements IServerContainer {
function createEventSource() {
return new \OC_EventSource();
}
+
+ /**
+ * Get the active event logger
+ *
+ * The returned logger only logs data when debug mode is enabled
+ *
+ * @return \OCP\Diagnostics\IEventLogger
+ */
+ function getEventLogger() {
+ return $this->query('EventLogger');
+ }
+
+ /**
+ * Get the active query logger
+ *
+ * The returned logger only logs data when debug mode is enabled
+ *
+ * @return \OCP\Diagnostics\IQueryLogger
+ */
+ function getQueryLogger() {
+ return $this->query('QueryLogger');
+ }
}
diff --git a/lib/private/share/share.php b/lib/private/share/share.php
index b827b84a9bc..48b1a531621 100644
--- a/lib/private/share/share.php
+++ b/lib/private/share/share.php
@@ -1781,12 +1781,12 @@ class Share extends \OC\Share\Constants {
} elseif(!$sourceExists && !$isGroupShare) {
- $itemTarget = Helper::generateTarget($itemType, $itemSource, self::SHARE_TYPE_USER, $user,
+ $itemTarget = Helper::generateTarget($itemType, $itemSource, $shareType, $user,
$uidOwner, $suggestedItemTarget, $parent);
if (isset($fileSource)) {
if ($parentFolder) {
if ($parentFolder === true) {
- $fileTarget = Helper::generateTarget('file', $filePath, self::SHARE_TYPE_USER, $user,
+ $fileTarget = Helper::generateTarget('file', $filePath, $shareType, $user,
$uidOwner, $suggestedFileTarget, $parent);
if ($fileTarget != $groupFileTarget) {
$parentFolders[$user]['folder'] = $fileTarget;
@@ -1796,7 +1796,7 @@ class Share extends \OC\Share\Constants {
$parent = $parentFolder[$user]['id'];
}
} else {
- $fileTarget = Helper::generateTarget('file', $filePath, self::SHARE_TYPE_USER,
+ $fileTarget = Helper::generateTarget('file', $filePath, $shareType,
$user, $uidOwner, $suggestedFileTarget, $parent);
}
} else {
diff --git a/lib/private/util.php b/lib/private/util.php
index d6515872c5a..858138f58fe 100755
--- a/lib/private/util.php
+++ b/lib/private/util.php
@@ -64,6 +64,8 @@ class OC_Util {
return false;
}
+ \OC::$server->getEventLogger()->start('setup_fs', 'Setup filesystem');
+
// If we are not forced to load a specific user we load the one that is logged in
if ($user == "" && OC_User::isLoggedIn()) {
$user = OC_User::getUser();
@@ -88,6 +90,7 @@ class OC_Util {
}
if ($user != '' && !OCP\User::userExists($user)) {
+ \OC::$server->getEventLogger()->end('setup_fs');
return false;
}
@@ -128,6 +131,7 @@ class OC_Util {
OC_Hook::emit('OC_Filesystem', 'setup', array('user' => $user, 'user_dir' => $userDir));
}
+ \OC::$server->getEventLogger()->end('setup_fs');
return true;
}
diff --git a/lib/public/diagnostics/ievent.php b/lib/public/diagnostics/ievent.php
new file mode 100644
index 00000000000..a2a3461f68a
--- /dev/null
+++ b/lib/public/diagnostics/ievent.php
@@ -0,0 +1,36 @@
+<?php
+/**
+ * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OCP\Diagnostics;
+
+interface IEvent {
+ /**
+ * @return string
+ */
+ public function getId();
+
+ /**
+ * @return string
+ */
+ public function getDescription();
+
+ /**
+ * @return float
+ */
+ public function getStart();
+
+ /**
+ * @return float
+ */
+ public function getEnd();
+
+ /**
+ * @return float
+ */
+ public function getDuration();
+}
diff --git a/lib/public/diagnostics/ieventlogger.php b/lib/public/diagnostics/ieventlogger.php
new file mode 100644
index 00000000000..cd9f2768ca3
--- /dev/null
+++ b/lib/public/diagnostics/ieventlogger.php
@@ -0,0 +1,39 @@
+<?php
+/**
+ * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OCP\Diagnostics;
+
+interface IEventLogger {
+ /**
+ * Mark the start of an event
+ *
+ * @param string $id
+ * @param string $description
+ */
+ public function start($id, $description);
+
+ /**
+ * Mark the end of an event
+ *
+ * @param string $id
+ */
+ public function end($id);
+
+ /**
+ * @param string $id
+ * @param string $description
+ * @param float $start
+ * @param float $end
+ */
+ public function log($id, $description, $start, $end);
+
+ /**
+ * @return \OCP\Diagnostics\IEvent[]
+ */
+ public function getEvents();
+}
diff --git a/lib/public/diagnostics/iquery.php b/lib/public/diagnostics/iquery.php
new file mode 100644
index 00000000000..f1111e069bb
--- /dev/null
+++ b/lib/public/diagnostics/iquery.php
@@ -0,0 +1,26 @@
+<?php
+/**
+ * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OCP\Diagnostics;
+
+interface IQuery {
+ /**
+ * @return string
+ */
+ public function getSql();
+
+ /**
+ * @return array
+ */
+ public function getParams();
+
+ /**
+ * @return float
+ */
+ public function getDuration();
+}
diff --git a/lib/public/diagnostics/iquerylogger.php b/lib/public/diagnostics/iquerylogger.php
new file mode 100644
index 00000000000..0fba9eb8b10
--- /dev/null
+++ b/lib/public/diagnostics/iquerylogger.php
@@ -0,0 +1,27 @@
+<?php
+/**
+ * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OCP\Diagnostics;
+
+use Doctrine\DBAL\Logging\SQLLogger;
+
+interface IQueryLogger extends SQLLogger {
+ /**
+ * @param string $sql
+ * @param array $params
+ * @param array $types
+ */
+ public function startQuery($sql, array $params = null, array $types = null);
+
+ public function stopQuery();
+
+ /**
+ * @return \OCP\Diagnostics\IQuery[]
+ */
+ public function getQueries();
+}
diff --git a/lib/public/iservercontainer.php b/lib/public/iservercontainer.php
index a093ff3a640..55c2c89b710 100644
--- a/lib/public/iservercontainer.php
+++ b/lib/public/iservercontainer.php
@@ -248,4 +248,20 @@ interface IServerContainer {
* @return \OC\HTTPHelper
*/
function getHTTPHelper();
+
+ /**
+ * Get the active event logger
+ *
+ * @return \OCP\Diagnostics\IEventLogger
+ */
+ function getEventLogger();
+
+ /**
+ * Get the active query logger
+ *
+ * The returned logger only logs data when debug mode is enabled
+ *
+ * @return \OCP\Diagnostics\IQueryLogger
+ */
+ function getQueryLogger();
}
diff --git a/settings/l10n/cs_CZ.php b/settings/l10n/cs_CZ.php
index 31189dc4633..44d3141eda1 100644
--- a/settings/l10n/cs_CZ.php
+++ b/settings/l10n/cs_CZ.php
@@ -137,7 +137,7 @@ $TRANSLATIONS = array(
"Security" => "Zabezpečení",
"Enforce HTTPS" => "Vynutit HTTPS",
"Forces the clients to connect to %s via an encrypted connection." => "Vynutí připojování klientů k %s šifrovaným spojením.",
-"Please connect to your %s via HTTPS to enable or disable the SSL enforcement." => "Připojte se k %s skrze HTTPS pro povolení nebo zakázání vynucování SSL.",
+"Please connect to your %s via HTTPS to enable or disable the SSL enforcement." => "Připojte se k %s přes HTTPS pro povolení nebo zakázání vynucení SSL.",
"Email Server" => "E-mailový server",
"This is used for sending out notifications." => "Toto se používá pro odesílání upozornění.",
"Send mode" => "Mód odesílání",