Webylon 3.2 API Docs
  • Package
  • Class
  • Tree
  • Deprecated
  • Download
Version: current
  • 3.2
  • 3.1

Packages

  • 1c
    • exchange
      • catalog
  • auth
  • Booking
  • building
    • company
  • cart
    • shipping
    • steppedcheckout
  • Catalog
    • monument
  • cms
    • assets
    • batchaction
    • batchactions
    • bulkloading
    • comments
    • content
    • core
    • export
    • newsletter
    • publishers
    • reports
    • security
    • tasks
  • Dashboard
  • DataObjectManager
  • event
  • faq
  • forms
    • actions
    • core
    • fields-basic
    • fields-dataless
    • fields-datetime
    • fields-files
    • fields-formatted
    • fields-formattedinput
    • fields-relational
    • fields-structural
    • transformations
    • validators
  • googlesitemaps
  • guestbook
  • installer
  • newsletter
  • None
  • photo
    • gallery
  • PHP
  • polls
  • recaptcha
  • sapphire
    • api
    • bulkloading
    • control
    • core
    • cron
    • dev
    • email
    • fields-formattedinput
    • filesystem
    • formatters
    • forms
    • i18n
    • integration
    • misc
    • model
    • parsers
    • search
    • security
    • tasks
    • testing
    • tools
    • validation
    • view
    • widgets
  • seo
    • open
      • graph
  • sfDateTimePlugin
  • spamprotection
  • stealth
    • captha
  • subsites
  • userform
    • pagetypes
  • userforms
  • webylon
  • widgets

Classes

  • FilesystemPublisher
  • RsyncMultiHostPublisher
  • StaticPublisher
 1 <?php
 2 
 3 /**
 4  * This static publisher can be used to deploy static content to multiple hosts, by generating the cache files locally and then rsyncing then to
 5  * each destination box.  This can be used to set up a load-balanced collection of static servers.
 6  * 
 7  * @see http://doc.silverstripe.com/doku.php?id=staticpublisher
 8  *
 9  * @package cms
10  * @subpackage publishers
11  */
12 class RsyncMultiHostPublisher extends FilesystemPublisher {
13     /**
14      * Array of rsync targets to publish to.  These can either be local file names, or scp-style targets, in the form "user@server:path"
15      */
16     static $targets;
17     
18     /**
19      * Set the targets to publish to.
20      * If target is an scp-style remote path, no password is accepted - we assume key-based authentication to be set up on the application server
21      * initiating the publication.
22      * 
23      * @param $targets An array of targets to publish to.  These can either be local file names, or scp-style targets, in the form "user@server:path"
24      */
25     static function set_targets($targets) {
26         self::$targets = $targets;
27     }
28 
29     function publishPages($urls) {
30         parent::publishPages($urls);
31         $base = Director::baseFolder();
32 
33         // Get variable that can turn off the rsync component of publication 
34         if(isset($_GET['norsync']) && $_GET['norsync']) return;
35         
36         foreach(self::$targets as $target) {
37             // Transfer non-PHP content from everything to the target; that will ensure that we have all the JS/CSS/etc
38             $rsyncOutput = `cd $base; rsync -av -e ssh --exclude /.htaccess --exclude '*.php' --exclude '*.svn' --exclude '*~' --delete . $target`;
39             // Then transfer "safe" PHP from the cache/ directory
40             $rsyncOutput .= `cd $base; rsync -av -e ssh --exclude '*.svn' --exclude '*~' --delete cache $target`;
41             if(StaticPublisher::echo_progress()) echo $rsyncOutput;
42         }
43     }
44     
45 }
46 
[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -
Webylon 3.2 API Docs API documentation generated by ApiGen 2.8.0