예제 #1
0
    else
    {
        $title = 'CATS Backup';
    }

    $attachmentCreator = new AttachmentCreator(CATS_ADMIN_SITE);
    $attachmentCreator->createFromFile(
        DATA_ITEM_COMPANY, $companyID, 'catsbackup.bak', $title, 'catsbackup',
        false, false
    );
    if ($attachmentCreator->isError())
    {
        die($attachmentCreator->getError());
    }
    
    $attachmentID = $attachmentCreator->getAttachmentID();
    $directory = $attachmentCreator->getContainingDirectory();

    $_SESSION['CATS']->storeValueByName('backupDirectory', $directory);

    /* Build request parameters. */
    $extraPOSTData = '&attachmentID=' . $attachmentID;
    if ($attachmentsOnly)
    {
        $extraPOSTData .= '&attachmentsOnly=true';
    }

    echo '<script type="text/javascript">watchBackup(\'', $directory,
        '\', \'', $extraPOSTData, '\', \'settings:backup\');</script>';

}