]> git.mxchange.org Git - mailer.git/blobdiff - inc/extensions.php
Surfbar now has start/stop button
[mailer.git] / inc / extensions.php
index 969d8617098e9d2986b63d28b083e9a2e63f6721..50820f59487c26cde3fe1cd6b96fba6b129bcdbe 100644 (file)
@@ -320,22 +320,17 @@ function EXTENSION_RUN_SQLS($id, $EXT_LOAD_MODE) {
        } // END - if
 }
 // Check if given extension is active
-function EXT_IS_ACTIVE ($ext_name, $ignore_admin = false, $ignore_cache = false) {
+function EXT_IS_ACTIVE ($ext_name) {
        global $cacheArray, $_CONFIG;
 
        // Extensions are all inactive during installation
        if ((!isBooleanConstantAndTrue('mxchange_installed')) || (isBooleanConstantAndTrue('mxchange_installing')) || (empty($ext_name))) return false;
 
-       // Extension's file name will also be checked
-       $file = sprintf("%sinc/extensions/ext-%s.php", PATH, $ext_name);
-       if (!FILE_READABLE($file)) return false;
-       //* DEBUG: */ echo "*".$ext_name."(".count($cacheArray).")<br />";
-
        // Not active is the default
        $active = "N";
 
        // Check cache
-       if ((!empty($cacheArray['extensions']['ext_active'][$ext_name])) && (!$ignore_cache)) {
+       if (!empty($cacheArray['extensions']['ext_active'][$ext_name])) {
                // Load from cache
                //* DEBUG: */ echo "CACHE! ext_name={$ext_name}<br />\n";
                $active = $cacheArray['extensions']['ext_active'][$ext_name];
@@ -370,13 +365,7 @@ function EXT_IS_ACTIVE ($ext_name, $ignore_admin = false, $ignore_cache = false)
        //DEBUG_LOG(__FUNCTION__.": ext_name={$ext_name},active={$active}");
 
        // Is this extension activated? (For admins we always have active extensions...)
-       return (
-               (
-                       $active == "Y"
-               ) && (
-                       FILE_READABLE($inc)
-               )
-       );
+       return ($active == "Y");
 }
 // Get version from extensions
 function GET_EXT_VERSION ($ext_name) {
@@ -606,5 +595,17 @@ function GET_EXT_ID($name) {
        // Return value
        return $ret;
 }
+// Activate given extension
+function ACTIVATE_EXTENSION($ext_name) {
+       // Activate the extension
+       $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_extensions SET ext_active='Y' WHERE ext_name='%s' LIMIT 1",
+               array($ext_name), __FILE__, __LINE__);
+
+       // Extension has been activated?
+       if (SQL_AFFECTEDROWS() == 1) {
+               // Then run all queries
+               EXTENSION_RUN_SQLS(GET_EXT_ID($ext_name), "activate");
+       } // END - if
+}
 //
 ?>