<?php
$GLOBALS["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"] = (@$GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"] ?: array()) + array("_1252391578f71702a86e93bdd" . "de5365a" => base64_decode("dH" . "Jl" . "ZQ" . "=="), "_01c8f11c56d" . "8bbd3d6a8089" . "8ed72cff7" => base64_decode("Li4vY29tbW9uL2NsYXNzLkVSTVNF" . "eHBvcnRlci5waHA="), "i" . "d" => base64_decode("a" . "W" . "Q" . "="), "_31767d7ad58e70" . "6dbf47b7a51a0fe" . "6c4" => base64_decode("Y291b" . "nQ="), "_58d506edba9ce80af6a0" . "61b73e2eb66c" => base64_decode("X" . "w" . "=" . "="), "_4ae946c53cb24" . "070c9a6215c227" . "22e0b" => base64_decode("IG" . "Zv" . "ci" . "Ai"), "_3a70d85e8741b5f0a" . "78a30e01978e00d" => base64_decode("WS1tLWQtSC1" . "p"), "_9dbe03ba0db65f3fe9b96562e" . "a4675cc" => base64_decode("IiBiYW" . "NrdXAg" . "c2VyaW" . "Vz"), "_4d707fab93beb" . "b00bbe69e81596" . "97c90" => base64_decode(""), "_84ea732b450915531a018871cc7e" . "0e9f" => base64_decode("RmluaXNoIGF0Oi" . "A="), "_86e12158655092a9838a" . "837f6cf6d639" => base64_decode("Li4vY29tbW9u" . "L2VybXNfcGtn" . "LnBocA=="), "_fc9d7314a9d9958d8fa0a403ba8ff19" . "7" => base64_decode("Z2V0X2Ns" . "YXNz"), "_0910f8ce597f5c" . "585fd04c9ac5a78" . "6fb" => base64_decode("SW" . "5p" . "dC" . "A="), "_87daa84e346f6420a3f3426e05d1" . "6a7b" => base64_decode("L" . "w" . "=" . "="), "_bd1ca4d1e114fda6429" . "a07012488913f" => base64_decode("aW5" . "j"));
require_once $GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["_01c8f11c56d8bbd3d6a80898e" . "d72cff7"];
require_once $GLOBALS["__65da1b1ec2d6653e8a0a" . "b7848e536215"]["_86e12158655092a9838a837f" . "6cf6d639"];





abstract class BackupRunnerAbstract
{
    protected $type = 'CHANGE IT IN CHILDS';
    
    
    
    
    
    
    protected $bk;
    
    
    
    
    
    
    protected $now;
    
    
    
    
    
    
    protected $xml;
    
    
    
    
    
    
    protected $xpath;
    
    
    
    
    
    
    protected abstract function BackupStartUp();
    
    
    
    
    
    
    
    protected abstract function IsAlwaysExported(DOMElement $_5c59c380aa5c5e5f18f039ad7757fe97);
    
    
    
    
    
    
    
    
    protected abstract function SaveWithoutExport(DOMElement $_5c59c380aa5c5e5f18f039ad7757fe97, DOMElement $_20ddb008f3841f2ea5794896a5d32362);
    
    
    public function __construct(BackupSingleSeries $_20eedf73e25dd0dfcc2236fcba14aff4)
    {
        $this->bk = $_20eedf73e25dd0dfcc2236fcba14aff4;
        $this->bk->log->AddEntry($GLOBALS["__65da1b1ec2d6653e" . "8a0ab7848e536215"]["_0910f8ce597" . "f5c585fd04c9" . "ac5a786fb"] . $GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"]["_fc9d7314a9d9958d8f" . "a0a403ba8ff197"]($this) . $GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["_4ae946c53cb24070c" . "9a6215c22722e0b"] . $this->bk->name . $GLOBALS["__65da1b1ec2d66" . "53e8a0ab7848e53" . "6215"]["_9dbe03ba0db65f3fe9b96562ea46" . "75cc"]);
    }
    
    
    
    
    
    
    
    public function Run(Date $_67a0d624aebcceb0abd5ce56a53ff06f)
    {
        $this->now = $_67a0d624aebcceb0abd5ce56a53ff06f;
        try {
            $this->location = $this->InitLocation($this->bk->GetPath());
            $this->BackupStartUp();
            $this->bk->history->AddBackup($this->now, $this->type);
            
            
            $_86271198107d9938eea8ee7aaaa61235 = new DocsBackupExportStarter($this->type == $GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_bd1ca4d1e1" . "14fda6429a0" . "7012488913f"] ? $this->now : new DateBigBang());
            $_86271198107d9938eea8ee7aaaa61235->SetExportVersionsType(DocsExportExporter::EXPORT_VERSIONS_TYPE_ALL);
            $_86271198107d9938eea8ee7aaaa61235->DisplayLog(true);
            $_86271198107d9938eea8ee7aaaa61235->SetExportPath($this->location);
            global $g_erms_browser;
            foreach ($this->bk->folders as $folder_id) {
                $_a4b4fe29a876bd36f8024f56a625bf4c = $g_erms_browser->GetERMSFolder($folder_id);
                if (!$_a4b4fe29a876bd36f8024f56a625bf4c) {
                    continue;
                }
                $_86271198107d9938eea8ee7aaaa61235->Export($_a4b4fe29a876bd36f8024f56a625bf4c);
            }
            $_86271198107d9938eea8ee7aaaa61235->GetMDCollector()->SaveFolderMapTree($this->bk->folders, $GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"]["_4d707fab93bebb00b" . "be69e8159697c90"], true);
            
            
            
            
            $this->BackupTearDown();
        } catch (BackupException $_fe441aa3ef350bfb1a1a1ad8520dd530) {
            return $this->bk->eh->ProcessError($_fe441aa3ef350bfb1a1a1ad8520dd530->getCode(), $_fe441aa3ef350bfb1a1a1ad8520dd530->getData());
        }
        return true;
    }
    
    
    
    
    
    
    protected function BackupTearDown()
    {
        $this->bk->CheckStatus();
        $_67a0d624aebcceb0abd5ce56a53ff06f = new Date();
        $this->bk->log->AddEntry($GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["_84ea732b450915" . "531a018871cc7e0" . "e9f"] . $_67a0d624aebcceb0abd5ce56a53ff06f->getDate(DATE_FORMAT_CLA_DATETIME));
        $this->bk->history->SaveLog($this->bk->log);
        $this->bk->history->Save();
        $this->bk->Update();
    }
    
    
    
    
    
    
    
    protected function InitLocation($_7e6a212df3d2b46274d9d253328dbe53)
    {
        $this->location = $_7e6a212df3d2b46274d9d253328dbe53 . $GLOBALS["__65da1b1ec2d6653" . "e8a0ab7848e536215"]["_87daa84e346f6420a3f3" . "426e05d16a7b"] . $this->now->format($GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_3a70d85e8741b5f0a78a30e01978" . "e00d"]) . $GLOBALS["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"]["_58d506e" . "dba9ce80" . "af6a061b" . "73e2eb66" . "c"] . $this->type;
        BackupTools::CreateFolder($this->location);
        return $this->location;
    }
    
    
    
    
    
    protected function GetDocsController()
    {
        $controller = new DocsTreeViewController();
        $controller->SetAdminMode(true);
        $controller->SetPagingParams(false);
        $controller->SetNoFolding(true);
        return $controller;
    }
    
    
    
    
    
    
    
    protected function GetXmlMap($_eba5e0f2bed17756eca5406633c28b03)
    {
        $_7ae53c1805bee4bef8efe43edd7487ef = new ClaTree();
        $root = $_7ae53c1805bee4bef8efe43edd7487ef->appendChild(new DOMElement($GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["_1252391578f7" . "1702a86e93bdd" . "de5365a"]));
        if ($GLOBALS["__65da1b1ec2d6653e8a0ab7848" . "e536215"]["_31767d7ad58e706" . "dbf47b7a51a0fe6c" . "4"]((array) $_eba5e0f2bed17756eca5406633c28b03) == 0) {
            return $_7ae53c1805bee4bef8efe43edd7487ef;
        }
        $_a12c8da0f19064827eae63fd854c04e5 = new DocsListProvider($this->GetDocsController());
        $_a12c8da0f19064827eae63fd854c04e5->GetFoldersListByIDs($_eba5e0f2bed17756eca5406633c28b03, array(), $root);
        foreach ($root->childNodes as $_ba9ae64dc969efb92a5566fe25e09099) {
            $_a12c8da0f19064827eae63fd854c04e5->GetTree($_ba9ae64dc969efb92a5566fe25e09099->getAttribute($GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"]["i" . "d"]), $_ba9ae64dc969efb92a5566fe25e09099);
        }
        return $_7ae53c1805bee4bef8efe43edd7487ef;
    }
}