Skip to content

Commit ffbeba4

Browse files
Update xsd schema url
1 parent 0ab5ab9 commit ffbeba4

File tree

5 files changed

+25
-16
lines changed

5 files changed

+25
-16
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ Simple configuration example in XML:
151151
```xml
152152
<?xml version="1.0" encoding="UTF-8"?>
153153
<phpbu xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
154-
xsi:noNamespaceSchemaLocation="http://schema.phpbu.de/6.0/phpbu.xsd"
154+
xsi:noNamespaceSchemaLocation="https://www.phpbu.de/schema/6.0/phpbu.xsd"
155155
verbose="true">
156156
<backups>
157157
<backup name="myAppDB">

phpbu.xml.sample

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpbu xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:noNamespaceSchemaLocation="http://schema.phpbu.de/6.0/phpbu.xsd"
3+
xsi:noNamespaceSchemaLocation="https://www.phpbu.de/schema/6.0/phpbu.xsd"
44
verbose="true">
55

66
<logging>

src/Configuration/Generator.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace phpbu\App\Configuration;
44

5+
use function str_replace;
6+
57
final class Generator
68
{
79
/**
@@ -10,20 +12,20 @@ final class Generator
1012
const TEMPLATE_XML = <<<EOT
1113
<?xml version="1.0" encoding="UTF-8"?>
1214
<phpbu xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
13-
xsi:noNamespaceSchemaLocation="https://schema.phpbu.de/{phpbu_version}/phpbu.xsd"
15+
xsi:noNamespaceSchemaLocation="https://www.phpbu.de/schema/{phpbu_version}/phpbu.xsd"
1416
bootstrap="{bootstrap_script}"
1517
verbose="true">
16-
18+
1719
<!-- uncomment if you want to use an adapter
1820
<adapters>
1921
</adapters>
2022
-->
21-
23+
2224
<!-- uncomment if you want to use logging
2325
<logging>
2426
</logging>
2527
-->
26-
28+
2729
<backups>
2830
<backup name="__FIXME__">
2931
<source type="__FIXME__">
@@ -76,7 +78,7 @@ final class Generator
7678
*/
7779
public function generateConfigurationSkeleton(string $version, string $format, string $bootstrapScript) : string
7880
{
79-
return \str_replace(
81+
return str_replace(
8082
[
8183
'{phpbu_version}',
8284
'{bootstrap_script}'

src/Configuration/Loader/Xml.php

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,28 @@
11
<?php
22
namespace phpbu\App\Configuration\Loader;
33

4+
use DOMDocument;
45
use DOMElement;
56
use DOMXPath;
67
use phpbu\App\Configuration;
78
use phpbu\App\Configuration\Loader;
89
use phpbu\App\Exception;
910
use phpbu\App\Util\Str;
1011

12+
use function defined;
13+
use function libxml_clear_errors;
14+
use function libxml_get_errors;
15+
use function libxml_use_internal_errors;
16+
use function trim;
17+
1118
/**
1219
* Loader for a phpbu XML configuration file.
1320
*
1421
* Example XML configuration file:
1522
* <code>
1623
* <?xml version="1.0" encoding="UTF-8" ?>
1724
* <phpbu xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
18-
* xsi:noNamespaceSchemaLocation="http://schema.phpbu.de/1.1/phpbu.xsd"
25+
* xsi:noNamespaceSchemaLocation="https://www.phpbu.de/schema/1.1/phpbu.xsd"
1926
* bootstrap="backup/bootstrap.php"
2027
* verbose="true">
2128
*
@@ -375,7 +382,7 @@ protected function getOptions(DOMElement $node)
375382
private function loadXmlFile($filename)
376383
{
377384
$contents = $this->loadFile($filename);
378-
$document = new \DOMDocument;
385+
$document = new DOMDocument;
379386
$message = '';
380387
$internal = libxml_use_internal_errors(true);
381388
$reporting = error_reporting(0);
@@ -409,19 +416,19 @@ private function loadXmlFile($filename)
409416
*/
410417
private function validateConfigurationAgainstSchema()
411418
{
412-
$original = \libxml_use_internal_errors(true);
419+
$original = libxml_use_internal_errors(true);
413420
$xsdFilename = __DIR__ . '/../../../phpbu.xsd';
414-
if (\defined('__PHPBU_PHAR_ROOT__')) {
421+
if (defined('__PHPBU_PHAR_ROOT__')) {
415422
$xsdFilename = __PHPBU_PHAR_ROOT__ . '/phpbu.xsd';
416423
}
417424
$this->document->schemaValidate($xsdFilename);
418-
foreach (\libxml_get_errors() as $error) {
425+
foreach (libxml_get_errors() as $error) {
419426
if (!isset($this->errors[$error->line])) {
420427
$this->errors[$error->line] = [];
421428
}
422-
$this->errors[$error->line][] = \trim($error->message);
429+
$this->errors[$error->line][] = trim($error->message);
423430
}
424-
\libxml_clear_errors();
425-
\libxml_use_internal_errors($original);
431+
libxml_clear_errors();
432+
libxml_use_internal_errors($original);
426433
}
427434
}

tests/phpbu/Configuration/GeneratorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function testGenerateConfigurationSkeletonXml()
2525
$config = $generator->generateConfigurationSkeleton('X.Y', 'xml', 'boot.php');
2626

2727
$this->assertStringContainsString('bootstrap="boot.php"', $config);
28-
$this->assertStringContainsString('xsi:noNamespaceSchemaLocation="https://schema.phpbu.de/X.Y/phpbu.xsd"', $config);
28+
$this->assertStringContainsString('xsi:noNamespaceSchemaLocation="https://www.phpbu.de/schema/X.Y/phpbu.xsd"', $config);
2929
}
3030

3131
/**

0 commit comments

Comments
 (0)