‪TYPO3CMS  10.4
FailsafePackageManager.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
19 
25 class ‪FailsafePackageManager extends PackageManager
26 {
30  protected ‪$inFailsafeMode = false;
31 
36  protected function ‪loadPackageStates()
37  {
38  try {
39  parent::loadPackageStates();
40  } catch (‪PackageStatesUnavailableException $exception) {
41  $this->inFailsafeMode = true;
42  $this->packageStatesConfiguration = [];
43  $this->scanAvailablePackages();
44  }
45  }
46 
50  protected function ‪savePackageStates()
51  {
52  // Do not save if in rescue mode
53  if (!$this->inFailsafeMode) {
54  parent::savePackageStates();
55  }
56  }
57 
62  public function ‪forceSortAndSavePackageStates()
63  {
64  parent::sortActivePackagesByDependencies();
65  parent::savePackageStates();
66  }
67 }
‪TYPO3\CMS\Core\Package\FailsafePackageManager
Definition: FailsafePackageManager.php:26
‪TYPO3\CMS\Core\Package\FailsafePackageManager\forceSortAndSavePackageStates
‪forceSortAndSavePackageStates()
Definition: FailsafePackageManager.php:61
‪TYPO3\CMS\Core\Package\Exception\PackageStatesUnavailableException
Definition: PackageStatesUnavailableException.php:24
‪TYPO3\CMS\Core\Package\FailsafePackageManager\loadPackageStates
‪loadPackageStates()
Definition: FailsafePackageManager.php:35
‪TYPO3\CMS\Core\Package\FailsafePackageManager\$inFailsafeMode
‪bool $inFailsafeMode
Definition: FailsafePackageManager.php:29
‪TYPO3\CMS\Core\Package\FailsafePackageManager\savePackageStates
‪savePackageStates()
Definition: FailsafePackageManager.php:49
‪TYPO3\CMS\Core\Package
Definition: AbstractServiceProvider.php:18