<?php
namespace Moto\System\Backup\Step; use Moto; use Carbon\Carbon; class InitStep extends Moto\System\Backup\Step\AbstractStep { const NAME = 'init'; public function handle($backup) { Moto\Util::emptyDir($backup->getAbsoluteTempPath()); if (!class_exists('ZipArchive')) { return $this->returnError(array('name' => 'CLASS_NOT_EXISTS', 'params' => array('class' => 'ZipArchive'))); } return $this->returnCompleted(); } public function testHandle($backup) { $backup->addEmptyDir('mt-admin'); $backup->addEmptyDir('mt-content'); $backup->addFile('@website/index.php', 'index.php'); $backup->addFile('@website/mt-admin/index.php', 'mt-admin/index.php'); $backup->save(); if (1===1) { $storage = $backup->getCurrentStorage(); echo 'getCurrentStorage : ' . get_class($storage) . "\n"; $backup->attachDiskStorage(); $backup->flush(); $storage = $backup->getCurrentStorage(); echo 'getCurrentStorage : ' . get_class($storage) . "\n"; $backup->attachArchiveStorage(); echo 'getCurrentStorage : ' . get_class($storage) . "\n\n"; var_export($backup->addFile('@website/index.php', 'index.php')); echo "\n\n"; $backup->flush(); } $storage = $backup->getCurrentStorage(); echo 'getCurrentStorage : ' . get_class($storage) . "\n"; return $this->returnCompleted(); echo "\n\n"; echo 'getStorage : '. get_class($backup->getStorage()) . ' => ' . print_r($backup->getStorage()->getDump(), 1) . "\n"; $backup->switchToStorage('disk'); echo 'getStorage : '. get_class($backup->getStorage()) . ' => ' . print_r($backup->getStorage()->getDump(), 1) . "\n"; exit; } } 