Skip to content

Commit

Permalink
Merge pull request #61 from openjournalteam/53-fix-permission-34
Browse files Browse the repository at this point in the history
53 fix permission 34
  • Loading branch information
rahmanramsi authored Nov 28, 2023
2 parents 4dbe867 + 1d507da commit f5b302d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### 3.0.1.1 : 21 Nov 2023
- Fix error when installing plugin because ojs root folder is restricted to write

### 3.0.1.0 : 21 Oct 2023
- Integration with OJT Support platform

Expand Down
17 changes: 6 additions & 11 deletions OjtControlPanelPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -399,16 +399,11 @@ public function updatePanel($url)
}

// Download file
$file_name = "OJTPanel.zip";

// place file to root of ojs
if (!$file = file_get_contents($url)) {
throw new Exception('Failed to download Plugin');
}
if (!file_put_contents($file_name, $file)) {
throw new Exception('Failed to make a temporary plugin file');
}

$file_name = Config::getVar('files', 'files_dir') . DIRECTORY_SEPARATOR . 'OJTPanel.zip';
$resource = \GuzzleHttp\Psr7\Utils::tryFopen($file_name, 'w');
$stream = \GuzzleHttp\Psr7\Utils::streamFor($resource);
$this->getHttpClient()->request('GET', $url, ['sink' => $stream]);

$zip = new \ZipArchive;
if (!$zip->open($file_name)) {
unlink($file_name);
Expand Down Expand Up @@ -637,7 +632,7 @@ public function installPlugin($url)
$url = str_replace('https', 'http', $url);

// Download file
$file_name = __DIR__ . DIRECTORY_SEPARATOR . 'OJTTemporaryFile.zip';
$file_name = Config::getVar('files', 'files_dir') . DIRECTORY_SEPARATOR . 'OJTTemporaryFile.zip';
$resource = \GuzzleHttp\Psr7\Utils::tryFopen($file_name, 'w');
$stream = \GuzzleHttp\Psr7\Utils::streamFor($resource);
$this->getHttpClient()->request('GET', $url, ['sink' => $stream]);
Expand Down
4 changes: 2 additions & 2 deletions version.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<version>
<application>ojtControlPanel</application>
<type>plugins.generic</type>
<release>3.0.1.0</release>
<date>2023-10-21</date>
<release>3.0.1.1</release>
<date>2023-11-28</date>
<lazy-load>0</lazy-load>
<class>OjtControlPanelPlugin</class>
</version>

0 comments on commit f5b302d

Please sign in to comment.