]> git.mxchange.org Git - mailer.git/blobdiff - inc/extensions.php
New function isDirectory() introduced, fixed GET_DIR_AS_ARRAY() (replaces scandir())
[mailer.git] / inc / extensions.php
index 68a6ae3326f7ff5e489b841f4661d12e3465098e..db279cffe9c2c3f5eff5b614d473f39759af26da 100644 (file)
  * -------------------------------------------------------------------- *
  * Kurzbeschreibung  : Erweiterungen-Management                         *
  * -------------------------------------------------------------------- *
- *                                                                      *
+ * $Revision:: 856                                                    $ *
+ * $Date::                                                            $ *
+ * $Tag:: 0.2.1-FINAL                                                 $ *
+ * $Author::                                                          $ *
+ * Needs to be in all Files and every File needs "svn propset           *
+ * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2008 by Roland Haeder                           *
  * For more information visit: http://www.mxchange.org                  *
@@ -52,14 +57,12 @@ function LOAD_EXTENSION ($ext_name, $EXT_LOAD_MODE = "", $EXT_VER = "", $dry_run
                return false;
        } // END - if
 
-       // Construct FQFN for extension file
-       $FQFN = sprintf("%sinc/extensions/ext-%s.php",
-               constant('PATH'),
-               $ext_name
-       );
+       // Construct include filename and FQFN for extension file
+       $INC = sprintf("inc/extensions/ext-%s.php", $ext_name);
+       $FQFN = constant('PATH') . $INC;
 
        // Is the extension file NOT there?
-       if (!FILE_READABLE($FQFN)) {
+       if (!INCLUDE_READABLE($INC)) {
                // Debug message
                DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Extension %s not found.", $ext_name));
 
@@ -254,7 +257,7 @@ function EXTENSION_REGISTER ($ext_name, $task_id, $dry_run = false, $logout = tr
        //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, ":{$ext_name}/{$EXT_LOAD_MODE}");
        if (($ext_name == "sql_patches") && (($EXT_LOAD_MODE == "register") || ($EXT_LOAD_MODE == "remove")) && (!$dry_run) && ($test)) {
                //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, ": LOAD!");
-               if ($logout) {
+               if ($logout === true) {
                        // Then redirect to logout
                        LOAD_URL("modules.php?module=admin&logout=1&".$EXT_LOAD_MODE."=sql_patches");
                } else {
@@ -383,10 +386,11 @@ function GET_EXT_VERSION ($ext_name) {
 
                // Count cache hits
                incrementConfigEntry('cache_hits');
-       } elseif ((!isset($GLOBALS['cache_instance'])) || (!is_object($GLOBALS['cache_instance']))) {
+       } elseif (!isCacheInstanceValid()) {
                // Load from database
                $result = SQL_QUERY_ESC("SELECT ext_version FROM `{!_MYSQL_PREFIX!}_extensions` WHERE ext_name='%s' LIMIT 1",
                        array($ext_name), __FILE__, __LINE__);
+               //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, ": DB - ".SQL_NUMROWS($result)."");
 
                // Is the extension there?
                if (SQL_NUMROWS($result) == 1) {
@@ -437,7 +441,7 @@ function EXTENSION_UPDATE ($ext_name, $ext_ver, $dry_run = false) {
                $start = array_search($ext_ver, $history);
 
                // And load SQL queries in order of version history
-               for ($idx = ($start + 1); $idx < sizeof($history); $idx++) {
+               for ($idx = ($start + 1); $idx < count($history); $idx++) {
                        // Set extension version
                        $GLOBALS['cache_array']['update_ver'][$ext_name] = $history[$idx];