diff options
author | ArthurHoaro <arthur@hoa.ro> | 2018-02-28 22:29:43 +0100 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2018-03-07 23:03:21 +0100 |
commit | 4ff3ed1c47365d5b28f70cb2921b0ac0075612c3 (patch) | |
tree | 5e3a1079211080d1af48696cc1f4815dd640f293 /application/Updater.php | |
parent | b70436373b488ce9cd8b0dc287d058b5ca206347 (diff) | |
download | Shaarli-4ff3ed1c47365d5b28f70cb2921b0ac0075612c3.tar.gz Shaarli-4ff3ed1c47365d5b28f70cb2921b0ac0075612c3.tar.zst Shaarli-4ff3ed1c47365d5b28f70cb2921b0ac0075612c3.zip |
Make max download size and timeout configurable
Fixes #1061
Diffstat (limited to 'application/Updater.php')
-rw-r--r-- | application/Updater.php | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/application/Updater.php b/application/Updater.php index f07e7697..dece2c02 100644 --- a/application/Updater.php +++ b/application/Updater.php | |||
@@ -457,6 +457,32 @@ class Updater | |||
457 | } | 457 | } |
458 | return true; | 458 | return true; |
459 | } | 459 | } |
460 | |||
461 | /** | ||
462 | * Add download size and timeout to the configuration file | ||
463 | * | ||
464 | * @return bool true if the update is successful, false otherwise. | ||
465 | */ | ||
466 | public function updateMethodDownloadSizeAndTimeoutConf() | ||
467 | { | ||
468 | if ($this->conf->exists('general.download_max_size') | ||
469 | && $this->conf->exists('general.download_timeout') | ||
470 | ) { | ||
471 | return true; | ||
472 | } | ||
473 | |||
474 | if (! $this->conf->exists('general.download_max_size')) { | ||
475 | $this->conf->set('general.download_max_size', 1024*1024*4); | ||
476 | } | ||
477 | |||
478 | if (! $this->conf->exists('general.download_timeout')) { | ||
479 | $this->conf->set('general.download_timeout', 30); | ||
480 | } | ||
481 | |||
482 | $this->conf->write($this->isLoggedIn); | ||
483 | |||
484 | return true; | ||
485 | } | ||
460 | } | 486 | } |
461 | 487 | ||
462 | /** | 488 | /** |