summaryrefslogtreecommitdiffstats
path: root/lib/private/App/InfoParser.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/App/InfoParser.php')
-rw-r--r--lib/private/App/InfoParser.php52
1 files changed, 31 insertions, 21 deletions
diff --git a/lib/private/App/InfoParser.php b/lib/private/App/InfoParser.php
index c33e5349f3b..e763364e148 100644
--- a/lib/private/App/InfoParser.php
+++ b/lib/private/App/InfoParser.php
@@ -27,22 +27,14 @@ namespace OC\App;
use OCP\IURLGenerator;
class InfoParser {
- /**
- * @var \OC\HTTPHelper
- */
- private $httpHelper;
- /**
- * @var IURLGenerator
- */
+ /** @var IURLGenerator */
private $urlGenerator;
/**
- * @param \OC\HTTPHelper $httpHelper
* @param IURLGenerator $urlGenerator
*/
- public function __construct(\OC\HTTPHelper $httpHelper, IURLGenerator $urlGenerator) {
- $this->httpHelper = $httpHelper;
+ public function __construct(IURLGenerator $urlGenerator) {
$this->urlGenerator = $urlGenerator;
}
@@ -68,23 +60,32 @@ class InfoParser {
return null;
}
if (!array_key_exists('info', $array)) {
- $array['info'] = array();
+ $array['info'] = [];
}
if (!array_key_exists('remote', $array)) {
- $array['remote'] = array();
+ $array['remote'] = [];
}
if (!array_key_exists('public', $array)) {
- $array['public'] = array();
+ $array['public'] = [];
}
if (!array_key_exists('types', $array)) {
- $array['types'] = array();
+ $array['types'] = [];
+ }
+ if (!array_key_exists('repair-steps', $array)) {
+ $array['repair-steps'] = [];
+ }
+ if (!array_key_exists('pre-migration', $array['repair-steps'])) {
+ $array['repair-steps']['pre-migration'] = [];
+ }
+ if (!array_key_exists('post-migration', $array['repair-steps'])) {
+ $array['repair-steps']['post-migration'] = [];
}
if (array_key_exists('documentation', $array) && is_array($array['documentation'])) {
foreach ($array['documentation'] as $key => $url) {
// If it is not an absolute URL we assume it is a key
// i.e. admin-ldap will get converted to go.php?to=admin-ldap
- if (!$this->httpHelper->isHTTPURL($url)) {
+ if (!$this->isHTTPURL($url)) {
$url = $this->urlGenerator->linkToDocs($url);
}
@@ -100,10 +101,15 @@ class InfoParser {
}
}
} else {
- $array['types'] = array();
+ $array['types'] = [];
}
}
-
+ if (isset($array['repair-steps']['pre-migration']['step']) && is_array($array['repair-steps']['pre-migration']['step'])) {
+ $array['repair-steps']['pre-migration'] = $array['repair-steps']['pre-migration']['step'];
+ }
+ if (isset($array['repair-steps']['post-migration']['step']) && is_array($array['repair-steps']['post-migration']['step'])) {
+ $array['repair-steps']['post-migration'] = $array['repair-steps']['post-migration']['step'];
+ }
return $array;
}
@@ -116,7 +122,7 @@ class InfoParser {
return (string)$xml;
}
- $array = array();
+ $array = [];
foreach ($xml->children() as $element => $node) {
$totalElement = count($xml->{$element});
@@ -129,9 +135,9 @@ class InfoParser {
// Has attributes
if ($attributes = $node->attributes()) {
- $data = array(
- '@attributes' => array(),
- );
+ $data = [
+ '@attributes' => [],
+ ];
if (!count($node->children())){
$value = (string)$node;
if (!empty($value)) {
@@ -161,4 +167,8 @@ class InfoParser {
return $array;
}
+
+ private function isHTTPURL($url) {
+ return stripos($url, 'https://') === 0 || stripos($url, 'http://') === 0;
+ }
}