Hi all,
I am trying to get the static publisher to work, this is my first time trying to run it.
I have followed http://doc.silverstripe.org/staticpublisher
and are using the Single server Caching technique.
These are the things I have done.
1/ mysite/_config.php - added
Object::add_extension("SiteTree", "FilesystemPublisher('cache/', 'html')");
2/ .htaccess replaced
RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [L]
with
RewriteRule .* sapphire/static-main.php?url=%1&%{QUERY_STRING} [L]
3/ Have added the below to the Page.php class file
// class Page extends SiteTree { stays here is the start of a default class
class Page extends SiteTree {
public static $db = array(
);
public static $has_one = array(
);
// page classes for static publisher added by t
/**
* Return a list of all the pages to cache
*/
function allPagesToCache() {
// Get each page type to define its sub-urls
$urls = array();
// memory intensive depending on number of pages
$pages = DataObject::get("SiteTree");
foreach($pages as $page) {
$urls = array_merge($urls, (array)$page->subPagesToCache());
}
// add any custom URLs which are not SiteTree instances
$urls[] = "sitemap.xml";
return $urls;
}
/**
* Get a list of URLs to cache related to this page
*/
function subPagesToCache() {
$urls = array();
// add current page
$urls[] = $this->Link();
// cache the RSS feed if comments are enabled
if ($this->ProvideComments) {
$urls[] = Director::absoluteBaseURL() . "pagecomment/rss/" . $this->ID;
}
return $urls;
}
function pagesAffectedByChanges() {
$urls = $this->subPagesToCache();
if($p = $this->Parent) $urls = array_merge((array)$urls, (array)$p->subPagesToCache());
return $urls;
}
4/ Run /dev/buildcache?flush=1
which then gives me:
ebuilding cache.
NOTE: Please ensure that this page ends with 'Done!' - if not, then something may have gone wrong.
Removing stale cache files...
done.
Rebuilding cache from 5 urls...
FilesystemPublisher: Publishing to
* Publishing page 1/5: /silverstripe/silverstripe-v2.4.0
* Publishing page 2/5: /silverstripe/silverstripe-v2.4.0/about-us
* Publishing page 3/5: /silverstripe/silverstripe-v2.4.0/contact-us
* Publishing page 4/5: /silverstripe/silverstripe-v2.4.0/page-not-found
* Publishing page 5/5: sitemap.xml
Rebuilding cache.
NOTE: Please ensure that this page ends with 'Done!' - if not, then something may have gone wrong.
There already appears to be a publishing queue running. You can skip warning this by adding ?/&force to the URL.
5/ I then try access the main silverstripe site and I get these error messages at the top of the page
Notice: Use of undefined constant BASE_URL - assumed 'BASE_URL' in F:\wamp\www\silverstripe\silverstripe-v2.4.0\sapphire\static-main.php on line 52
6/ I've checked the cache folders and there is definatley no html file there.
Any help would be great