silverstripe-staticpublisher/tasks/StaticExporterTask.php

26 lines
703 B
PHP
Raw Normal View History

2012-09-21 07:47:26 +02:00
<?php
/**
* @package static
*/
class StaticExporterTask extends BuildTask {
public function run($request) {
$export = new StaticExporter();
$url = $request->getVar('baseurl');
$sym = $request->getVar('symlink');
$quiet = $request->getVar('quiet');
$folder = $request->getVar('path');
if(!$folder) $folder = TEMP_FOLDER . '/static-export';
$url = ($url) ? $url : Director::baseURL();
$symlink = ($sym != "false");
$quiet = ($quiet) ? $quiet : false;
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);
}
}