Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
marcus-lodspeakr
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
uib-ub
Spesialsamlingene
marcus-lodspeakr
Commits
8188ae6f
Commit
8188ae6f
authored
3 years ago
by
Stein Magne Bjorklund
Browse files
Options
Downloads
Patches
Plain Diff
Reformat class Importer
parent
c2f1ba09
No related branches found
No related tags found
1 merge request
!18
Resolve "Remove all use of GLOBALS"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
classes/Importer.php
+12
-7
12 additions, 7 deletions
classes/Importer.php
with
12 additions
and
7 deletions
classes/Importer.php
+
12
−
7
View file @
8188ae6f
...
...
@@ -24,7 +24,7 @@ final class Importer
$this
->
configuration
=
$configuration
;
}
public
function
run
()
public
function
run
()
:
void
{
set_time_limit
(
0
);
error_reporting
(
E_ERROR
);
...
...
@@ -36,6 +36,7 @@ final class Importer
$this
->
showInterface
();
exit
(
0
);
}
if
(
!
is_writable
(
'.'
))
{
echo
'The webserver needs write permissions in "lodspeakr/" "lodspeakr/models/" and "lodspeakr/views/" dirs to import settings.'
;
exit
(
0
);
...
...
@@ -53,8 +54,8 @@ final class Importer
HTTPStatus
::
send500
();
exit
(
0
);
}
$triples
=
$parser
->
getTriples
();
$triples
=
$parser
->
getTriples
();
$appArr
=
$this
->
search
(
$triples
,
null
,
RDF
.
'type'
,
LS
.
'Application'
);
if
(
!
(
sizeof
(
$appArr
)
>
0
))
{
echo
"I can't find an application from the URL given"
;
...
...
@@ -72,17 +73,13 @@ final class Importer
(
!
empty
(
$_SERVER
[
'HTTPS'
]))
?
"https://"
.
$_SERVER
[
'SERVER_NAME'
]
.
$_SERVER
[
'REQUEST_URI'
]
:
"http://"
.
$_SERVER
[
'SERVER_NAME'
]
.
$_SERVER
[
'REQUEST_URI'
]
);
//$arr = explode("lodspeakr/benegesserit", $this->basedir);
//$this->basedir = $arr[0];
$content
.
=
"
\$
conf['basedir'] =
\"
$this->basedir
\"
;
\n
"
;
$content
.
=
"
\$
conf['parentApp'] =
\"
$app
\"
;
\n
"
;
$pwd
=
getcwd
();
$content
.
=
"
\$
conf['home'] =
\"
$pwd
/
\"
;
\n
"
;
//App params
$q
=
$this
->
search
(
$triples
,
$app
,
LS
.
'usedParameter'
,
null
);
$appParams
=
array
();
foreach
(
$q
as
$p
)
{
$param
=
$p
[
'o'
];
$labelArr
=
$this
->
search
(
$triples
,
$param
,
RDFS
.
'label'
,
null
);
...
...
@@ -92,6 +89,7 @@ final class Importer
$cnt
=
$cntArr
[
0
][
'o'
];
$appParams
[
$label
]
=
$cnt
;
}
foreach
(
$appParams
as
$k
=>
$v
)
{
$content
.
=
"
\$
conf['
$k
'] =
\"
$v
\"
;
\n
"
;
}
...
...
@@ -109,6 +107,7 @@ final class Importer
$params
=
array
();
$q
=
$this
->
search
(
$triples
,
$component
,
LS
.
'usedParameter'
,
null
);
foreach
(
$q
as
$p
)
{
$param
=
$p
[
'o'
];
$labelArr
=
$this
->
search
(
$triples
,
$param
,
RDFS
.
'label'
,
null
);
...
...
@@ -121,9 +120,11 @@ final class Importer
$inputs
=
array
();
$q
=
$this
->
search
(
$triples
,
$component
,
LS
.
'usedInput'
,
null
);
foreach
(
$q
as
$p
)
{
$param
=
$p
[
'o'
];
$labelArr
=
$this
->
search
(
$triples
,
$param
,
RDFS
.
'label'
,
null
);
if
(
sizeof
(
$labelArr
)
>
0
)
{
$label
=
$labelArr
[
0
][
'o'
];
$format
=
$this
->
search
(
$triples
,
$param
,
DC
.
'hasFormat'
,
null
);
...
...
@@ -132,6 +133,7 @@ final class Importer
$inputs
[
$label
]
=
$cnt
;
}
}
if
(
$compType
==
LS
.
"LodspeakrEndpointManagerComponent"
)
{
$content
.
=
$this
->
createEndpoints
(
$params
);
}
elseif
(
$compType
==
LS
.
"LodspeakrNamespaceManagerComponent"
)
{
...
...
@@ -148,7 +150,9 @@ final class Importer
}
}
}
$content
.
=
"?>
\n
"
;
try
{
$fh
=
fopen
(
FILE
,
'a'
);
fwrite
(
$fh
,
$content
);
...
...
@@ -157,6 +161,7 @@ final class Importer
echo
'Caught exception while writing settings: '
,
$e
->
getMessage
(),
"
\n
"
;
exit
(
1
);
}
$this
->
showFinishing
();
}
...
...
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