\FilesystemPublisher
Usage: Object::add_extension("SiteTree", "FilesystemPublisher('static-folder', 'html')");
Usage: To work with Subsite module you need to:
- Add FilesystemPublisher::$domain_based_caching = true; in mysite/_config.php
- Added main site host mapping in subsites/host-map.php after everytime a new subsite is created or modified
You may also have a method $page->pagesAffectedByUnpublishing() to return other URLS
that should be de-cached if $page is unpublished.
Synopsis
class FilesystemPublisher
extends StaticPublisher
{
- // members
- protected String $destFolder = 'cache';
- protected String $fileExtension = 'html';
- protected static String $static_base_url = NULL;
- public static Boolean $domain_based_caching = false;
- // Inherited members from StaticPublisher
- public static boolean $echo_progress;
- public static boolean $disable_realtime;
- public static boolean $static_publisher_theme;
- // methods
- public static void set_static_base_url()
- public void __construct()
- public Array urlsToPaths()
- public void unpublishPages()
- public void publishPages()
- protected void generatePHPCacheFile()
- protected void generatePHPCacheRedirection()
- public void getDestDir()
- public void getExistingStaticCacheFiles()
- // Inherited methods from StaticPublisher
- public abstract void publishPages()
- public abstract void unpublishPages()
- public static void echo_progress()
- public static void set_echo_progress()
- public void onAfterPublish()
- public void onRenameLinkedAsset()
- public void republish()
- public void onAfterUnpublish()
- public void externalReferencesFor()
- public void set_static_publisher_theme()
- public void static_publisher_theme()
Hierarchy
Extends
Tasks
Line | Task |
---|---|
128 | - Make a more memory efficient publisher |
147 | - Make a more memory efficient publisher |
Members
protected
public
-
$disable_realtime
Realtime static publishing... the second a page is saved, it is written to the cache - $domain_based_caching — Boolean
-
$echo_progress
Defines whether to output information about publishing or not. By default, this is off, and should be turned on when you want debugging (for example, in a cron task) - $static_publisher_theme
Methods
protected
- generatePHPCacheFile() — Generate the templated content for a PHP script that can serve up the given piece of content with the given age and expiry
- generatePHPCacheRedirection() — Generate the templated content for a PHP script that can serve up a 301 redirect to the given destionation
public
- __construct()
- getDestDir()
- getExistingStaticCacheFiles() — Return an array of all the existing static cache files, as a map of URL => file.
- publishPages()
- set_static_base_url() — Set a different base URL for the static copy of the site.
- unpublishPages()
- urlsToPaths() — Transforms relative or absolute URLs to their static path equivalent.
Inherited from StaticPublisher
public
- echo_progress()
- externalReferencesFor() — Get all external references to CSS, JS,
- onAfterPublish() — Called after a page is published.
- onAfterUnpublish() — On after unpublish, get changes and hook into underlying functionality
- onRenameLinkedAsset() — Called after link assets have been renamed, and the live site has been updated, without an actual publish event.
- publishPages()
- republish()
- set_echo_progress() — Either turns on (boolean true) or off (boolean false) the progress indicators.
- set_static_publisher_theme()
- static_publisher_theme()
- unpublishPages()