mirror of
https://github.com/silverstripe/silverstripe-staticpublisher
synced 2024-10-22 14:05:54 +02:00
FIX: Clear DataObject cache when loading each page (Fixes #10)
Include performance figures in the export log for reference.
This commit is contained in:
parent
20e3e5f019
commit
48e3ed9d35
@ -53,6 +53,7 @@ class StaticExporter extends Controller {
|
||||
|
||||
|
||||
public function export() {
|
||||
|
||||
if(isset($_REQUEST['baseurl'])) {
|
||||
$base = $_REQUEST['baseurl'];
|
||||
if(substr($base,-1) != '/') $base .= '/';
|
||||
@ -137,6 +138,8 @@ class StaticExporter extends Controller {
|
||||
// Run the page
|
||||
Requirements::clear();
|
||||
$link = Director::makeRelative($obj->Link());
|
||||
|
||||
DataObject::flush_and_destroy_cache();
|
||||
$response = Director::test($link);
|
||||
|
||||
// Write to file
|
||||
|
@ -5,6 +5,7 @@
|
||||
class StaticExporterTask extends BuildTask {
|
||||
|
||||
public function run($request) {
|
||||
$now = microtime(true);
|
||||
$export = new StaticExporter();
|
||||
|
||||
$url = $request->getVar('baseurl');
|
||||
@ -21,6 +22,13 @@ class StaticExporterTask extends BuildTask {
|
||||
if(!$quiet) printf("Exporting website with %s base URL... %s", $url, PHP_EOL);
|
||||
$path = $export->doExport($url, $folder, $symlink, $quiet);
|
||||
|
||||
if(!$quiet) printf("Completed. Website exported to %s. %s", $path, PHP_EOL);
|
||||
if(!$quiet) {
|
||||
printf("\nWebsite exported to %s\nTotal time %s\nMemory used %s. %s",
|
||||
$path,
|
||||
number_format(microtime(true) - $now, 2) . 's',
|
||||
number_format(memory_get_peak_usage() / 1024 / 1024, 2) .'mb',
|
||||
PHP_EOL
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user