Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
Nextcloud Notify Push
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Eduardo Trujillo
Nextcloud Notify Push
Commits
04bdbc37
Commit
04bdbc37
authored
3 years ago
by
Robin Appelman
Browse files
Options
Downloads
Patches
Plain Diff
fix migration script
Signed-off-by:
Robin Appelman
<
robin@icewind.nl
>
parent
aa75969d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/BinaryFinder.php
+43
-0
43 additions, 0 deletions
lib/BinaryFinder.php
lib/Migration/Install.php
+6
-5
6 additions, 5 deletions
lib/Migration/Install.php
lib/SetupWizard.php
+6
-15
6 additions, 15 deletions
lib/SetupWizard.php
with
55 additions
and
20 deletions
lib/BinaryFinder.php
0 → 100644
+
43
−
0
View file @
04bdbc37
<?php
declare
(
strict_types
=
1
);
/**
* @copyright Copyright (c) 2021 Robin Appelman <robin@icewind.nl>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace
OCA\NotifyPush
;
class
BinaryFinder
{
public
function
getArch
():
string
{
$arch
=
php_uname
(
'm'
);
if
(
strpos
(
$arch
,
'armv7'
)
===
0
)
{
return
'armv7'
;
}
if
(
strpos
(
$arch
,
'aarch64'
)
===
0
)
{
return
'aarch64'
;
}
return
$arch
;
}
public
function
getBinaryPath
():
string
{
$basePath
=
realpath
(
__DIR__
.
'/../bin/'
);
$arch
=
$this
->
getArch
();
return
"
$basePath
/
$arch
/notify_push"
;
}
}
This diff is collapsed.
Click to expand it.
lib/Migration/Install.php
+
6
−
5
View file @
04bdbc37
...
@@ -23,15 +23,15 @@ declare(strict_types=1);
...
@@ -23,15 +23,15 @@ declare(strict_types=1);
namespace
OCA\NotifyPush\Migration
;
namespace
OCA\NotifyPush\Migration
;
use
OCA\NotifyPush\
SetupWizard
;
use
OCA\NotifyPush\
BinaryFinder
;
use
OCP\Migration\IOutput
;
use
OCP\Migration\IOutput
;
use
OCP\Migration\IRepairStep
;
use
OCP\Migration\IRepairStep
;
class
Install
implements
IRepairStep
{
class
Install
implements
IRepairStep
{
private
$
setupWizard
;
private
$
binaryFinder
;
public
function
__construct
(
SetupWizard
$setupWizard
)
{
public
function
__construct
(
BinaryFinder
$setupWizard
)
{
$this
->
setupWizard
=
$setupWizard
;
$this
->
binaryFinder
=
$setupWizard
;
}
}
public
function
getName
()
{
public
function
getName
()
{
...
@@ -42,6 +42,7 @@ class Install implements IRepairStep {
...
@@ -42,6 +42,7 @@ class Install implements IRepairStep {
* @return void
* @return void
*/
*/
public
function
run
(
IOutput
$output
)
{
public
function
run
(
IOutput
$output
)
{
$this
->
setupWizard
->
testBinary
();
$path
=
$this
->
binaryFinder
->
getBinaryPath
();
@
chmod
(
$path
,
0755
);
}
}
}
}
This diff is collapsed.
Click to expand it.
lib/SetupWizard.php
+
6
−
15
View file @
04bdbc37
...
@@ -31,42 +31,33 @@ use OCP\IConfig;
...
@@ -31,42 +31,33 @@ use OCP\IConfig;
use
Symfony\Component\Console\Output\BufferedOutput
;
use
Symfony\Component\Console\Output\BufferedOutput
;
class
SetupWizard
{
class
SetupWizard
{
private
$appManager
;
private
$queue
;
private
$queue
;
private
$test
;
private
$test
;
private
$client
;
private
$client
;
private
$config
;
private
$config
;
private
$httpsCache
=
[];
private
$httpsCache
=
[];
private
$binaryFinder
;
public
function
__construct
(
public
function
__construct
(
IAppManager
$appManager
,
IQueue
$queue
,
IQueue
$queue
,
SelfTest
$test
,
SelfTest
$test
,
IClientService
$clientService
,
IClientService
$clientService
,
IConfig
$config
IConfig
$config
,
BinaryFinder
$binaryFinder
)
{
)
{
$this
->
appManager
=
$appManager
;
$this
->
queue
=
$queue
;
$this
->
queue
=
$queue
;
$this
->
test
=
$test
;
$this
->
test
=
$test
;
$this
->
client
=
$clientService
->
newClient
();
$this
->
client
=
$clientService
->
newClient
();
$this
->
config
=
$config
;
$this
->
config
=
$config
;
$this
->
binaryFinder
=
$binaryFinder
;
}
}
public
function
getArch
():
string
{
public
function
getArch
():
string
{
$arch
=
php_uname
(
'm'
);
return
$this
->
binaryFinder
->
getArch
();
if
(
strpos
(
$arch
,
'armv7'
)
===
0
)
{
return
'armv7'
;
}
if
(
strpos
(
$arch
,
'aarch64'
)
===
0
)
{
return
'aarch64'
;
}
return
$arch
;
}
}
private
function
getBinaryPath
():
string
{
private
function
getBinaryPath
():
string
{
$basePath
=
realpath
(
__DIR__
.
'/../bin/'
);
return
$this
->
binaryFinder
->
getBinaryPath
();
$arch
=
$this
->
getArch
();
return
"
$basePath
/
$arch
/notify_push"
;
}
}
public
function
hasBundledBinaries
():
bool
{
public
function
hasBundledBinaries
():
bool
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment