Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / consolidation / robo / src / Task / Filesystem / MirrorDir.php
diff --git a/vendor/consolidation/robo/src/Task/Filesystem/MirrorDir.php b/vendor/consolidation/robo/src/Task/Filesystem/MirrorDir.php
new file mode 100644 (file)
index 0000000..4eda909
--- /dev/null
@@ -0,0 +1,40 @@
+<?php
+namespace Robo\Task\Filesystem;
+
+use Robo\Result;
+
+/**
+ * Mirrors a directory to another
+ *
+ * ``` php
+ * <?php
+ * $this->taskMirrorDir(['dist/config/' => 'config/'])->run();
+ * // or use shortcut
+ * $this->_mirrorDir('dist/config/', 'config/');
+ *
+ * ?>
+ * ```
+ */
+class MirrorDir extends BaseDir
+{
+    /**
+     * {@inheritdoc}
+     */
+    public function run()
+    {
+        foreach ($this->dirs as $src => $dst) {
+            $this->fs->mirror(
+                $src,
+                $dst,
+                null,
+                [
+                    'override' => true,
+                    'copy_on_windows' => true,
+                    'delete' => true
+                ]
+            );
+            $this->printTaskInfo("Mirrored from {source} to {destination}", ['source' => $src, 'destination' => $dst]);
+        }
+        return Result::success($this);
+    }
+}