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
57e97058
Commit
57e97058
authored
12 years ago
by
alvaro
Browse files
Options
Downloads
Plain Diff
Merge remote-tracking branch 'upstream/master'
parents
7023cd54
7a22a9e4
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
utils/lodspk.sh
+12
-4
12 additions, 4 deletions
utils/lodspk.sh
utils/modules/add-variable.php
+30
-0
30 additions, 0 deletions
utils/modules/add-variable.php
with
42 additions
and
4 deletions
utils/lodspk.sh
+
12
−
4
View file @
57e97058
...
@@ -24,7 +24,10 @@ USAGE=$USAGE" List namespaces:\t\t\t\t\t$0 list namespaces\n"
...
@@ -24,7 +24,10 @@ USAGE=$USAGE" List namespaces:\t\t\t\t\t$0 list namespaces\n"
USAGE
=
$USAGE
"
\n
===MODULES===
\n
"
USAGE
=
$USAGE
"
\n
===MODULES===
\n
"
USAGE
=
$USAGE
" Enable module:
\t\t\t\t\t\t
$0
enable module position
\n
"
USAGE
=
$USAGE
" Enable module:
\t\t\t\t\t\t
$0
enable module position
\n
"
USAGE
=
$USAGE
" Disable module:
\t\t\t\t\t
$0
disable module
\n
"
USAGE
=
$USAGE
" Disable module:
\t\t\t\t\t
$0
disable module
\n
"
USAGE
=
$USAGE
" List modules:
\t\t\t\t\t
$0
list modules
\n
"
USAGE
=
$USAGE
" List modules:
\t\t\t\t\t\t
$0
list modules
\n
"
USAGE
=
$USAGE
"
\n
===VARIABLES===
\n
"
USAGE
=
$USAGE
" Add any variable:
\t\t\t\t\t
$0
add variable value
\n
"
USAGE
=
$USAGE
" Where variable has the form conf.something or lodspk.something
\n
"
USAGE
=
$USAGE
"
\n
===ADMIN USER===
\n
"
USAGE
=
$USAGE
"
\n
===ADMIN USER===
\n
"
USAGE
=
$USAGE
" Change password:
\t\t\t\t\t
$0
change password NEWPASSWORD
\n
"
USAGE
=
$USAGE
" Change password:
\t\t\t\t\t
$0
change password NEWPASSWORD
\n
"
USAGE
=
$USAGE
"
\n
===VERSION==
\n
"
USAGE
=
$USAGE
"
\n
===VERSION==
\n
"
...
@@ -131,7 +134,7 @@ fi
...
@@ -131,7 +134,7 @@ fi
## Add
## Add
if
[[
$currentOperation
==
"add"
]]
;
then
if
[[
$currentOperation
==
"add"
]]
;
then
addOperation
=(
endpoint namespace
)
addOperation
=(
endpoint namespace
variable
)
if
[[
${
addOperation
[@]
}
=
~
$2
&&
$2
!=
""
&&
$3
!=
""
]]
if
[[
${
addOperation
[@]
}
=
~
$2
&&
$2
!=
""
&&
$3
!=
""
]]
then
then
addOperation
=
$2
addOperation
=
$2
...
@@ -141,12 +144,17 @@ if [[ $currentOperation == "add" ]]; then
...
@@ -141,12 +144,17 @@ if [[ $currentOperation == "add" ]]; then
exit
1
exit
1
fi
fi
cd
$DIR
/..
cd
$DIR
/..
php
$DIR
/modules/add-
$addOperation
.php
$3
$4
args
=
$@
php
$DIR
/modules/add-
$addOperation
.php
$3
"
${
4
}
"
rc
=
$?
rc
=
$?
if
[[
$rc
!
=
0
]]
;
then
if
[[
$rc
=
123
]]
;
then
echo
-e
"The
$addOperation
with prefix '
$3
' already exist, please remove it first."
>
&2
echo
-e
"The
$addOperation
with prefix '
$3
' already exist, please remove it first."
>
&2
exit
exit
fi
fi
if
[[
$rc
=
124
]]
;
then
echo
-e
"The
$addOperation
with did not stated with 'conf' or 'lodspk'. Please correct that."
>
&2
exit
fi
echo
-e
"The
$addOperation
$4
was added successfully as
$3
!"
>
&2
echo
-e
"The
$addOperation
$4
was added successfully as
$3
!"
>
&2
exit
exit
fi
fi
...
...
This diff is collapsed.
Click to expand it.
utils/modules/add-variable.php
0 → 100644
+
30
−
0
View file @
57e97058
<?php
error_reporting
(
E_ERROR
);
$s
=
'settings.inc.php'
;
$c
=
file_get_contents
(
$s
);
$varArray
=
explode
(
"."
,
$argv
[
1
]);
//Convert varName into a proper variable for LODSPeaKr
$varName
=
array_shift
(
$varArray
);
if
(
$varName
!=
"conf"
&&
$varName
!=
"lodspk"
){
exit
(
124
);
}
$varString
=
$varName
.
"['"
.
join
(
"']['"
,
$varArray
)
.
"'];"
;
$varValue
=
$argv
[
2
];
$newLines
=
array
();
$lines
=
explode
(
"
\n
"
,
$c
);
foreach
(
$lines
as
$k
=>
$v
){
if
(
preg_match
(
"/\?>/"
,
$v
)
==
0
){
if
(
strstr
(
$v
,
$varString
)
===
FALSE
){
array_push
(
$newLines
,
$v
);
}
}
}
$newLine
=
"
\$
"
.
$varString
.
" = '"
.
$varValue
.
"';"
;
array_push
(
$newLines
,
$newLine
);
array_push
(
$newLines
,
"?>"
);
$c
=
implode
(
"
\n
"
,
$newLines
);
file_put_contents
(
$s
,
$c
);
?>
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