commit 85ff51b1823ecbea859015241fd081787f01ca5b
parent 59fe934620c01e26510c1afb762a0e4f1aedd1a6
Author: Jan Dankert <devnull@localhost>
Date: Wed, 14 Nov 2018 22:35:24 +0100
Die Publish-Logik soll auf Dauer aus den Model-Klassen verschwinden. Dies ist eine Vorarbeit.
Diffstat:
2 files changed, 89 insertions(+), 0 deletions(-)
diff --git a/modules/cms-publish/FilePublisher.class.php b/modules/cms-publish/FilePublisher.class.php
@@ -0,0 +1,22 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: dankert
+ * Date: 10.08.18
+ * Time: 23:33
+ */
+
+class FilePublisher
+{
+ public function publish()
+ {
+ if ( ! is_object($this->publish) )
+ $this->publish = new \Publish();
+
+ $this->write();
+ $this->publish->copy( $this->tmpfile(),$this->full_filename(),$this->lastchangeDate );
+
+ $this->publish->publishedObjects[] = $this->getProperties();
+ }
+
+}+
\ No newline at end of file
diff --git a/modules/cms-publish/FolderPublisher.class.php b/modules/cms-publish/FolderPublisher.class.php
@@ -0,0 +1,65 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: dankert
+ * Date: 10.08.18
+ * Time: 23:35
+ */
+
+class FolderPublisher
+{
+ function publish( $withPages,$withFiles,$subdirs = false )
+ {
+ set_time_limit(300);
+ if ( ! is_object($this->publish) )
+ $this->publish = new \Publish();
+
+ foreach( $this->getObjectIds() as $oid )
+ {
+ $o = new BaseObject( $oid );
+ $o->objectLoadRaw();
+
+ if ( $o->isPage && $withPages )
+ {
+ $p = new Page( $oid );
+ $p->load();
+ $p->publish = &$this->publish;
+ $p->publish();
+ }
+
+ if ( $o->isFile && $withFiles )
+ {
+ $f = new File( $oid );
+ $f->load();
+ $f->publish = &$this->publish;
+ $f->publish();
+ }
+
+ if ( $o->isImage && $withFiles )
+ {
+ $f = new Image( $oid );
+ $f->load();
+ $f->publish = &$this->publish;
+ $f->publish();
+ }
+
+ if ( $o->isText && $withFiles )
+ {
+ $f = new Text( $oid );
+ $f->load();
+ $f->publish = &$this->publish;
+ $f->publish();
+ }
+
+ if ( $o->isFolder && $subdirs )
+ {
+ $f = new Folder( $oid );
+ $f->load();
+ $f->publish = &$this->publish;
+ $f->publish( $withPages,$withFiles,true );
+ }
+ }
+ }
+
+
+}+
\ No newline at end of file