Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion library/Upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/
class Upgrade
{
private $dbVersion = 41; //The db version we want to achive
private $dbVersion = 42; //The db version we want to achive
private $dbVersionKey = 'municipio_db_version';
private $db;

Expand Down Expand Up @@ -803,6 +803,24 @@
return true;
}

/**
* Version 42
*/
public function v_42(): bool

Check warning on line 809 in library/Upgrade.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename function "v_42" to match the regular expression ^[a-z][a-zA-Z0-9]*$.

See more on https://sonarcloud.io/project/issues?id=helsingborg-stad_Municipio&issues=AZ5ougdHxdeybvUC5Yci&open=AZ5ougdHxdeybvUC5Yci&pullRequest=2058
{
global $wpdb;
$version = new \Municipio\Upgrade\V42\Version42($wpdb, WpService::get());

try {
$version->upgradeToVersion();
} catch (\Exception $e) {
error_log($e->getMessage());
return false;
}

return true;
}

/**
* Get all post types
*
Expand Down
41 changes: 41 additions & 0 deletions library/Upgrade/V42/Version42.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

namespace Municipio\Upgrade\V42;

use Municipio\Customizer\Applicators\Types\NullApplicator;
use Municipio\Upgrade\VersionInterface;
use WpService\Contracts\AddAction;
use WpService\Contracts\DoAction;
use WpService\Contracts\GetPostTypes;
use WpService\Contracts\GetThemeMod;
use WpService\Contracts\SetThemeMod;

/**
* Class Version42
*/
class Version42 implements VersionInterface
{
/**
* Constructor.
*/
public function __construct(
private \wpdb $wpdb,
private GetThemeMod&SetThemeMod&GetPostTypes&AddAction&DoAction $wpService,
) {}

/**
* @inheritDoc
*/
public function upgradeToVersion(): void
{
$applicators = [
new NullApplicator(),
];
$customizerCache = new \Municipio\Customizer\Applicators\ApplicatorCache(
$this->wpService,
$this->wpdb,
...$applicators,
);
$customizerCache->tryClearCache();
}
}
Loading