Commit 7175e46f authored by Nicholas Thompson's avatar Nicholas Thompson
Browse files

#1567790 - Fixing bug with cache clearing breaking settings.

parent 1650b3a0
......@@ -766,6 +766,10 @@ function page_title_get_settings($flush = FALSE) {
return $cache->data;
}
// Ensure that the page title inc files are included before invoking
// This helps avoid the issues in #1567790
page_title_include_api_files();
// Get the settings from hook_page_title_settings().
$settings = module_invoke_all('page_title_settings');
......@@ -812,12 +816,29 @@ function page_title_init() {
drupal_add_css(drupal_get_path('module', 'page_title') .'/page_title.admin.css');
}
// Include relevant page_title.inc's
page_title_include_api_files();
}
/**
* Function to ensure API files are included.
* We use a static variable so we can use include, which is faster than include_one
*/
function page_title_include_api_files() {
// Using $runonce, we can ensure the include code below only gets run once.
static $runonce = FALSE;
if ($runonce) return;
// Include relevant page_title.inc's. We cannot use drupal_load() here due to the folder structure.
// We also avoice using include_once due to its performance hit on the Filesystem
foreach (page_title_get_module_apis() as $module => $info) {
if (file_exists("./{$info['path']}/{$module}.page_title.inc")) {
include "./{$info['path']}/{$module}.page_title.inc";
$path = "./{$info['path']}/{$module}.page_title.inc";
if (file_exists($path)) {
include $path;
}
}
$runonce = TRUE;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment