Skip to content

Commit

Permalink
pkp#33 Pass the userid instead of the whole user object
Browse files Browse the repository at this point in the history
  • Loading branch information
ctgraham committed Oct 17, 2019
1 parent b461f23 commit e441f2f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions TextureHandler.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ public function media($args, $request) {
*/
protected function _createDependentFile($genreId, $mediaData, $submission, $submissionFile, $user) {
$mediaBlob = base64_decode(preg_replace('#^data:\w+/\w+;base64,#i', '', $mediaData["data"]));
return $this->_plugin->createDependentFile($genreId, $mediaBlob, $submission, $submissionFile, $user);
return $this->_plugin->createDependentFile($genreId, $mediaBlob, $submission, $submissionFile, $user->getId());
}

/**
Expand All @@ -389,7 +389,7 @@ protected function _createDependentFile($genreId, $mediaData, $submission, $subm
*/
protected function _updateManuscriptFile($fileStage, $genreId, $resources, $submission, $submissionFile, $user) {
$manuscriptXml = $resources['manuscript.xml']->data;
return $this->_plugin->updateManuscriptFile($fileStage, $genreId, $manuscriptXml, $submission, $submissionFile, $user);
return $this->_plugin->updateManuscriptFile($fileStage, $genreId, $manuscriptXml, $submission, $submissionFile, $user->getId());
}

/**
Expand Down
12 changes: 6 additions & 6 deletions TexturePlugin.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,10 @@ public function templateFetchCallback($hookName, $params) {
* @param $mediaData string Dependent media file contents
* @param $submission Submission Submission to which to attach the dependent file
* @param $submissionFile SubmissionFile Submission file to which to attach the dependent file
* @param $user User Submitting user
* @param $userid int Submitting user
* @return SubmissionArtworkFile
*/
public function createDependentFile($genreId, $mediaData, $submission, $submissionFile, $user) {
public function createDependentFile($genreId, $mediaData, $submission, $submissionFile, $userid) {
$tmpfname = tempnam(sys_get_temp_dir(), 'texture');
file_put_contents($tmpfname, $mediaData);

Expand All @@ -156,7 +156,7 @@ public function createDependentFile($genreId, $mediaData, $submission, $submissi
$newMediaFile->setFileStage(SUBMISSION_FILE_DEPENDENT);
$newMediaFile->setDateUploaded(Core::getCurrentDate());
$newMediaFile->setDateModified(Core::getCurrentDate());
$newMediaFile->setUploaderUserId($user->getId());
$newMediaFile->setUploaderUserId($userid);
$newMediaFile->setFileSize(filesize($tmpfname));
$newMediaFile->setFileType($mediaData["fileType"]);
$newMediaFile->setAssocId($submissionFile->getFileId());
Expand All @@ -176,10 +176,10 @@ public function createDependentFile($genreId, $mediaData, $submission, $submissi
* @param $manuscriptXml string Manuscript XML content
* @param $submission Submission Submission to which to attach the new SubmissionFile
* @param $submissionFile SubmissionFile Original submission file to update
* @param $user User Submitting user
* @param $userid User Submitting user
* @return SubmissionFile
*/
public function updateManuscriptFile($fileStage, $genreId, $manuscriptXml, $submission, $submissionFile, $user) {
public function updateManuscriptFile($fileStage, $genreId, $manuscriptXml, $submission, $submissionFile, $userid) {
$tmpfname = tempnam(sys_get_temp_dir(), 'texture');
file_put_contents($tmpfname, $manuscriptXml);

Expand All @@ -196,7 +196,7 @@ public function updateManuscriptFile($fileStage, $genreId, $manuscriptXml, $subm
$newSubmissionFile->setDateUploaded(Core::getCurrentDate());
$newSubmissionFile->setDateModified(Core::getCurrentDate());
$newSubmissionFile->setOriginalFileName($submissionFile->getOriginalFileName());
$newSubmissionFile->setUploaderUserId($user->getId());
$newSubmissionFile->setUploaderUserId($userid);
$newSubmissionFile->setFileSize($fileSize);
$newSubmissionFile->setFileType($submissionFile->getFileType());
$newSubmissionFile->setSourceFileId($submissionFile->getFileId());
Expand Down

0 comments on commit e441f2f

Please sign in to comment.