/** * set_memory_limit * This function attempts to change the php memory limit using init_set. * Will never reduce it below the current setting. */ function set_memory_limit($new_limit) { $current_limit = ini_get('memory_limit'); if ($current_limit == -1) { return; } $current_limit = UI::unformat_bytes($current_limit); $new_limit = UI::unformat_bytes($new_limit); if ($current_limit < $new_limit) { ini_set(memory_limit, $new_limit); } }
AmpConfig::set_by_array($results, true); // Modules (These are conditionally included depending upon config values) if (AmpConfig::get('ratings')) { require_once $prefix . '/lib/rating.lib.php'; } /* Set a new Error Handler */ $old_error_handler = set_error_handler('ampache_error_handler'); /* Check their PHP Vars to make sure we're cool here */ $post_size = @ini_get('post_max_size'); if (substr($post_size, strlen($post_size) - 1, strlen($post_size)) != 'M') { /* Sane value time */ ini_set('post_max_size', '8M'); } // In case the local setting is 0 ini_set('session.gc_probability', '5'); if (!isset($results['memory_limit']) || UI::unformat_bytes($results['memory_limit']) < UI::unformat_bytes('32M')) { $results['memory_limit'] = '32M'; } set_memory_limit($results['memory_limit']); /**** END Set PHP Vars ****/ // If we want a session if (!defined('NO_SESSION') && AmpConfig::get('use_auth')) { /* Verify their session */ if (!Session::exists('interface', $_COOKIE[AmpConfig::get('session_name')])) { Auth::logout($_COOKIE[AmpConfig::get('session_name')]); exit; } // This actually is starting the session Session::check(); /* Create the new user */ $GLOBALS['user'] = User::get_from_username($_SESSION['userdata']['username']);