/** * This method should be called at class load, and stores the mode, ip address, and creates a session identifier, so that these things only need to * happen once within the life of the interpreter process */ public static function init() { if (!self::$initialized) { $diagnosticMode = class_exists("MM_OptionUtils") ? MM_OptionUtils::getOption(MM_OptionUtils::$OPTION_KEY_DIAGNOSTIC_MODE) : ""; self::$DIAGNOSTIC_MODE = empty($diagnosticMode) ? self::$MODE_OFF : $diagnosticMode; if (self::$DIAGNOSTIC_MODE !== self::$MODE_OFF) { self::$IP_ADDRESS = class_exists("MM_Utils") ? MM_Utils::getClientIPAddress() : "unknown"; //the transaction key class logic for generating random identifiers is reused here, for convenience self::$SESSION = class_exists("MM_TransactionKey") ? MM_TransactionKey::createRandomIdentifier(8) : "unknown"; } self::$initialized = true; } }
/** * This method should be called at class load, and stores the mode, ip address, and creates a session identifier, so that these things only need to * happen once within the life of the interpreter process */ public static function init() { if (!self::$initialized) { $currentMode = class_exists("MM_OptionUtils") ? MM_OptionUtils::getOption(MM_OptionUtils::$OPTION_KEY_SAFE_MODE) : ""; self::$SAFE_MODE_STATUS = empty($currentMode) ? self::$MODE_DISABLED : $currentMode; if (self::$SAFE_MODE_STATUS !== self::$MODE_DISABLED) { self::$IP_ADDRESS = class_exists("MM_Utils") ? MM_Utils::getClientIPAddress() : "unknown"; //the transaction key class logic for generating random identifiers is reused here, for convenience self::$SESSION = class_exists("MM_TransactionKey") ? MM_TransactionKey::createRandomIdentifier(8) : "unknown"; } self::$initialized = true; } }
* MemberMouse(TM) (http://www.membermouse.com) * (c) MemberMouse, LLC. All rights reserved. */ require_once "../../../../wp-load.php"; require_once "../includes/mm-constants.php"; require_once "../includes/init.php"; // Send connection close to allow the caller to continue processing // ---------------------------------------------------------------- MM_ConnectionUtils::closeConnectionAndContinueProcessing(); // Set operating parameters // ---------------------------------------------------------------- $maxExecutionTime = 600; //in seconds $maxBatchSize = 100; $expiredBatchTime = gmdate("Y-m-d H:i:s", strtotime("-{$maxExecutionTime} seconds", time())); $batchIdentifier = MM_TransactionKey::createRandomIdentifier(); // Begin synchronization // ---------------------------------------------------------------- set_time_limit($maxExecutionTime); $queueEmpty = false; $queTable = MM_TABLE_QUEUED_SCHEDULED_EVENTS; $eventTable = MM_TABLE_SCHEDULED_EVENTS; MM_DiagnosticLog::log(MM_DiagnosticLog::$MM_SUCCESS, "Beginning Scheduled Event Queue Synchronization at " . gmdate("Y-m-d H:i:s", time())); try { do { $currentTime = gmdate("Y-m-d H:i:s", time()); //make this call atomic $lockAcquired = $wpdb->get_var("SELECT COALESCE(GET_LOCK('synchronize_mm_scheduler',10),0)"); if ($lockAcquired != "1") { throw new Exception("Scheduler sync: Could not acquire lock"); }