Skip to content

Commit

Permalink
Fix installation issue
Browse files Browse the repository at this point in the history
  • Loading branch information
samerton committed Jun 2, 2019
1 parent a604738 commit 7890d5e
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions upload/modules/Websend/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function __construct($pages, $language, $websend_language, $queries, $cac

$name = 'Websend';
$author = '<a href="https://samerton.me" target="_blank" rel="nofollow noopener">Samerton</a>';
$module_version = '1.1.0';
$module_version = '1.1.1';
$nameless_version = '2.0.0-pr6';

parent::__construct($this, $name, $author, $module_version, $nameless_version);
Expand All @@ -29,7 +29,18 @@ public function __construct($pages, $language, $websend_language, $queries, $cac
$pages->add('Websend', '/panel/websend', 'pages/panel/websend.php');

// Hooks
$ws_hooks = $queries->getWhere('websend_commands', array('enabled', '=', 1));
$ws_hooks = array();
$this->_cache->setCache('websend_module');

if($this->_cache->isCached('installed')){
$ws_hooks = $queries->getWhere('websend_commands', array('enabled', '=', 1));
} else {
if($this->_queries->tableExists('websend_commands')){
$this->_cache->store('installed', true);
$ws_hooks = $queries->getWhere('websend_commands', array('enabled', '=', 1));
}
}

if(count($ws_hooks)){
if(!file_exists(ROOT_PATH . '/modules/Websend/config.php')){
return;
Expand Down Expand Up @@ -76,6 +87,9 @@ public function onInstall(){
try {
if(!$this->_queries->tableExists('websend_commands')){
$this->_queries->createTable('websend_commands', ' `id` int(11) NOT NULL AUTO_INCREMENT, `hook` varchar(64) NOT NULL, `commands` mediumtext NOT NULL, `enabled` tinyint(1) NOT NULL DEFAULT \'0\', PRIMARY KEY (`id`)', "ENGINE=$engine DEFAULT CHARSET=$charset");

$this->_cache->setCache('websend_module');
$this->_cache->store('installed', true);
}
} catch(Exception $e){
$ws_db_err = true;
Expand Down Expand Up @@ -108,8 +122,6 @@ public function onDisable(){
}

public function onPageLoad($user, $pages, $cache, $smarty, $navs, $widgets, $template){
$queries = new Queries();

// Permissions
PermissionHandler::registerPermissions('Websend', array(
'admincp.websend' => $this->_language->get('moderator', 'staff_cp') . ' &raquo; ' . $this->_websend_language->get('language', 'websend')
Expand Down

0 comments on commit 7890d5e

Please sign in to comment.