diff options
Diffstat (limited to 'application/Updater.php')
-rw-r--r-- | application/Updater.php | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/application/Updater.php b/application/Updater.php index dece2c02..c2aa1568 100644 --- a/application/Updater.php +++ b/application/Updater.php | |||
@@ -2,6 +2,7 @@ | |||
2 | use Shaarli\Config\ConfigJson; | 2 | use Shaarli\Config\ConfigJson; |
3 | use Shaarli\Config\ConfigPhp; | 3 | use Shaarli\Config\ConfigPhp; |
4 | use Shaarli\Config\ConfigManager; | 4 | use Shaarli\Config\ConfigManager; |
5 | use Shaarli\Thumbnailer; | ||
5 | 6 | ||
6 | /** | 7 | /** |
7 | * Class Updater. | 8 | * Class Updater. |
@@ -31,6 +32,11 @@ class Updater | |||
31 | protected $isLoggedIn; | 32 | protected $isLoggedIn; |
32 | 33 | ||
33 | /** | 34 | /** |
35 | * @var array $_SESSION | ||
36 | */ | ||
37 | protected $session; | ||
38 | |||
39 | /** | ||
34 | * @var ReflectionMethod[] List of current class methods. | 40 | * @var ReflectionMethod[] List of current class methods. |
35 | */ | 41 | */ |
36 | protected $methods; | 42 | protected $methods; |
@@ -42,13 +48,17 @@ class Updater | |||
42 | * @param LinkDB $linkDB LinkDB instance. | 48 | * @param LinkDB $linkDB LinkDB instance. |
43 | * @param ConfigManager $conf Configuration Manager instance. | 49 | * @param ConfigManager $conf Configuration Manager instance. |
44 | * @param boolean $isLoggedIn True if the user is logged in. | 50 | * @param boolean $isLoggedIn True if the user is logged in. |
51 | * @param array $session $_SESSION (by reference) | ||
52 | * | ||
53 | * @throws ReflectionException | ||
45 | */ | 54 | */ |
46 | public function __construct($doneUpdates, $linkDB, $conf, $isLoggedIn) | 55 | public function __construct($doneUpdates, $linkDB, $conf, $isLoggedIn, &$session = []) |
47 | { | 56 | { |
48 | $this->doneUpdates = $doneUpdates; | 57 | $this->doneUpdates = $doneUpdates; |
49 | $this->linkDB = $linkDB; | 58 | $this->linkDB = $linkDB; |
50 | $this->conf = $conf; | 59 | $this->conf = $conf; |
51 | $this->isLoggedIn = $isLoggedIn; | 60 | $this->isLoggedIn = $isLoggedIn; |
61 | $this->session = &$session; | ||
52 | 62 | ||
53 | // Retrieve all update methods. | 63 | // Retrieve all update methods. |
54 | $class = new ReflectionClass($this); | 64 | $class = new ReflectionClass($this); |
@@ -480,6 +490,30 @@ class Updater | |||
480 | } | 490 | } |
481 | 491 | ||
482 | $this->conf->write($this->isLoggedIn); | 492 | $this->conf->write($this->isLoggedIn); |
493 | return true; | ||
494 | } | ||
495 | |||
496 | /** | ||
497 | * * Move thumbnails management to WebThumbnailer, coming with new settings. | ||
498 | */ | ||
499 | public function updateMethodWebThumbnailer() | ||
500 | { | ||
501 | if ($this->conf->exists('thumbnails.mode')) { | ||
502 | return true; | ||
503 | } | ||
504 | |||
505 | $thumbnailsEnabled = $this->conf->get('thumbnail.enable_thumbnails', true); | ||
506 | $this->conf->set('thumbnails.mode', $thumbnailsEnabled ? Thumbnailer::MODE_ALL : Thumbnailer::MODE_NONE); | ||
507 | $this->conf->set('thumbnails.width', 125); | ||
508 | $this->conf->set('thumbnails.height', 90); | ||
509 | $this->conf->remove('thumbnail'); | ||
510 | $this->conf->write(true); | ||
511 | |||
512 | if ($thumbnailsEnabled) { | ||
513 | $this->session['warnings'][] = t( | ||
514 | 'You have enabled or changed thumbnails mode. <a href="?do=thumbs_update">Please synchronize them</a>.' | ||
515 | ); | ||
516 | } | ||
483 | 517 | ||
484 | return true; | 518 | return true; |
485 | } | 519 | } |