framework/RedKiteCms/Content/BlockManager/BlockManagerArchive.php
public function archive($sourceDir, array $options, $username, $block)
    {
        $this->resolveOptions($options);

        $block = json_decode($block, true);
        $block["history"] = array();
        $this->init($sourceDir, $options, $username);
        $historyDirName = sprintf('%s/archive/%s', $this->getDirInUse(), $options["blockname"]);
        $historyFileName = $historyDirName . '/history.json';
        if (!is_dir($historyDirName)) {
            mkdir($historyDirName);
        }

        $history = array();
        if (file_exists($historyFileName)) {
            $history = json_decode(file_get_contents($historyFileName), true);
        }
        $history = array_merge($history, array($block["history_name"] => $block));

        FilesystemTools::writeFile($historyFileName, json_encode($history));
    }
public function archive($sourceDir, array $options, $username, $block)
    {
        $this->resolveOptions($options);

        $block = json_decode($block, true);
        $block["history"] = array();
        $this->init($sourceDir, $options, $username);
        $historyDirName = sprintf('%s/archive/%s', $this->getDirInUse(), $options["blockname"]);
        $historyFileName = $historyDirName . '/history.json';
        if (!is_dir($historyDirName)) {
            mkdir($historyDirName);
        }

        $history = array();
        if (file_exists($historyFileName)) {
            $history = json_decode(file_get_contents($historyFileName), true);
        }
        $history = array_merge($history, array($block["history_name"] => $block));

        FilesystemTools::writeFile($historyFileName, json_encode($history));
    }
Archives the given block

@param string $sourceDir
@param array $options
@param string $username
@param array $block