Skip to content

Commit

Permalink
DOWN-444: Remove test for large files
Browse files Browse the repository at this point in the history
  • Loading branch information
billtomczak committed Jun 6, 2023
1 parent 4a2b95e commit 05ccc23
Show file tree
Hide file tree
Showing 10 changed files with 2 additions and 44 deletions.
1 change: 0 additions & 1 deletion src/site/language/de-DE/de-DE.com_osdownloads.ini
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ COM_OSDOWNLOADS_ERROR_CATEGORY_NOT_FOUND = "Kategorie %s nicht gefunden (%s)"
COM_OSDOWNLOADS_ERROR_DOWNLOAD_DENIED = "Sie haben keine Download-Berechtigung für diese Datei"
COM_OSDOWNLOADS_ERROR_DOWNLOAD_NOT_AVAILABLE = "Dieser Download ist nicht verfügbar"
COM_OSDOWNLOADS_ERROR_DOWNLOAD_SERVER_ERROR = "The download server reported an error (%s)"
COM_OSDOWNLOADS_ERROR_DOWNLOAD_TOO_BIG = "This download is too large"
COM_OSDOWNLOADS_ERROR_EXPECTED_DATA_SEGMENT = "Data segment missed. Sorry, can't confirm the email address."
COM_OSDOWNLOADS_ERROR_FILE_NOT_FOUND = "Datei %s nicht gefunden (%s)"
COM_OSDOWNLOADS_ERROR_INVALID_ARGUMENT = "Unbekanntes Eigentum %s::$%s"
Expand Down
1 change: 0 additions & 1 deletion src/site/language/en-GB/en-GB.com_osdownloads.ini
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ COM_OSDOWNLOADS_ERROR_CATEGORY_NOT_FOUND = "Category %s not found (%s)"
COM_OSDOWNLOADS_ERROR_DOWNLOAD_DENIED = "Sorry, you are not allowed to download this file"
COM_OSDOWNLOADS_ERROR_DOWNLOAD_NOT_AVAILABLE = "This download isn't available"
COM_OSDOWNLOADS_ERROR_DOWNLOAD_SERVER_ERROR = "The download server reported an error (%s)"
COM_OSDOWNLOADS_ERROR_DOWNLOAD_TOO_BIG = "This download is too large"
COM_OSDOWNLOADS_ERROR_EXPECTED_DATA_SEGMENT = "Data segment missed. Sorry, can't confirm the email address."
COM_OSDOWNLOADS_ERROR_FILE_NOT_FOUND = "File %s not found (%s)"
COM_OSDOWNLOADS_ERROR_INVALID_ARGUMENT = "Unknown property %s::$%s"
Expand Down
1 change: 0 additions & 1 deletion src/site/language/es-ES/es-ES.com_osdownloads.ini
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ COM_OSDOWNLOADS_ERROR_CATEGORY_NOT_FOUND = "La categoría %s no se encuentra (%s
COM_OSDOWNLOADS_ERROR_DOWNLOAD_DENIED = "Disculpe, usted no está autorizado para descargar este archivo"
COM_OSDOWNLOADS_ERROR_DOWNLOAD_NOT_AVAILABLE = "Esta descarga no está disponible"
COM_OSDOWNLOADS_ERROR_DOWNLOAD_SERVER_ERROR = "El servidor de descarga reporta un error (%s)"
COM_OSDOWNLOADS_ERROR_DOWNLOAD_TOO_BIG = "Esta descarga es muy grande"
COM_OSDOWNLOADS_ERROR_EXPECTED_DATA_SEGMENT = "Envió de datos perdidos. Disculpe, no podemos confirmar su Email."
COM_OSDOWNLOADS_ERROR_FILE_NOT_FOUND = "El archivo %s no se encuentra (%s)"
COM_OSDOWNLOADS_ERROR_INVALID_ARGUMENT = "propiedad desconocida %s::$%s"
Expand Down
1 change: 0 additions & 1 deletion src/site/language/fa-IR/fa-IR.com_osdownloads.ini
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ COM_OSDOWNLOADS_ERROR_CATEGORY_NOT_FOUND = "Category %s not found (%s)"
COM_OSDOWNLOADS_ERROR_DOWNLOAD_DENIED = "متاسفانه ، شما مجاز به دانلود این فایل نیستید"
COM_OSDOWNLOADS_ERROR_DOWNLOAD_NOT_AVAILABLE = "این دانلود در دسترس نیست"
COM_OSDOWNLOADS_ERROR_DOWNLOAD_SERVER_ERROR = "The download server reported an error (%s)"
COM_OSDOWNLOADS_ERROR_DOWNLOAD_TOO_BIG = "This download is too large"
COM_OSDOWNLOADS_ERROR_EXPECTED_DATA_SEGMENT = "Data segment missed. Sorry, can't confirm the email address."
COM_OSDOWNLOADS_ERROR_FILE_NOT_FOUND = "File %s not found (%s)"
COM_OSDOWNLOADS_ERROR_INVALID_ARGUMENT = "دارایی نامعلوم %s%$::s"
Expand Down
1 change: 0 additions & 1 deletion src/site/language/fr-FR/fr-FR.com_osdownloads.ini
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ COM_OSDOWNLOADS_ERROR_CATEGORY_NOT_FOUND = "Catégorie %s non trouvée (%s)"
COM_OSDOWNLOADS_ERROR_DOWNLOAD_DENIED = "Désolé, vous n'êtes pas autorisé à télécharger ce fichier"
COM_OSDOWNLOADS_ERROR_DOWNLOAD_NOT_AVAILABLE = "Ce téléchargement n'est pas disponible"
COM_OSDOWNLOADS_ERROR_DOWNLOAD_SERVER_ERROR = "Le serveur de téléchargement a signalé une erreur (%s)"
COM_OSDOWNLOADS_ERROR_DOWNLOAD_TOO_BIG = "Ce téléchargement est trop grand"
COM_OSDOWNLOADS_ERROR_EXPECTED_DATA_SEGMENT = "Segment de données manquant. Désolé, impossible de confirmer l’adresse électronique."
COM_OSDOWNLOADS_ERROR_FILE_NOT_FOUND = "Fichier %s non trouvé (%s)"
COM_OSDOWNLOADS_ERROR_INVALID_ARGUMENT = "Classe de propriété %s::$%s"
Expand Down
1 change: 0 additions & 1 deletion src/site/language/it-IT/it-IT.com_osdownloads.ini
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ COM_OSDOWNLOADS_ERROR_CATEGORY_NOT_FOUND = "Categoria %s non trovata (%s)"
COM_OSDOWNLOADS_ERROR_DOWNLOAD_DENIED = "Mi dispiace, non sei autorizzato a scaricare questo file"
COM_OSDOWNLOADS_ERROR_DOWNLOAD_NOT_AVAILABLE = "Questo download non è disponibile"
COM_OSDOWNLOADS_ERROR_DOWNLOAD_SERVER_ERROR = "Il server a rilevato un errore (%s)"
COM_OSDOWNLOADS_ERROR_DOWNLOAD_TOO_BIG = "Questo download è troppo consistente"
COM_OSDOWNLOADS_ERROR_EXPECTED_DATA_SEGMENT = "Sezione di dati persa. Mi dispiace, non è possibile confermare l'indirizzo email."
COM_OSDOWNLOADS_ERROR_FILE_NOT_FOUND = "File %s non trovato (%s)"
COM_OSDOWNLOADS_ERROR_INVALID_ARGUMENT = "Proprietà sconosciuta %s::$%s"
Expand Down
1 change: 0 additions & 1 deletion src/site/language/nl-NL/nl-NL.com_osdownloads.ini
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ COM_OSDOWNLOADS_ERROR_CATEGORY_NOT_FOUND = "Categorie %s niet gevonden (%s)"
COM_OSDOWNLOADS_ERROR_DOWNLOAD_DENIED = "Sorry, u mag dit bestand niet downloaden"
COM_OSDOWNLOADS_ERROR_DOWNLOAD_NOT_AVAILABLE = "Deze download is niet beschikbaar"
COM_OSDOWNLOADS_ERROR_DOWNLOAD_SERVER_ERROR = "De download server heeft een fout gemeld (%s)"
COM_OSDOWNLOADS_ERROR_DOWNLOAD_TOO_BIG = "Deze download is te groot"
COM_OSDOWNLOADS_ERROR_EXPECTED_DATA_SEGMENT = "Gegevenssegment gemist. Sorry, kan het Emailadres niet bevestigen."
COM_OSDOWNLOADS_ERROR_FILE_NOT_FOUND = "Bestand %s niet gevonden (%s)"
COM_OSDOWNLOADS_ERROR_INVALID_ARGUMENT = "Onbekend eigendom %s::$%s"
Expand Down
1 change: 0 additions & 1 deletion src/site/language/pt-BR/pt-BR.com_osdownloads.ini
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ COM_OSDOWNLOADS_ERROR_CATEGORY_NOT_FOUND = "Categoria %s não encontrada (%s)"
COM_OSDOWNLOADS_ERROR_DOWNLOAD_DENIED = "Desculpe, você não tem permissão para fazer o download deste arquivo"
COM_OSDOWNLOADS_ERROR_DOWNLOAD_NOT_AVAILABLE = "Este download não está disponível"
COM_OSDOWNLOADS_ERROR_DOWNLOAD_SERVER_ERROR = "O servidor do download apresentou um erro (%s)"
COM_OSDOWNLOADS_ERROR_DOWNLOAD_TOO_BIG = "Esse download é muito grande"
COM_OSDOWNLOADS_ERROR_EXPECTED_DATA_SEGMENT = "O segmento de dados foi perdido. Desculpe, não consegui confirmar o endereço de email."
COM_OSDOWNLOADS_ERROR_FILE_NOT_FOUND = "Arquivo %s não encontrado (%s)"
COM_OSDOWNLOADS_ERROR_INVALID_ARGUMENT = "Propriedade desconhecida %s::$%s"
Expand Down
1 change: 0 additions & 1 deletion src/site/language/sl-SI/sl-SI.com_osdownloads.ini
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ COM_OSDOWNLOADS_ERROR_CATEGORY_NOT_FOUND = "Kategorije %s ni mogoče najti (%s)"
COM_OSDOWNLOADS_ERROR_DOWNLOAD_DENIED = "Oprostite, nimate dovoljenja za prenos datoteke"
COM_OSDOWNLOADS_ERROR_DOWNLOAD_NOT_AVAILABLE = "Ta prenos ni na voljo"
COM_OSDOWNLOADS_ERROR_DOWNLOAD_SERVER_ERROR = "Strežnik za prenos je sporočil napako (%s)"
COM_OSDOWNLOADS_ERROR_DOWNLOAD_TOO_BIG = "Ta prenos je prevelik"
COM_OSDOWNLOADS_ERROR_EXPECTED_DATA_SEGMENT = "Podatkovni segment je zgrešen. Žal ne morem potrditi e-poštnega naslova."
COM_OSDOWNLOADS_ERROR_FILE_NOT_FOUND = "Datoteke %s ni mogoče najti (%s)"
COM_OSDOWNLOADS_ERROR_INVALID_ARGUMENT = "Neznana lastnina %s::$%s"
Expand Down
37 changes: 2 additions & 35 deletions src/site/views/download/view.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,8 @@ public function display($tpl = null)

$this->contentType = File::getContentTypeFromFileName($this->fileFullPath);

if ($this->checkMemory()) {
$model->incrementDownloadCount($id);
parent::display($tpl);

return;
}

$this->displayError(Text::_('COM_OSDOWNLOADS_ERROR_DOWNLOAD_TOO_BIG'));
$model->incrementDownloadCount($id);
parent::display($tpl);
}

/**
Expand All @@ -141,31 +135,4 @@ protected function displayError($message)
$this->setLayout('error');
parent::display();
}

/**
* Try to make sure there is enough memory in the case of large files.
* If the file is too large, a zero-length file gets saved.
*
* @TODO: See if this is required for remote files
*
* @return bool
*/
protected function checkMemory(): bool
{
if ($this->fileSize) {
$memoryLimit = ini_get('memory_limit');
if (preg_match('/(\d+)([a-z])/i', $memoryLimit, $memory)) {
$memory = $memory[1] * pow(2, stripos('-KMG', $memory[2]) * 10);
} else {
$memory = (int)ini_get('memory_limit');
}

if ($this->fileSize > $memory) {
ini_set('memory_limit', -1);
return (ini_get('memory_limit') == -1);
}
}

return true;
}
}

0 comments on commit 05ccc23

Please sign in to comment.