X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fextensions.php;h=50820f59487c26cde3fe1cd6b96fba6b129bcdbe;hp=969d8617098e9d2986b63d28b083e9a2e63f6721;hb=23f39916099dad094d2d2b0fe54d335bddc986db;hpb=963e55ca1ea79e255f235e359cde9f7862191dc5
diff --git a/inc/extensions.php b/inc/extensions.php
index 969d861709..50820f5948 100644
--- a/inc/extensions.php
+++ b/inc/extensions.php
@@ -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).")
";
-
// 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}
\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
+}
//
?>