X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fgen_sql_patches.php;h=090d4341f4870236d7b3ccb20db62ec606ae2a73;hb=f151c251ccff7d143c8470e4451ce922ee40bd9d;hp=18faa6fd8cfdaa8645dfdcf85b71c78c8c6e4c25;hpb=6c763653e88b9d10627e651ca59c7201d4b7d62b;p=mailer.git diff --git a/inc/gen_sql_patches.php b/inc/gen_sql_patches.php index 18faa6fd8c..090d4341f4 100644 --- a/inc/gen_sql_patches.php +++ b/inc/gen_sql_patches.php @@ -1,7 +1,7 @@ Cookie: ".get_session('u_hash')."
Test: ".$test); + // Generate secret key from a randomized string + $secretKey = sha1(generateHash(mt_rand(128, 256))); - // Write $file_hash to database - $result = SQL_QUERY_ESC("UPDATE `"._MYSQL_PREFIX."_config` SET file_hash='%s' WHERE config=0 LIMIT 1", - array($file_hash), __FILE__, __LINE__); - - // Also create .htaccess file - $fp = @fopen(PATH."inc/.secret/.htaccess", 'w') or mxchange_die("Cannot write to .htaccess file!"); - if ($fp != false) { - // Add deny line to file - fwrite($fp, "Deny from all"); - - // Close the file - fclose($fp); - } // END - if + // File hash was never created + writeToFile($FQFN, $secretKey); + // Is the file there? + if (isFileReadable($FQFN)) { // Also update configuration - $_CONFIG['secret_key'] = $secretKey; unset($secretKey); - $_CONFIG['file_hash'] = $file_hash; unset($file_hash); + setConfigEntry('secret_key', $secretKey); + updateConfiguration('file_hash', $fileHash); + + // Remove variables + unset($secretKey); + unset($fileHash); } // END - if } // END - if -// -?> \ No newline at end of file +// @TODO Rewrite this to a filter +if ((isExtensionInstalledAndNewer('cache', '0.1.2')) && (isCacheInstanceValid())) { + // Destroy some cache files + foreach (array('config', 'extension', 'filter', 'modules') as $cache) { + // Use rebuildCache() + rebuildCache($cache); + } // END - foreach +} // END - if + +// [EOF] +?>