public static function Create_Required_Dirs() { //-- if (!defined('SMART_FRAMEWORK_VERSION')) { die('Smart Runtime // Create Required Dirs :: Requires SmartFramework to be loaded ...'); } //end if //-- if (self::$RequiredDirsCreated !== false) { return; // avoid run after it was used by runtime } //end if self::$RequiredDirsCreated = true; //-- @clearstatcache(); //-- tmp dir $dir = 'tmp/'; if (!is_dir($dir)) { SmartFileSystem::dir_create($dir); SmartFileSystem::write($dir . 'index.html', ''); SmartFileSystem::write($dir . '.htaccess', trim((string) SMART_FRAMEWORK_HTACCESS_NOINDEXING) . "\n" . trim((string) SMART_FRAMEWORK_HTACCESS_NOEXECUTION) . "\n" . trim((string) SMART_FRAMEWORK_HTACCESS_FORBIDDEN) . "\n"); } else { // manage debug cleanup if ((string) SMART_FRAMEWORK_DEBUG_MODE != 'yes') { if (is_file('tmp/SMART-FRAMEWORK__DEBUG-ON')) { if (is_dir('tmp/logs/idx/')) { SmartFileSystem::dir_delete('tmp/logs/idx/', true); } //end if if (is_dir('tmp/logs/adm/')) { SmartFileSystem::dir_delete('tmp/logs/adm/', true); } //end if SmartFileSystem::delete('tmp/SMART-FRAMEWORK__DEBUG-ON'); } //end if } else { SmartFileSystem::write_if_not_exists('tmp/SMART-FRAMEWORK__DEBUG-ON', 'DEBUG:ON'); } //end if else } // end if if (!is_writable($dir)) { Smart::raise_error('#SMART-FRAMEWORK-CREATE-REQUIRED-DIRS#' . "\n" . 'General ERROR :: \'' . $dir . '\' is NOT writable !', 'App Init ERROR :: (Temporary Folder is Not Writable)'); die; } //end if if (!is_file($dir . '.htaccess')) { Smart::raise_error('#SMART-FRAMEWORK-CREATE-REQUIRED-DIRS#' . "\n" . 'The .htaccess file is missing on FileSystem #TMP: ' . $dir . '.htaccess', 'App Init ERROR :: (See Error Log for More Details)'); die; } //end if //-- tmp locks dir $dir = 'tmp/locks/'; if (!is_dir($dir)) { SmartFileSystem::dir_create($dir); SmartFileSystem::write($dir . 'index.html', ''); } // end if if (!is_writable($dir)) { Smart::raise_error('#SMART-FRAMEWORK-CREATE-REQUIRED-DIRS#' . "\n" . 'General ERROR :: \'' . $dir . '\' is NOT writable !', 'App Init ERROR :: (See Error Log for More Details)'); die; } //end if //-- tmp cache dir $dir = 'tmp/cache/'; if (!is_dir($dir)) { SmartFileSystem::dir_create($dir); SmartFileSystem::write($dir . 'index.html', ''); } // end if if (!is_writable($dir)) { Smart::raise_error('#SMART-FRAMEWORK-CREATE-REQUIRED-DIRS#' . "\n" . 'General ERROR :: \'' . $dir . '\' is NOT writable !', 'App Init ERROR :: (See Error Log for More Details)'); die; } //end if //-- tmp logs dir $dir = 'tmp/logs/'; if (!is_dir($dir)) { SmartFileSystem::dir_create($dir); SmartFileSystem::write($dir . 'index.html', ''); } // end if if (!is_writable($dir)) { Smart::raise_error('#SMART-FRAMEWORK-CREATE-REQUIRED-DIRS#' . "\n" . 'General ERROR :: \'' . $dir . '\' is NOT writable !', 'App Init ERROR :: (Error Log Folder is Not Writable)'); die; } //end if //-- tmp logs/admin dir $dir = 'tmp/logs/adm/'; if (!is_dir($dir)) { SmartFileSystem::dir_create($dir); SmartFileSystem::write($dir . 'index.html', ''); } // end if if (!is_writable($dir)) { Smart::raise_error('#SMART-FRAMEWORK-CREATE-REQUIRED-DIRS#' . "\n" . 'General ERROR :: \'' . $dir . '\' is NOT writable !', 'App Init ERROR :: (See Error Log for More Details)'); die; } //end if //-- tmp logs/idx dir $dir = 'tmp/logs/idx/'; if (!is_dir($dir)) { SmartFileSystem::dir_create($dir); SmartFileSystem::write($dir . 'index.html', ''); } // end if if (!is_writable($dir)) { Smart::raise_error('#SMART-FRAMEWORK-CREATE-REQUIRED-DIRS#' . "\n" . 'General ERROR :: \'' . $dir . '\' is NOT writable !', 'App Init ERROR :: (See Error Log for More Details)'); die; } //end if //-- tmp sessions dir $dir = 'tmp/sessions/'; if (!is_dir($dir)) { SmartFileSystem::dir_create($dir); SmartFileSystem::write($dir . 'index.html', ''); } // end if if (!is_writable($dir)) { Smart::raise_error('#SMART-FRAMEWORK-CREATE-REQUIRED-DIRS#' . "\n" . 'General ERROR :: \'' . $dir . '\' is NOT writable !', 'App Init ERROR :: (See Error Log for More Details)'); die; } //end if //-- wpub dir $dir = 'wpub/'; // {{{SYNC-WPUB-DIR}}} $ctrlfile = $dir . '#wpub'; $htfile = $dir . '.htaccess'; $robotsfile = $dir . 'robots.txt'; if (!is_dir($dir)) { SmartFileSystem::dir_create($dir); SmartFileSystem::write($dir . 'index.html', ''); SmartFileSystem::write($robotsfile, 'User-agent: *' . "\n" . 'Disallow: *'); // avoid robots to index it SmartFileSystem::write($ctrlfile, 'FileName: #wpub (#WEB-PUBLIC)' . "\n" . 'Created by: App-Runtime' . "\n" . date('Y-m-d H:i:s O')); SmartFileSystem::write($htfile, trim((string) SMART_FRAMEWORK_HTACCESS_NOEXECUTION) . "\n"); // trim((string)SMART_FRAMEWORK_HTACCESS_NOINDEXING)."\n". } // end if if (!is_writable($dir)) { Smart::raise_error('#SMART-FRAMEWORK-CREATE-REQUIRED-DIRS#' . "\n" . 'General ERROR :: #WEB-PUBLIC Folder: \'' . $dir . '\' is NOT writable !', 'App Init ERROR :: (See Error Log for More Details)'); die; } //end if if (!is_file($ctrlfile)) { Smart::raise_error('#SMART-FRAMEWORK-CREATE-REQUIRED-DIRS#' . "\n" . 'Cannot Connect to FileSystem #WEB-PUBLIC: ' . $ctrlfile, 'App Init ERROR :: (See Error Log for More Details)'); die; } //end if if (!is_file($htfile)) { Smart::raise_error('#SMART-FRAMEWORK-CREATE-REQUIRED-DIRS#' . "\n" . 'The .htaccess file is missing on FileSystem #WEB-PUBLIC: ' . $htfile, 'App Init ERROR :: (See Error Log for More Details)'); die; } //end if //-- wpub/webapps-content $dir = 'wpub/webapps-content/'; // {{{SYNC-WEBAPPS-DIR}}} if (!is_dir($dir)) { SmartFileSystem::dir_create($dir); SmartFileSystem::write($dir . 'index.html', ''); } // end if if (!is_writable($dir)) { Smart::raise_error('#SMART-FRAMEWORK-CREATE-REQUIRED-DIRS#' . "\n" . 'General ERROR :: \'' . $dir . '\' is NOT writable !', 'App Init ERROR :: (See Error Log for More Details)'); die; } //end if //-- }