forked from LarsSch/privmx
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate-script.php
More file actions
37 lines (32 loc) · 1.49 KB
/
Copy pathupdate-script.php
File metadata and controls
37 lines (32 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
/*************************************************************
This file is distributed under the PrivMX Web Freeware License
See LICENSE.TXT in the main folder of the software package
or https://privmx.com/web-freeware-license
Copyright (c) 2017 Simplito Sp. z o.o.
**************************************************************/
if (class_exists("\\io\\privfs\\plugin\\updater\\UpdateService")) {
class UpdateService2 extends \io\privfs\plugin\updater\UpdateService {
public function performPostUpdateScript($updateID, $service) {
$distFiles = array('talk', 'contact', 'validate');
$distPath = $this->getUpdatePath($updateID, "privmx");
$destPath = $this->getRootDestPath();
foreach ($distFiles as $file) {
$src = self::joinPaths($distPath, $file);
$dest = self::joinPaths($destPath, $file);
$this->writeLogMessage($updateID, "Copy from $src to $dest");
if (!$this->fsCopy($src, $dest)) {
$this->writeLogMessage($updateID, "Can't copy {$src} to {$dest} ");
$error = $this->getError(\io\privfs\plugin\updater\UpdateError::ERROR_COPY_FILES, array("source" => $src, "destination" => $dest));
$this->changeStepStatus($updateID, "copy-files", $this->STATUS_FAILED, $error);
return $error;
}
}
}
}
function postUpdateScript($updateID, $service) {
global $config;
$service2 = new UpdateService2($config);
return $service2->performPostUpdateScript($updateID, $service);
}
}