summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2017-02-12 13:34:56 -0500
committerFrederic Guillot <fred@kanboard.net>2017-02-12 13:34:56 -0500
commit991f7426e8ec2a566ad82043b22ce844a5a1cfa1 (patch)
treea0ff32313ad511ebdd9ea71180c86aa5b0002204 /app
parenta172e3ad8d25e9b77616107ce8a622175ab0d698 (diff)
Improve error reporting when file upload is not configured properly
Diffstat (limited to 'app')
-rw-r--r--app/Controller/AvatarFileController.php2
-rw-r--r--app/Controller/ProjectFileController.php17
-rw-r--r--app/Controller/TaskFileController.php17
-rw-r--r--app/Locale/bs_BA/translations.php2
-rw-r--r--app/Locale/cs_CZ/translations.php2
-rw-r--r--app/Locale/da_DK/translations.php2
-rw-r--r--app/Locale/de_DE/translations.php2
-rw-r--r--app/Locale/el_GR/translations.php2
-rw-r--r--app/Locale/es_ES/translations.php2
-rw-r--r--app/Locale/fi_FI/translations.php2
-rw-r--r--app/Locale/fr_FR/translations.php2
-rw-r--r--app/Locale/hu_HU/translations.php2
-rw-r--r--app/Locale/id_ID/translations.php2
-rw-r--r--app/Locale/it_IT/translations.php2
-rw-r--r--app/Locale/ja_JP/translations.php2
-rw-r--r--app/Locale/ko_KR/translations.php2
-rw-r--r--app/Locale/my_MY/translations.php2
-rw-r--r--app/Locale/nb_NO/translations.php2
-rw-r--r--app/Locale/nl_NL/translations.php2
-rw-r--r--app/Locale/pl_PL/translations.php2
-rw-r--r--app/Locale/pt_BR/translations.php2
-rw-r--r--app/Locale/pt_PT/translations.php2
-rw-r--r--app/Locale/ru_RU/translations.php2
-rw-r--r--app/Locale/sr_Latn_RS/translations.php2
-rw-r--r--app/Locale/sv_SE/translations.php2
-rw-r--r--app/Locale/th_TH/translations.php2
-rw-r--r--app/Locale/tr_TR/translations.php2
-rw-r--r--app/Locale/zh_CN/translations.php2
-rw-r--r--app/ServiceProvider/ClassProvider.php5
-rw-r--r--app/ServiceProvider/ObjectStorageProvider.php51
-rw-r--r--app/common.php1
31 files changed, 104 insertions, 39 deletions
diff --git a/app/Controller/AvatarFileController.php b/app/Controller/AvatarFileController.php
index 6879c577..2a63c5ae 100644
--- a/app/Controller/AvatarFileController.php
+++ b/app/Controller/AvatarFileController.php
@@ -33,7 +33,7 @@ class AvatarFileController extends BaseController
$user = $this->getUser();
if (! $this->avatarFileModel->uploadImageFile($user['id'], $this->request->getFileInfo('avatar'))) {
- $this->flash->failure(t('Unable to upload the file.'));
+ $this->flash->failure(t('Unable to upload files, check the permissions of your data folder.'));
}
$this->response->redirect($this->helper->url->to('AvatarFileController', 'show', array('user_id' => $user['id'])));
diff --git a/app/Controller/ProjectFileController.php b/app/Controller/ProjectFileController.php
index 9c38f684..83c7779f 100644
--- a/app/Controller/ProjectFileController.php
+++ b/app/Controller/ProjectFileController.php
@@ -33,12 +33,21 @@ class ProjectFileController extends BaseController
public function save()
{
$project = $this->getProject();
+ $result = $this->projectFileModel->uploadFiles($project['id'], $this->request->getFileInfo('files'));
- if (! $this->projectFileModel->uploadFiles($project['id'], $this->request->getFileInfo('files'))) {
- $this->flash->failure(t('Unable to upload the file.'));
- }
+ if ($this->request->isAjax()) {
+ if (! $result) {
+ $this->response->json(array('message' => t('Unable to upload files, check the permissions of your data folder.')), 500);
+ } else {
+ $this->response->json(array('message' => 'OK'));
+ }
+ } else {
+ if (! $result) {
+ $this->flash->failure(t('Unable to upload files, check the permissions of your data folder.'));
+ }
- $this->response->redirect($this->helper->url->to('ProjectOverviewController', 'show', array('project_id' => $project['id'])), true);
+ $this->response->redirect($this->helper->url->to('ProjectOverviewController', 'show', array('project_id' => $project['id'])), true);
+ }
}
/**
diff --git a/app/Controller/TaskFileController.php b/app/Controller/TaskFileController.php
index 8a0971e4..ff0c299e 100644
--- a/app/Controller/TaskFileController.php
+++ b/app/Controller/TaskFileController.php
@@ -52,12 +52,21 @@ class TaskFileController extends BaseController
public function save()
{
$task = $this->getTask();
+ $result = $this->taskFileModel->uploadFiles($task['id'], $this->request->getFileInfo('files'));
- if (! $this->taskFileModel->uploadFiles($task['id'], $this->request->getFileInfo('files'))) {
- $this->flash->failure(t('Unable to upload the file.'));
- }
+ if ($this->request->isAjax()) {
+ if (! $result) {
+ $this->response->json(array('message' => t('Unable to upload files, check the permissions of your data folder.')), 500);
+ } else {
+ $this->response->json(array('message' => 'OK'));
+ }
+ } else {
+ if (! $result) {
+ $this->flash->failure(t('Unable to upload files, check the permissions of your data folder.'));
+ }
- $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true);
+ $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true);
+ }
}
/**
diff --git a/app/Locale/bs_BA/translations.php b/app/Locale/bs_BA/translations.php
index 62881552..6518d917 100644
--- a/app/Locale/bs_BA/translations.php
+++ b/app/Locale/bs_BA/translations.php
@@ -282,7 +282,6 @@ return array(
'Unable to create your sub-task.' => 'Nemoguće dodati pod-zadatak.',
'Sub-task added successfully.' => 'Pod-zadatak uspješno dodan.',
'Maximum size: ' => 'Maksimalna veličina: ',
- 'Unable to upload the file.' => 'Nije moguće snimiti fajl.',
'Display another project' => 'Prikaži drugi projekat',
'Created by %s' => 'Kreirao %s',
'Tasks Export' => 'Izvoz zadataka',
@@ -1312,4 +1311,5 @@ return array(
// 'Do you really want to reopen this project: "%s"?' => '',
// 'This project is open' => '',
// 'This project is closed' => '',
+ // 'Unable to upload files, check the permissions of your data folder.' => '',
);
diff --git a/app/Locale/cs_CZ/translations.php b/app/Locale/cs_CZ/translations.php
index 823410b5..eb991bb5 100644
--- a/app/Locale/cs_CZ/translations.php
+++ b/app/Locale/cs_CZ/translations.php
@@ -282,7 +282,6 @@ return array(
'Unable to create your sub-task.' => 'Nelze vytvořit dílčí úkol.',
'Sub-task added successfully.' => 'Dílčí úkol byl úspěšně přidán.',
'Maximum size: ' => 'Maximální velikost: ',
- 'Unable to upload the file.' => 'Soubor nelze nahrát.',
'Display another project' => 'Zobrazit jiný projekt',
'Created by %s' => 'Vytvořeno uživatelem %s',
'Tasks Export' => 'Export úkolů',
@@ -1312,4 +1311,5 @@ return array(
// 'Do you really want to reopen this project: "%s"?' => '',
// 'This project is open' => '',
// 'This project is closed' => '',
+ // 'Unable to upload files, check the permissions of your data folder.' => '',
);
diff --git a/app/Locale/da_DK/translations.php b/app/Locale/da_DK/translations.php
index 92f41d1e..02797797 100644
--- a/app/Locale/da_DK/translations.php
+++ b/app/Locale/da_DK/translations.php
@@ -282,7 +282,6 @@ return array(
'Unable to create your sub-task.' => 'Under-opgaven kunne ikke oprettes.',
'Sub-task added successfully.' => 'Under-opgaven er tilføjet.',
'Maximum size: ' => 'Maksimum størrelse: ',
- 'Unable to upload the file.' => 'Filen kunne ikke uploades.',
'Display another project' => 'Vis et andet projekt...',
'Created by %s' => 'Oprettet af %s',
'Tasks Export' => 'Opgave eksport',
@@ -1312,4 +1311,5 @@ return array(
// 'Do you really want to reopen this project: "%s"?' => '',
// 'This project is open' => '',
// 'This project is closed' => '',
+ // 'Unable to upload files, check the permissions of your data folder.' => '',
);
diff --git a/app/Locale/de_DE/translations.php b/app/Locale/de_DE/translations.php
index 7d2e871f..4bcb1f49 100644
--- a/app/Locale/de_DE/translations.php
+++ b/app/Locale/de_DE/translations.php
@@ -282,7 +282,6 @@ return array(
'Unable to create your sub-task.' => 'Erstellen der Teilaufgabe nicht möglich.',
'Sub-task added successfully.' => 'Teilaufgabe erfolgreich angelegt.',
'Maximum size: ' => 'Maximalgröße: ',
- 'Unable to upload the file.' => 'Hochladen der Datei nicht möglich.',
'Display another project' => 'Zu Projekt wechseln',
'Created by %s' => 'Erstellt durch %s',
'Tasks Export' => 'Aufgaben exportieren',
@@ -1312,4 +1311,5 @@ return array(
// 'Do you really want to reopen this project: "%s"?' => '',
// 'This project is open' => '',
// 'This project is closed' => '',
+ // 'Unable to upload files, check the permissions of your data folder.' => '',
);
diff --git a/app/Locale/el_GR/translations.php b/app/Locale/el_GR/translations.php
index 10e1f279..496224c8 100644
--- a/app/Locale/el_GR/translations.php
+++ b/app/Locale/el_GR/translations.php
@@ -282,7 +282,6 @@ return array(
'Unable to create your sub-task.' => 'Αδύνατο να δημιουργηθεί η υπο-εργασία.',
'Sub-task added successfully.' => 'Η υπο-εργασία προστέθηκε με επιτυχία.',
'Maximum size: ' => 'Μέγιστο μέγεθος : ',
- 'Unable to upload the file.' => 'Δεν είναι δυνατή η μεταφόρτωση του αρχείου.',
'Display another project' => 'Εμφάνιση άλλου έργου',
'Created by %s' => 'Δημιουργήθηκε από %s',
'Tasks Export' => 'Εξαγωγή εργασιών',
@@ -1312,4 +1311,5 @@ return array(
// 'Do you really want to reopen this project: "%s"?' => '',
// 'This project is open' => '',
// 'This project is closed' => '',
+ // 'Unable to upload files, check the permissions of your data folder.' => '',
);
diff --git a/app/Locale/es_ES/translations.php b/app/Locale/es_ES/translations.php
index 9db936f9..f6bd60b2 100644
--- a/app/Locale/es_ES/translations.php
+++ b/app/Locale/es_ES/translations.php
@@ -282,7 +282,6 @@ return array(
'Unable to create your sub-task.' => 'No se puede crear la subtarea.',
'Sub-task added successfully.' => 'Subtarea añadida correctamente.',
'Maximum size: ' => 'Tamaño máximo: ',
- 'Unable to upload the file.' => 'No se puede cargar el fichero.',
'Display another project' => 'Mostrar otro proyecto',
'Created by %s' => 'Creado por %s',
'Tasks Export' => 'Exportar tareas',
@@ -1312,4 +1311,5 @@ return array(
// 'Do you really want to reopen this project: "%s"?' => '',
// 'This project is open' => '',
// 'This project is closed' => '',
+ // 'Unable to upload files, check the permissions of your data folder.' => '',
);
diff --git a/app/Locale/fi_FI/translations.php b/app/Locale/fi_FI/translations.php
index 68fb88d5..9f1cdbf8 100644
--- a/app/Locale/fi_FI/translations.php
+++ b/app/Locale/fi_FI/translations.php
@@ -282,7 +282,6 @@ return array(
'Unable to create your sub-task.' => 'Alitehtävän luonti epäonnistui.',
'Sub-task added successfully.' => 'Alitehtävä luotiin onnistuneesti.',
'Maximum size: ' => 'Maksimikoko: ',
- 'Unable to upload the file.' => 'Tiedoston lataus epäonnistui.',
'Display another project' => 'Näytä toinen projekti',
'Created by %s' => 'Luonut: %s',
'Tasks Export' => 'Tehtävien vienti',
@@ -1312,4 +1311,5 @@ return array(
// 'Do you really want to reopen this project: "%s"?' => '',
// 'This project is open' => '',
// 'This project is closed' => '',
+ // 'Unable to upload files, check the permissions of your data folder.' => '',
);
diff --git a/app/Locale/fr_FR/translations.php b/app/Locale/fr_FR/translations.php
index 0c13728c..6bd6ae54 100644
--- a/app/Locale/fr_FR/translations.php
+++ b/app/Locale/fr_FR/translations.php
@@ -282,7 +282,6 @@ return array(
'Unable to create your sub-task.' => 'Impossible de créer votre sous-tâche.',
'Sub-task added successfully.' => 'Sous-tâche ajoutée avec succès.',
'Maximum size: ' => 'Taille maximum : ',
- 'Unable to upload the file.' => 'Impossible de transférer le fichier.',
'Display another project' => 'Afficher un autre projet',
'Created by %s' => 'Créé par %s',
'Tasks Export' => 'Exportation des tâches',
@@ -1312,4 +1311,5 @@ return array(
'Do you really want to reopen this project: "%s"?' => 'Voulez-vous vraiment réouvrir ce projet : « %s » ?',
'This project is open' => 'Ce projet est ouvert',
'This project is closed' => 'Ce projet est fermé',
+ 'Unable to upload files, check the permissions of your data folder.' => 'Impossible de transférer le ou les fichiers, vérifiez les permissions du répertoire de données.',
);
diff --git a/app/Locale/hu_HU/translations.php b/app/Locale/hu_HU/translations.php
index cbf06cfc..b1a78ef2 100644
--- a/app/Locale/hu_HU/translations.php
+++ b/app/Locale/hu_HU/translations.php
@@ -282,7 +282,6 @@ return array(
'Unable to create your sub-task.' => 'Részfeladat létrehozása nem lehetséges.',
'Sub-task added successfully.' => 'Részfeladat sikeresen létrehozva.',
'Maximum size: ' => 'Maximális méret: ',
- 'Unable to upload the file.' => 'Fájl feltöltése nem lehetséges.',
'Display another project' => 'Másik projekt megjelenítése',
'Created by %s' => 'Készítette: %s',
'Tasks Export' => 'Feladatok exportálása',
@@ -1312,4 +1311,5 @@ return array(
// 'Do you really want to reopen this project: "%s"?' => '',
// 'This project is open' => '',
// 'This project is closed' => '',
+ // 'Unable to upload files, check the permissions of your data folder.' => '',
);
diff --git a/app/Locale/id_ID/translations.php b/app/Locale/id_ID/translations.php
index eaf4ce74..620e9b58 100644
--- a/app/Locale/id_ID/translations.php
+++ b/app/Locale/id_ID/translations.php
@@ -282,7 +282,6 @@ return array(
'Unable to create your sub-task.' => 'Tidak dapat membuat sub-tugas Anda.',
'Sub-task added successfully.' => 'Sub-tugas berhasil dibuat.',
'Maximum size: ' => 'Ukuran maksimum: ',
- 'Unable to upload the file.' => 'Tidak dapat mengunggah berkas.',
'Display another project' => 'Lihat proyek lain',
'Created by %s' => 'Dibuat oleh %s',
'Tasks Export' => 'Ekspor Tugas',
@@ -1312,4 +1311,5 @@ return array(
// 'Do you really want to reopen this project: "%s"?' => '',
// 'This project is open' => '',
// 'This project is closed' => '',
+ // 'Unable to upload files, check the permissions of your data folder.' => '',
);
diff --git a/app/Locale/it_IT/translations.php b/app/Locale/it_IT/translations.php
index bd0df667..057034c8 100644
--- a/app/Locale/it_IT/translations.php
+++ b/app/Locale/it_IT/translations.php
@@ -282,7 +282,6 @@ return array(
'Unable to create your sub-task.' => 'Impossibile creare il tuo sotto-task.',
'Sub-task added successfully.' => 'Sotto-task aggiunto con successo.',
'Maximum size: ' => 'Dimensioni massime: ',
- 'Unable to upload the file.' => 'Impossibile caricare il file.',
'Display another project' => 'Mostra un altro progetto',
'Created by %s' => 'Creato da %s',
'Tasks Export' => 'Export dei task',
@@ -1312,4 +1311,5 @@ return array(
// 'Do you really want to reopen this project: "%s"?' => '',
// 'This project is open' => '',
// 'This project is closed' => '',
+ // 'Unable to upload files, check the permissions of your data folder.' => '',
);
diff --git a/app/Locale/ja_JP/translations.php b/app/Locale/ja_JP/translations.php
index 75220f84..7ebb84ef 100644
--- a/app/Locale/ja_JP/translations.php
+++ b/app/Locale/ja_JP/translations.php
@@ -282,7 +282,6 @@ return array(
'Unable to create your sub-task.' => 'サブタスクの追加に失敗しました。',
'Sub-task added successfully.' => 'サブタスクを追加しました。',
'Maximum size: ' => '最大: ',
- 'Unable to upload the file.' => 'ファイルのアップロードに失敗しました。',
'Display another project' => '別のプロジェクトを表示',
'Created by %s' => '%s が作成',
'Tasks Export' => 'タスクの出力',
@@ -1312,4 +1311,5 @@ return array(
// 'Do you really want to reopen this project: "%s"?' => '',
// 'This project is open' => '',
// 'This project is closed' => '',
+ // 'Unable to upload files, check the permissions of your data folder.' => '',
);
diff --git a/app/Locale/ko_KR/translations.php b/app/Locale/ko_KR/translations.php
index effc46b9..c85b06ed 100644
--- a/app/Locale/ko_KR/translations.php
+++ b/app/Locale/ko_KR/translations.php
@@ -282,7 +282,6 @@ return array(
'Unable to create your sub-task.' => '서브 할일의 추가에 실패했습니다.',
'Sub-task added successfully.' => '서브 할일을 추가했습니다.',
'Maximum size: ' => '최대: ',
- 'Unable to upload the file.' => '파일 업로드에 실패했습니다.',
'Display another project' => '프로젝트 보기',
'Created by %s' => '작성자 %s',
'Tasks Export' => '할일 내보내기',
@@ -1312,4 +1311,5 @@ return array(
// 'Do you really want to reopen this project: "%s"?' => '',
// 'This project is open' => '',
// 'This project is closed' => '',
+ // 'Unable to upload files, check the permissions of your data folder.' => '',
);
diff --git a/app/Locale/my_MY/translations.php b/app/Locale/my_MY/translations.php
index 5703d60e..19a4e207 100644
--- a/app/Locale/my_MY/translations.php
+++ b/app/Locale/my_MY/translations.php
@@ -282,7 +282,6 @@ return array(
'Unable to create your sub-task.' => 'Tidak dapat membuat sub-tugas anda.',
'Sub-task added successfully.' => 'Sub-tugas berhasil dibuat.',
'Maximum size: ' => 'Ukuran maksimum: ',
- 'Unable to upload the file.' => 'Tidak dapat mengunggah berkas.',
'Display another project' => 'Lihat projek lain',
'Created by %s' => 'Dibuat oleh %s',
'Tasks Export' => 'Ekspor Tugas',
@@ -1312,4 +1311,5 @@ return array(
// 'Do you really want to reopen this project: "%s"?' => '',
// 'This project is open' => '',
// 'This project is closed' => '',
+ // 'Unable to upload files, check the permissions of your data folder.' => '',
);
diff --git a/app/Locale/nb_NO/translations.php b/app/Locale/nb_NO/translations.php
index df0e3579..858efcc2 100644
--- a/app/Locale/nb_NO/translations.php
+++ b/app/Locale/nb_NO/translations.php
@@ -282,7 +282,6 @@ return array(
'Unable to create your sub-task.' => 'Deloppgaven kunne ikke oprettes.',
'Sub-task added successfully.' => 'Deloppgaven er lagt til.',
'Maximum size: ' => 'Maksimum størrelse: ',
- 'Unable to upload the file.' => 'Filen kunne ikke lastes opp.',
'Display another project' => 'Vis annet prosjekt...',
'Created by %s' => 'Opprettet av %s',
'Tasks Export' => 'Oppgave eksport',
@@ -1312,4 +1311,5 @@ return array(
// 'Do you really want to reopen this project: "%s"?' => '',
// 'This project is open' => '',
// 'This project is closed' => '',
+ // 'Unable to upload files, check the permissions of your data folder.' => '',
);
diff --git a/app/Locale/nl_NL/translations.php b/app/Locale/nl_NL/translations.php
index 0ecd03d2..0a68c20f 100644
--- a/app/Locale/nl_NL/translations.php
+++ b/app/Locale/nl_NL/translations.php
@@ -282,7 +282,6 @@ return array(
'Unable to create your sub-task.' => 'Subtaak aanmaken niet gelukt.',
'Sub-task added successfully.' => 'Subtaak succesvol aangemaakt.',
'Maximum size: ' => 'Maximale grootte : ',
- 'Unable to upload the file.' => 'Uploaden van bestand niet gelukt.',
'Display another project' => 'Een ander project weergeven',
'Created by %s' => 'Aangemaakt door %s',
'Tasks Export' => 'Taken exporteren',
@@ -1312,4 +1311,5 @@ return array(
// 'Do you really want to reopen this project: "%s"?' => '',
// 'This project is open' => '',
// 'This project is closed' => '',
+ // 'Unable to upload files, check the permissions of your data folder.' => '',
);
diff --git a/app/Locale/pl_PL/translations.php b/app/Locale/pl_PL/translations.php
index b4443321..b80b8ede 100644
--- a/app/Locale/pl_PL/translations.php
+++ b/app/Locale/pl_PL/translations.php
@@ -282,7 +282,6 @@ return array(
'Unable to create your sub-task.' => 'Nie można utworzyć tego pod-zadania.',
'Sub-task added successfully.' => 'Pod-zadanie utworzone pomyślnie',
'Maximum size: ' => 'Maksymalny rozmiar: ',
- 'Unable to upload the file.' => 'Nie można wczytać pliku.',
'Display another project' => 'Wyświetl inny projekt',
'Created by %s' => 'Utworzone przez %s',
'Tasks Export' => 'Eksport zadań',
@@ -1312,4 +1311,5 @@ return array(
// 'Do you really want to reopen this project: "%s"?' => '',
// 'This project is open' => '',
// 'This project is closed' => '',
+ // 'Unable to upload files, check the permissions of your data folder.' => '',
);
diff --git a/app/Locale/pt_BR/translations.php b/app/Locale/pt_BR/translations.php
index 919c5897..b8bce402 100644
--- a/app/Locale/pt_BR/translations.php
+++ b/app/Locale/pt_BR/translations.php
@@ -282,7 +282,6 @@ return array(
'Unable to create your sub-task.' => 'Não é possível criar a sua subtarefa.',
'Sub-task added successfully.' => 'Subtarefa adicionada com sucesso.',
'Maximum size: ' => 'Tamanho máximo: ',
- 'Unable to upload the file.' => 'Não foi possível carregar o arquivo.',
'Display another project' => 'Exibir outro projeto',
'Created by %s' => 'Criado por %s',
'Tasks Export' => 'Exportar Tarefas',
@@ -1312,4 +1311,5 @@ return array(
// 'Do you really want to reopen this project: "%s"?' => '',
// 'This project is open' => '',
// 'This project is closed' => '',
+ // 'Unable to upload files, check the permissions of your data folder.' => '',
);
diff --git a/app/Locale/pt_PT/translations.php b/app/Locale/pt_PT/translations.php
index 2f5d892f..b4048710 100644
--- a/app/Locale/pt_PT/translations.php
+++ b/app/Locale/pt_PT/translations.php
@@ -282,7 +282,6 @@ return array(
'Unable to create your sub-task.' => 'Não é possível criar a sua subtarefa.',
'Sub-task added successfully.' => 'Subtarefa adicionada com sucesso.',
'Maximum size: ' => 'Tamanho máximo: ',
- 'Unable to upload the file.' => 'Não foi possível carregar o arquivo.',
'Display another project' => 'Mostrar outro projeto',
'Created by %s' => 'Criado por %s',
'Tasks Export' => 'Exportar Tarefas',
@@ -1312,4 +1311,5 @@ return array(
'Do you really want to reopen this project: "%s"?' => 'Deseja mesmo reabrir este projecto?: "%s"?',
'This project is open' => 'Este projeto está aberto',
'This project is closed' => 'Este projecto está fechado',
+ // 'Unable to upload files, check the permissions of your data folder.' => '',
);
diff --git a/app/Locale/ru_RU/translations.php b/app/Locale/ru_RU/translations.php
index 268b9987..1726f8c8 100644
--- a/app/Locale/ru_RU/translations.php
+++ b/app/Locale/ru_RU/translations.php
@@ -282,7 +282,6 @@ return array(
'Unable to create your sub-task.' => 'Не удалось создать подзадачу.',
'Sub-task added successfully.' => 'Подзадача добавлена.',
'Maximum size: ' => 'Максимальный размер: ',
- 'Unable to upload the file.' => 'Не удалось загрузить файл.',
'Display another project' => 'Показать другой проект',
'Created by %s' => 'Создано %s',
'Tasks Export' => 'Экспорт задач',
@@ -1312,4 +1311,5 @@ return array(
// 'Do you really want to reopen this project: "%s"?' => '',
// 'This project is open' => '',
// 'This project is closed' => '',
+ // 'Unable to upload files, check the permissions of your data folder.' => '',
);
diff --git a/app/Locale/sr_Latn_RS/translations.php b/app/Locale/sr_Latn_RS/translations.php
index cf831723..0fc35aac 100644
--- a/app/Locale/sr_Latn_RS/translations.php
+++ b/app/Locale/sr_Latn_RS/translations.php
@@ -282,7 +282,6 @@ return array(
'Unable to create your sub-task.' => 'Nie można utworzyć tego pod-zadania.',
'Sub-task added successfully.' => 'Pod-zadatak utworzone pomyślnie',
'Maximum size: ' => 'Maksimalna veličina: ',
- 'Unable to upload the file.' => 'Nije moguće snimiti fajl.',
'Display another project' => 'Prikaži drugi projekat',
'Created by %s' => 'Kreirao %s',
'Tasks Export' => 'Izvoz zadataka',
@@ -1312,4 +1311,5 @@ return array(
// 'Do you really want to reopen this project: "%s"?' => '',
// 'This project is open' => '',
// 'This project is closed' => '',
+ // 'Unable to upload files, check the permissions of your data folder.' => '',
);
diff --git a/app/Locale/sv_SE/translations.php b/app/Locale/sv_SE/translations.php
index c643c146..562f3808 100644
--- a/app/Locale/sv_SE/translations.php
+++ b/app/Locale/sv_SE/translations.php
@@ -282,7 +282,6 @@ return array(
'Unable to create your sub-task.' => 'Kunde inte skapa din deluppgift.',
'Sub-task added successfully.' => 'Deluppgiften har lagts till.',
'Maximum size: ' => 'Maxstorlek: ',
- 'Unable to upload the file.' => 'Kunde inte ladda upp filen.',
'Display another project' => 'Visa ett annat projekt',
'Created by %s' => 'Skapad av %s',
'Tasks Export' => 'Exportera uppgifter',
@@ -1312,4 +1311,5 @@ return array(
// 'Do you really want to reopen this project: "%s"?' => '',
// 'This project is open' => '',
// 'This project is closed' => '',
+ // 'Unable to upload files, check the permissions of your data folder.' => '',
);
diff --git a/app/Locale/th_TH/translations.php b/app/Locale/th_TH/translations.php
index 883abe48..07177c3b 100644
--- a/app/Locale/th_TH/translations.php
+++ b/app/Locale/th_TH/translations.php
@@ -282,7 +282,6 @@ return array(
'Unable to create your sub-task.' => 'ไม่สามารถสร้างงานย่อยได้',
'Sub-task added successfully.' => 'เพิ่มงานย่อยเรียบร้อยแล้ว',
'Maximum size: ' => 'ขนาดไฟล์สูงสุด:',
- 'Unable to upload the file.' => 'ไม่สามารถอัพโหลดไฟล์ได้',
'Display another project' => 'แสดงโปรเจคอื่น',
'Created by %s' => 'สร้างโดย %s',
'Tasks Export' => 'ส่งออกงาน',
@@ -1312,4 +1311,5 @@ return array(
// 'Do you really want to reopen this project: "%s"?' => '',
// 'This project is open' => '',
// 'This project is closed' => '',
+ // 'Unable to upload files, check the permissions of your data folder.' => '',
);
diff --git a/app/Locale/tr_TR/translations.php b/app/Locale/tr_TR/translations.php
index 183acd4d..1af8d2dd 100644
--- a/app/Locale/tr_TR/translations.php
+++ b/app/Locale/tr_TR/translations.php
@@ -282,7 +282,6 @@ return array(
'Unable to create your sub-task.' => 'Alt görev oluşturulamadı.',
'Sub-task added successfully.' => 'Alt görev başarıyla eklendi.',
'Maximum size: ' => 'Maksimum boyutu',
- 'Unable to upload the file.' => 'Dosya yüklenemiyor.',
'Display another project' => 'Başka bir proje göster',
'Created by %s' => '%s tarafından oluşturuldu',
'Tasks Export' => 'Görevleri dışa aktar',
@@ -1312,4 +1311,5 @@ return array(
// 'Do you really want to reopen this project: "%s"?' => '',
// 'This project is open' => '',
// 'This project is closed' => '',
+ // 'Unable to upload files, check the permissions of your data folder.' => '',
);
diff --git a/app/Locale/zh_CN/translations.php b/app/Locale/zh_CN/translations.php
index 1935a7e8..074231b7 100644
--- a/app/Locale/zh_CN/translations.php
+++ b/app/Locale/zh_CN/translations.php
@@ -282,7 +282,6 @@ return array(
'Unable to create your sub-task.' => '无法创建子任务',
'Sub-task added successfully.' => '成功添加子任务',
'Maximum size: ' => '大小上限:',
- 'Unable to upload the file.' => '无法上传文件',
'Display another project' => '显示其它项目',
'Created by %s' => '创建者:%s',
'Tasks Export' => '任务导出',
@@ -1312,4 +1311,5 @@ return array(
// 'Do you really want to reopen this project: "%s"?' => '',
// 'This project is open' => '',
// 'This project is closed' => '',
+ // 'Unable to upload files, check the permissions of your data folder.' => '',
);
diff --git a/app/ServiceProvider/ClassProvider.php b/app/ServiceProvider/ClassProvider.php
index 50ce531f..d66794df 100644
--- a/app/ServiceProvider/ClassProvider.php
+++ b/app/ServiceProvider/ClassProvider.php
@@ -4,7 +4,6 @@ namespace Kanboard\ServiceProvider;
use Pimple\Container;
use Pimple\ServiceProviderInterface;
-use Kanboard\Core\ObjectStorage\FileStorage;
use Kanboard\Core\Paginator;
use Kanboard\Core\Http\OAuth2;
use Kanboard\Core\Tool;
@@ -178,10 +177,6 @@ class ClassProvider implements ServiceProviderInterface
return new HttpClient($c);
};
- $container['objectStorage'] = function () {
- return new FileStorage(FILES_DIR);
- };
-
$container['cspRules'] = array(
'default-src' => "'self'",
'style-src' => "'self' 'unsafe-inline'",
diff --git a/app/ServiceProvider/ObjectStorageProvider.php b/app/ServiceProvider/ObjectStorageProvider.php
new file mode 100644
index 00000000..a108345f
--- /dev/null
+++ b/app/ServiceProvider/ObjectStorageProvider.php
@@ -0,0 +1,51 @@
+<?php
+
+namespace Kanboard\ServiceProvider;
+
+use Kanboard\Core\ObjectStorage\FileStorage;
+use LogicException;
+use Pimple\Container;
+use Pimple\ServiceProviderInterface;
+
+/**
+ * Class ObjectStorageProvider
+ *
+ * @package Kanboard\ServiceProvider
+ * @author Frederic Guillot
+ */
+class ObjectStorageProvider implements ServiceProviderInterface
+{
+ public function register(Container $container)
+ {
+ $container['objectStorage'] = function () {
+ if (file_exists(FILES_DIR)) {
+ if (! is_writable(FILES_DIR)) {
+ $stat = stat(FILES_DIR);
+
+ throw new LogicException(sprintf(
+ 'The folder to store uploaded files is not writeable by your webserver user (file=%s; mode=%o; uid=%d; gid=%d)',
+ FILES_DIR,
+ $stat['mode'],
+ $stat['uid'],
+ $stat['gid']
+ ));
+ }
+ } elseif (! @mkdir(FILES_DIR)) {
+ $folder = dirname(FILES_DIR);
+ $stat = stat($folder);
+
+ throw new LogicException(sprintf(
+ 'Unable to create folder to store uploaded files, check the permissions of the parent directory (file=%s; mode=%o; uid=%d; gid=%d)',
+ $folder,
+ $stat['mode'],
+ $stat['uid'],
+ $stat['gid']
+ ));
+ }
+
+ return new FileStorage(FILES_DIR);
+ };
+
+ return $container;
+ }
+} \ No newline at end of file
diff --git a/app/common.php b/app/common.php
index fd55c0bb..69c56953 100644
--- a/app/common.php
+++ b/app/common.php
@@ -53,4 +53,5 @@ $container->register(new Kanboard\ServiceProvider\JobProvider());
$container->register(new Kanboard\ServiceProvider\QueueProvider());
$container->register(new Kanboard\ServiceProvider\ApiProvider());
$container->register(new Kanboard\ServiceProvider\CommandProvider());
+$container->register(new Kanboard\ServiceProvider\ObjectStorageProvider());
$container->register(new Kanboard\ServiceProvider\PluginProvider());