Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Pressflow 7 differences (October 2013)
diff -x '*.info' -x LICENSE.txt -ruN core/ pressflow/
diff -x '*.info' -x LICENSE.txt -ruN core/includes/bootstrap.inc pressflow/includes/bootstrap.inc
--- core/includes/bootstrap.inc 2013-08-07 22:04:26.000000000 -0400
+++ pressflow/includes/bootstrap.inc 2013-10-17 15:26:18.000000000 -0400
@@ -717,6 +717,22 @@
}
$is_https = isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on';
+ // Load environmental config, if present.
+ if (isset($_SERVER['PRESSFLOW_SETTINGS'])) {
+ $pressflow_settings = json_decode($_SERVER['PRESSFLOW_SETTINGS'], TRUE);
+ foreach ($pressflow_settings as $key => $value) {
+ // One level of depth should be enough for $conf and $database.
+ if ($key == 'conf') {
+ foreach($value as $conf_key => $conf_value) {
+ $conf[$conf_key] = $conf_value;
+ }
+ }
+ else {
+ $$key = $value;
+ }
+ }
+ }
+
if (isset($base_url)) {
// Parse fixed base URL from settings.php.
$parts = parse_url($base_url);
@@ -2428,6 +2444,17 @@
function _drupal_bootstrap_variables() {
global $conf;
+ // Pressflow Smart Start
+ if (!empty($GLOBALS['databases']) && variable_get('pressflow_smart_start', FALSE)) {
+ try {
+ $result = db_query('SELECT s.name FROM {system} s WHERE s.name = :name', array(':name' => 'system'));
+ } catch (Exception $e) {
+ // Redirect to the installer if an essential table is missing.
+ include_once DRUPAL_ROOT . '/includes/install.inc';
+ install_goto('install.php');
+ }
+ }
+
// Initialize the lock system.
require_once DRUPAL_ROOT . '/' . variable_get('lock_inc', 'includes/lock.inc');
lock_initialize();
diff -x '*.info' -x LICENSE.txt -ruN core/includes/common.inc pressflow/includes/common.inc
--- core/includes/common.inc 2013-08-07 22:04:26.000000000 -0400
+++ pressflow/includes/common.inc 2013-10-17 15:26:18.000000000 -0400
@@ -3558,7 +3558,7 @@
$uri = $map[$key];
}
- if (empty($uri) || !file_exists($uri)) {
+ if (empty($uri) || !drupal_aggregated_file_exists($uri)) {
// Build aggregate CSS file.
foreach ($css as $stylesheet) {
// Only 'file' stylesheets can be aggregated.
@@ -4896,6 +4896,20 @@
drupal_add_js($settings, 'setting');
}
+function drupal_aggregated_file_exists($uri) {
+ if (function_exists('apc_fetch')) {
+ $exists = apc_fetch('file_exists_' . $uri);
+ if (!$exists && file_exists($uri)) {
+ $exists = TRUE;
+ apc_store('file_exists_' . $uri, TRUE, 86400);
+ }
+ }
+ else {
+ $exists = file_exists($uri);
+ }
+ return $exists;
+}
+
/**
* Aggregates JavaScript files into a cache file in the files directory.
*
@@ -4935,7 +4949,7 @@
$uri = $map[$key];
}
- if (empty($uri) || !file_exists($uri)) {
+ if (empty($uri) || !drupal_aggregated_file_exists($uri)) {
// Build aggregate JS file.
foreach ($files as $path => $info) {
if ($info['preprocess']) {
@@ -4943,6 +4957,10 @@
$contents .= file_get_contents($path) . ";\n";
}
}
+
+ // Allow modules to act on the js_cache before writing to disk.
+ drupal_alter('js_cache', $contents);
+
// Prefix filename to prevent blocking by firewalls which reject files
// starting with "ad*".
$filename = 'js_' . drupal_hash_base64($contents) . '.js';
diff -x '*.info' -x LICENSE.txt -ruN core/includes/lock.inc pressflow/includes/lock.inc
--- core/includes/lock.inc 2013-08-07 22:04:26.000000000 -0400
+++ pressflow/includes/lock.inc 2013-10-17 15:26:18.000000000 -0400
@@ -214,7 +214,7 @@
// $delay is passed in seconds, but we will be using usleep(), which takes
// microseconds as a parameter. Multiply it by 1 million so that all
// further numbers are equivalent.
- $delay = (int) $delay * 1000000;
+ $delay = (int) ($delay * 1000000);
// Begin sleeping at 25ms.
$sleep = 25000;
diff -x '*.info' -x LICENSE.txt -ruN core/modules/system/system.api.php pressflow/modules/system/system.api.php
--- core/modules/system/system.api.php 2013-08-07 22:04:26.000000000 -0400
+++ pressflow/modules/system/system.api.php 2013-10-17 15:26:18.000000000 -0400
@@ -747,6 +747,26 @@
}
/**
+ * Perform necessary alterations to the concatenated JavaScript before it is
+ * presented on the page.
+ *
+ * @param $contents
+ * A string of the concatenated JavaScript.
+ *
+ * @see drupal_build_js_cache()
+ */
+function hook_js_cache_alter(&$contents) {
+ $header = <<<HEADER
+/**
+ * Powered by Pressflow
+ * http://pressflow.org
+ */
+HEADER;
+
+ $contents = $header . "\n" . $contents;
+}
+
+/**
* Registers JavaScript/CSS libraries associated with a module.
*
* Modules implementing this return an array of arrays. The key to each
diff -x '*.info' -x LICENSE.txt -ruN core/sites/default/default.settings.php pressflow/sites/default/default.settings.php
--- core/sites/default/default.settings.php 2013-08-07 22:04:26.000000000 -0400
+++ pressflow/sites/default/default.settings.php 2013-10-17 15:26:18.000000000 -0400
@@ -551,3 +551,13 @@
* Remove the leading hash signs to disable.
*/
# $conf['allow_authorize_operations'] = FALSE;
+
+/**
+ * Smart start:
+ *
+ * If you would prefer to be redirected to the installation system when a
+ * valid settings.php file is present but no tables are installed, remove
+ * the leading hash sign below.
+ */
+# $conf['pressflow_smart_start'] = TRUE;
+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment