-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate from the general "default_to_private" setting to granular set…
…tings
- Loading branch information
Showing
7 changed files
with
69 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
application/data/migrations/20240614123811_MigrateDefaultToPrivateSetting.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
namespace Omeka\Db\Migrations; | ||
|
||
use Doctrine\DBAL\Connection; | ||
use Laminas\ServiceManager\ServiceLocatorInterface; | ||
use Omeka\Db\Migration\ConstructedMigrationInterface; | ||
|
||
class MigrateDefaultToPrivateSetting implements ConstructedMigrationInterface | ||
{ | ||
private $settings; | ||
|
||
public static function create(ServiceLocatorInterface $services) | ||
{ | ||
return new self($services->get('Omeka\Settings')); | ||
} | ||
|
||
public function __construct($settings) | ||
{ | ||
$this->settings = $settings; | ||
} | ||
|
||
public function up(Connection $conn) | ||
{ | ||
// Migrate from the general "default_to_private" setting to granular settings. | ||
$defaultToPrivate = (bool) $this->settings->get('default_to_private', false); | ||
$this->settings->set('default_to_private_items', $defaultToPrivate); | ||
$this->settings->set('default_to_private_item_sets', $defaultToPrivate); | ||
$this->settings->set('default_to_private_sites', $defaultToPrivate); | ||
$this->settings->set('default_to_private_site_pages', $defaultToPrivate); | ||
$this->settings->delete('default_to_private'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters