Skip to content

Commit

Permalink
Issue #4501 Reinitialize db_verify after plugin installation.
Browse files Browse the repository at this point in the history
  • Loading branch information
CaMer0n committed Dec 7, 2023
1 parent fc59e82 commit b970aec
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 25 deletions.
60 changes: 35 additions & 25 deletions e107_handlers/db_verify_class.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,33 +77,12 @@ class db_verify
function __construct()
{

$sql = e107::getDb();
$sql->gen('SET SQL_QUOTE_SHOW_CREATE = 1');

$this->backUrl = e_SELF;

if(!deftrue('e_DEBUG') && $tmp = e107::getCache()->retrieve(self::cachetag, 15, true, true))
{
$cacheData = e107::unserialize($tmp);
$this->sqlFileTables = isset($cacheData['sqlFileTables']) ? $cacheData['sqlFileTables'] : $this->load();
$this->availableStorageEngines = isset($cacheData['availableStorageEngines']) ?
$cacheData['availableStorageEngines'] : $this->getAvailableStorageEngines();
}
else
{
$this->sqlFileTables = $this->load();
$this->availableStorageEngines = $this->getAvailableStorageEngines();
$cacheData = e107::serialize([
'sqlFileTables' => $this->sqlFileTables,
'availableStorageEngines' => $this->availableStorageEngines,
], 'json');
e107::getCache()->set(self::cachetag, $cacheData, true, true, true);
}

$this->backUrl = e_SELF;

$this->sqlLanguageTables = $this->getSqlLanguages();
$this->init();

// $this->loadCreateTableData();

return $this;

Expand Down Expand Up @@ -1565,8 +1544,39 @@ public function getCanonicalCharset($maybeCharset)

return $maybeCharset;
}



/**
* Inititalize the class parameters.
* @return void
*/
public function init($clearCache=false): void
{
$sql = e107::getDb();
$sql->gen('SET SQL_QUOTE_SHOW_CREATE = 1');

if(!deftrue('e_DEBUG') && ($clearCache === false) && $tmp = e107::getCache()->retrieve(self::cachetag, 15, true, true))
{
$cacheData = e107::unserialize($tmp);
$this->sqlFileTables = isset($cacheData['sqlFileTables']) ? $cacheData['sqlFileTables'] : $this->load();
$this->availableStorageEngines = isset($cacheData['availableStorageEngines']) ?
$cacheData['availableStorageEngines'] : $this->getAvailableStorageEngines();
}
else
{
$this->sqlFileTables = $this->load();
$this->availableStorageEngines = $this->getAvailableStorageEngines();
$cacheData = e107::serialize([
'sqlFileTables' => $this->sqlFileTables,
'availableStorageEngines' => $this->availableStorageEngines,
], 'json');
e107::getCache()->set(self::cachetag, $cacheData, true, true, true);
}


$this->sqlLanguageTables = $this->getSqlLanguages();
}


}


Expand Down
1 change: 1 addition & 0 deletions e107_tests/tests/unit/db_verifyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1113,6 +1113,7 @@ public function testRunFix()
}

// Fix table.
$this->dbv->init(true);
$this->dbv->compare('rss');
$this->dbv->compileResults();
$this->dbv->runFix();
Expand Down
5 changes: 5 additions & 0 deletions e107_tests/tests/unit/pluginsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,12 @@ public function testPoll()
public function testRss_menu()
{
$this->pluginInstall('rss_menu');
$installed = e107::isInstalled('rss_menu');
self::assertTrue($installed);

$this->pluginUninstall('rss_menu');
$installed = e107::isInstalled('rss_menu');
self::assertFalse($installed);
}

public function testSocial()
Expand Down

0 comments on commit b970aec

Please sign in to comment.