@@ -20,7 +20,7 @@ public function __construct($pages, $language, $websend_language, $queries, $cac
2020
2121 $ name = 'Websend ' ;
2222 $ author = '<a href="https://samerton.me" target="_blank" rel="nofollow noopener">Samerton</a> ' ;
23- $ module_version = '1.1.0 ' ;
23+ $ module_version = '1.1.1 ' ;
2424 $ nameless_version = '2.0.0-pr6 ' ;
2525
2626 parent ::__construct ($ this , $ name , $ author , $ module_version , $ nameless_version );
@@ -29,7 +29,18 @@ public function __construct($pages, $language, $websend_language, $queries, $cac
2929 $ pages ->add ('Websend ' , '/panel/websend ' , 'pages/panel/websend.php ' );
3030
3131 // Hooks
32- $ ws_hooks = $ queries ->getWhere ('websend_commands ' , array ('enabled ' , '= ' , 1 ));
32+ $ ws_hooks = array ();
33+ $ this ->_cache ->setCache ('websend_module ' );
34+
35+ if ($ this ->_cache ->isCached ('installed ' )){
36+ $ ws_hooks = $ queries ->getWhere ('websend_commands ' , array ('enabled ' , '= ' , 1 ));
37+ } else {
38+ if ($ this ->_queries ->tableExists ('websend_commands ' )){
39+ $ this ->_cache ->store ('installed ' , true );
40+ $ ws_hooks = $ queries ->getWhere ('websend_commands ' , array ('enabled ' , '= ' , 1 ));
41+ }
42+ }
43+
3344 if (count ($ ws_hooks )){
3445 if (!file_exists (ROOT_PATH . '/modules/Websend/config.php ' )){
3546 return ;
@@ -76,6 +87,9 @@ public function onInstall(){
7687 try {
7788 if (!$ this ->_queries ->tableExists ('websend_commands ' )){
7889 $ 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 " );
90+
91+ $ this ->_cache ->setCache ('websend_module ' );
92+ $ this ->_cache ->store ('installed ' , true );
7993 }
8094 } catch (Exception $ e ){
8195 $ ws_db_err = true ;
@@ -108,8 +122,6 @@ public function onDisable(){
108122 }
109123
110124 public function onPageLoad ($ user , $ pages , $ cache , $ smarty , $ navs , $ widgets , $ template ){
111- $ queries = new Queries ();
112-
113125 // Permissions
114126 PermissionHandler::registerPermissions ('Websend ' , array (
115127 'admincp.websend ' => $ this ->_language ->get ('moderator ' , 'staff_cp ' ) . ' » ' . $ this ->_websend_language ->get ('language ' , 'websend ' )
0 commit comments