Skip to content

Commit

Permalink
Merge branch 'release/3.0.0-beta.6' into v3
Browse files Browse the repository at this point in the history
  • Loading branch information
khalwat committed Mar 15, 2018
2 parents 5a2177c + 7fdaf8b commit 2a9dc2e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# SEOmatic Changelog

### 3.0.0-beta.6 - 2018.03.15
## Added
* Check whether the `seomatic_metabundles` table exists before installing any even listeners

### 3.0.0-beta.5 - 2018.03.15
## Changed
* Fixed an issue where the caching didn't work properly for multi-sites
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "nystudio107/craft-seomatic",
"description": "SEOmatic facilitates modern SEO best practices & implementation for Craft CMS 3. It is a turnkey SEO system that is comprehensive, powerful, and flexible.",
"type": "craft-plugin",
"version": "3.0.0-beta.5",
"version": "3.0.0-beta.6",
"keywords": [
"craft",
"cms",
Expand Down
22 changes: 18 additions & 4 deletions src/Seomatic.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public static function setMatchedElement($element)
/**
* @var string
*/
public $schemaVersion = '3.0.3';
public $schemaVersion = '3.0.4';

// Public Methods
// =========================================================================
Expand All @@ -177,10 +177,10 @@ public function init()
self::$settings->environment = "local";
}
$this->name = Seomatic::$settings->pluginName;
// Add in our Twig extensions
Seomatic::$view->registerTwigExtension(new SeomaticTwigExtension);
// Install our event listeners
$this->installEventListeners();
if ($this->tableSchemaExists()) {
$this->installEventListeners();
}
// We're loaded
Craft::info(
Craft::t(
Expand Down Expand Up @@ -266,6 +266,18 @@ public function clearAllCaches()
// Protected Methods
// =========================================================================

/**
* Determine whether our table schema exists or not; this is needed because
* migrations such as the install migration and base_install migration may
* not have been run by the time our init() method has been called
*
* @return bool
*/
protected function tableSchemaExists(): bool
{
return (Craft::$app->db->schema->getTableSchema('{{%seomatic_metabundles}}') !== null);
}

/**
* Install our event listeners. We do it only after we receive the event
* EVENT_AFTER_LOAD_PLUGINS so that any pending db migrations can be run
Expand All @@ -278,6 +290,8 @@ protected function installEventListeners()
Plugins::class,
Plugins::EVENT_AFTER_LOAD_PLUGINS,
function () {
// Add in our Twig extensions
Seomatic::$view->registerTwigExtension(new SeomaticTwigExtension);
// Add in our event listeners that are needed for every request
$this->installGlobalEventListeners();
// Only respond to non-console site requests
Expand Down

0 comments on commit 2a9dc2e

Please sign in to comment.