BackendInterface.php
1 year ago
BaseSettingsTable.php
2 years ago
Cache.php
2 years ago
Config.php
2 years ago
MeasurableSettingsTable.php
6 months ago
NullBackend.php
2 years ago
PluginSettingsTable.php
1 month ago
SitesTable.php
1 month ago
BaseSettingsTable.php
34 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Matomo - free/libre analytics platform |
| 5 | * |
| 6 | * @link https://matomo.org |
| 7 | * @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later |
| 8 | */ |
| 9 | namespace Piwik\Settings\Storage\Backend; |
| 10 | |
| 11 | use Piwik\Concurrency\Lock; |
| 12 | use Piwik\Container\StaticContainer; |
| 13 | use Piwik\Db; |
| 14 | abstract class BaseSettingsTable implements \Piwik\Settings\Storage\Backend\BackendInterface |
| 15 | { |
| 16 | /** |
| 17 | * @var Db\AdapterInterface |
| 18 | */ |
| 19 | protected $db; |
| 20 | /** @var Lock */ |
| 21 | protected $lock; |
| 22 | public function __construct() |
| 23 | { |
| 24 | $this->lock = StaticContainer::getContainer()->make(Lock::class, array('namespace' => 'PluginSettingsTable')); |
| 25 | } |
| 26 | protected function initDbIfNeeded() |
| 27 | { |
| 28 | if (!isset($this->db)) { |
| 29 | // we do not want to create a db connection on backend creation |
| 30 | $this->db = Db::get(); |
| 31 | } |
| 32 | } |
| 33 | } |
| 34 |