function publishPages($urls) { parent::publishPages($urls); $base = Director::baseFolder(); $framework = FRAMEWORK_DIR; // Get variable that can turn off the rsync component of publication if (isset($_GET['norsync']) && $_GET['norsync']) { return; } $extraArg = ""; if (self::$excluded_folders) { foreach (self::$excluded_folders as $folder) { $extraArg .= " --exclude " . escapeshellarg($folder); } } foreach (self::$targets as $target) { // Transfer non-PHP content from everything to the target; that will ensure that we have all the JS/CSS/etc $rsyncOutput = `cd {$base}; rsync -av -e ssh --exclude /.htaccess --exclude /web.config --exclude '*.php' --exclude '*.svn' --exclude '*.git' --exclude '*~' {$extraArg} --delete . {$target}`; // Then transfer "safe" PHP from the cache/ directory $rsyncOutput .= `cd {$base}; rsync -av -e ssh --exclude '*.svn' --exclude '*~' {$extraArg} --delete cache {$target}`; // Transfer framework/static-main.php to the target $rsyncOutput .= `cd {$base}; rsync -av -e ssh --delete {$framework}/static-main.php {$target}/{$framework}`; if (StaticPublisher::echo_progress()) { echo $rsyncOutput; } } }
function onAfterWrite() { $urls = array(); $urls[] = ""; // Homepage $sp = new FilesystemPublisher(); $sp->publishPages($urls); parent::onAfterWrite(); }
function publishPages($urls) { parent::publishPages($urls); $base = Director::baseFolder(); // Get variable that can turn off the rsync component of publication if (isset($_GET['norsync']) && $_GET['norsync']) { return; } foreach (self::$targets as $target) { // Transfer non-PHP content from everything to the target; that will ensure that we have all the JS/CSS/etc $rsyncOutput = `cd {$base}; rsync -av -e ssh --exclude /.htaccess --exclude '*.php' --exclude '*.svn' --exclude '*~' --delete . {$target}`; // Then transfer "safe" PHP from the cache/ directory $rsyncOutput .= `cd {$base}; rsync -av -e ssh --exclude '*.svn' --exclude '*~' --delete cache {$target}`; if (StaticPublisher::echo_progress()) { echo $rsyncOutput; } } }
function onAfterWrite() { $sp = new FilesystemPublisher(); $sp->publishPages(Page::get()->first()->allPagesToCache()); parent::onAfterWrite(); }