mirror of
https://github.com/flextype/flextype.git
synced 2025-08-08 22:26:46 +02:00
feat(preflight): use Atomastic Filesystem #478
This commit is contained in:
@@ -10,8 +10,8 @@ $custom_flextype_settings_file_path = PATH['project'] . '/config/flextype/setti
|
||||
$preflight_flextype_path = PATH['tmp'] . '/preflight/flextype/';
|
||||
$custom_flextype_settings_path = PATH['project'] . '/config/flextype/';
|
||||
|
||||
! filesystem()->file($preflight_flextype_path)->exists() and filesystem()->directory($preflight_flextype_path)->create(0755, true);
|
||||
! filesystem()->file($custom_flextype_settings_path)->exists() and filesystem()->directory($custom_flextype_settings_path)->create(0755, true);
|
||||
! filesystem()->directory($preflight_flextype_path)->exists() and filesystem()->directory($preflight_flextype_path)->create(0755, true);
|
||||
! filesystem()->directory($custom_flextype_settings_path)->exists() and filesystem()->directory($custom_flextype_settings_path)->create(0755, true);
|
||||
|
||||
$f1 = file_exists($flextype_manifest_file_path) ? filemtime($flextype_manifest_file_path) : '';
|
||||
$f2 = file_exists($default_flextype_settings_file_path) ? filemtime($default_flextype_settings_file_path) : '';
|
||||
@@ -20,12 +20,9 @@ $f3 = file_exists($custom_flextype_settings_file_path) ? filemtime($custom_flext
|
||||
// Create Unique Cache ID
|
||||
$cache_id = md5($flextype_manifest_file_path . $default_flextype_settings_file_path . $custom_flextype_settings_file_path . $f1 . $f2 . $f3);
|
||||
|
||||
if (filesystem()->file($preflight_flextype_path . '/' . $cache_id . '.php')->exists()) {
|
||||
$flextype_data = require $preflight_flextype_path . '/' . $cache_id . '.php';
|
||||
if (filesystem()->file($preflight_flextype_path . '/' . $cache_id . '.txt')->exists()) {
|
||||
$flextype_data = unserialize(filesystem()->file($preflight_flextype_path . '/' . $cache_id . '.txt')->get());
|
||||
} else {
|
||||
// Drop the flextype preflight dir and create new one.
|
||||
filesystem()->directory($preflight_flextype_path)->delete();
|
||||
|
||||
// Set settings if Flextype Default settings config files exist
|
||||
if (! filesystem()->file($default_flextype_settings_file_path)->exists()) {
|
||||
throw new RuntimeException('Flextype Default settings config file does not exist.');
|
||||
@@ -67,7 +64,7 @@ if (filesystem()->file($preflight_flextype_path . '/' . $cache_id . '.php')->exi
|
||||
// Merge flextype default settings with custom project settings.
|
||||
$flextype_data = array_replace_recursive($default_flextype_settings, $custom_flextype_settings, $flextype_manifest);
|
||||
|
||||
//@todo remove this: filesystem()->file($preflight_flextype_path . $cache_id . '.php')->put(sprintf('<?php return %s;', var_export($flextype_data, true)));
|
||||
filesystem()->file($preflight_flextype_path . $cache_id . '.txt')->put(serialize($flextype_data));
|
||||
}
|
||||
|
||||
// Store flextype merged data in the flextype registry.
|
||||
|
Reference in New Issue
Block a user