mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2024-12-22 13:12:41 +00:00
Fix export of nulls in Conf
This commit is contained in:
parent
d177e52494
commit
bd95d23c8a
4 changed files with 17 additions and 7 deletions
|
@ -13,12 +13,12 @@ At present the software should be considered in an "alpha" state: though its cor
|
||||||
|
|
||||||
The Arsse has the following requirements:
|
The Arsse has the following requirements:
|
||||||
|
|
||||||
- A Web server
|
- A Linux server utilizing systemd and Nginx (tested on Ubuntu 16.04)
|
||||||
- PHP 7.0.7 or newer with the following extensions:
|
- PHP 7.0.7 or newer with the following extensions:
|
||||||
- [intl](http://php.net/manual/en/book.intl.php), [json](http://php.net/manual/en/book.json.php), [hash](http://php.net/manual/en/book.hash.php), and [pcre](http://php.net/manual/en/book.pcre.php)
|
- [intl](http://php.net/manual/en/book.intl.php), [json](http://php.net/manual/en/book.json.php), [hash](http://php.net/manual/en/book.hash.php), and [pcre](http://php.net/manual/en/book.pcre.php)
|
||||||
- [dom](http://php.net/manual/en/book.dom.php), [simplexml](http://php.net/manual/en/book.simplexml.php), and [iconv](http://php.net/manual/en/book.iconv.php) (for picoFeed)
|
- [dom](http://php.net/manual/en/book.dom.php), [simplexml](http://php.net/manual/en/book.simplexml.php), and [iconv](http://php.net/manual/en/book.iconv.php) (for picoFeed)
|
||||||
- [sqlite3](http://php.net/manual/en/book.sqlite3.php)
|
- [sqlite3](http://php.net/manual/en/book.sqlite3.php)
|
||||||
- The ability to run daemon processes on the server
|
- Privileges to create and run daemon processes on the server
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
|
|
12
build.xml
12
build.xml
|
@ -31,10 +31,16 @@
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="package">
|
<target name="package">
|
||||||
<propertyprompt propertyName="arsse.version" defaultValue="head" promptText="Git tag to package"/>
|
<propertyprompt propertyName="arsse.version" defaultValue="head" promptText="Git tag to package"/> <!-- This needs to be used to actually check out a tag, etc -->
|
||||||
<phingcall target="clean"/>
|
<delete> <!-- Delete code, but keep dependencies, which Composer will prune -->
|
||||||
|
<fileset dir="./build/arsse">
|
||||||
|
<exclude name="vendor/**"/>
|
||||||
|
</fileset>
|
||||||
|
</delete>
|
||||||
<phingcall target="build"/>
|
<phingcall target="build"/>
|
||||||
<tar destfile="./build/arsse-${arsse.version}.tar.gz" basedir="./build" compression="gzip"/>
|
<tar destfile="./build/arsse-${arsse.version}.tar.gz" basedir="./build" compression="gzip">
|
||||||
|
<fileset dir="./build" includes="arsse"/>
|
||||||
|
</tar>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -114,11 +114,11 @@ class Conf {
|
||||||
$conf = new \ReflectionObject($this);
|
$conf = new \ReflectionObject($this);
|
||||||
foreach ($conf->getProperties(\ReflectionProperty::IS_PUBLIC) as $prop) {
|
foreach ($conf->getProperties(\ReflectionProperty::IS_PUBLIC) as $prop) {
|
||||||
$name = $prop->name;
|
$name = $prop->name;
|
||||||
// add the property to the output if the value is scalar and either:
|
// add the property to the output if the value is scalar (or null) and either:
|
||||||
// 1. full output has been requested
|
// 1. full output has been requested
|
||||||
// 2. the property is not defined in the class
|
// 2. the property is not defined in the class
|
||||||
// 3. it differs from the default
|
// 3. it differs from the default
|
||||||
if (is_scalar($this->$name) && ($full || !$prop->isDefault() || $this->$name !== $ref->$name)) {
|
if ((is_scalar($this->$name) || is_null($this->$name)) && ($full || !$prop->isDefault() || $this->$name !== $ref->$name)) {
|
||||||
$out[$name] = $this->$name;
|
$out[$name] = $this->$name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,9 +95,11 @@ class TestConf extends Test\AbstractTest {
|
||||||
$conf = new Conf();
|
$conf = new Conf();
|
||||||
$conf->lang = ["en", "fr"]; // should not be exported: not scalar
|
$conf->lang = ["en", "fr"]; // should not be exported: not scalar
|
||||||
$conf->dbSQLite3File = "test.db"; // should be exported: value changed
|
$conf->dbSQLite3File = "test.db"; // should be exported: value changed
|
||||||
|
$conf->userDriver = null; // should be exported: changed value, even when null
|
||||||
$conf->someCustomProperty = "Look at me!"; // should be exported: unknown property
|
$conf->someCustomProperty = "Look at me!"; // should be exported: unknown property
|
||||||
$exp = [
|
$exp = [
|
||||||
'dbSQLite3File' => "test.db",
|
'dbSQLite3File' => "test.db",
|
||||||
|
'userDriver' => null,
|
||||||
'someCustomProperty' => "Look at me!",
|
'someCustomProperty' => "Look at me!",
|
||||||
];
|
];
|
||||||
$this->assertSame($exp, $conf->export());
|
$this->assertSame($exp, $conf->export());
|
||||||
|
@ -112,11 +114,13 @@ class TestConf extends Test\AbstractTest {
|
||||||
$conf = new Conf();
|
$conf = new Conf();
|
||||||
$conf->lang = ["en", "fr"]; // should not be exported: not scalar
|
$conf->lang = ["en", "fr"]; // should not be exported: not scalar
|
||||||
$conf->dbSQLite3File = "test.db"; // should be exported: value changed
|
$conf->dbSQLite3File = "test.db"; // should be exported: value changed
|
||||||
|
$conf->userDriver = null; // should be exported: changed value, even when null
|
||||||
$conf->someCustomProperty = "Look at me!"; // should be exported: unknown property
|
$conf->someCustomProperty = "Look at me!"; // should be exported: unknown property
|
||||||
$conf->exportFile(self::$path."confNotArray");
|
$conf->exportFile(self::$path."confNotArray");
|
||||||
$arr = (include self::$path."confNotArray");
|
$arr = (include self::$path."confNotArray");
|
||||||
$exp = [
|
$exp = [
|
||||||
'dbSQLite3File' => "test.db",
|
'dbSQLite3File' => "test.db",
|
||||||
|
'userDriver' => null,
|
||||||
'someCustomProperty' => "Look at me!",
|
'someCustomProperty' => "Look at me!",
|
||||||
];
|
];
|
||||||
$this->assertSame($exp, $arr);
|
$this->assertSame($exp, $arr);
|
||||||
|
|
Loading…
Reference in a new issue