add postinst doc
fix php 7.3 compatibility issues of typed properties
This commit is contained in:
parent
f1c49ea049
commit
2bfe3c28b2
26
.codeclimate.yml
Normal file
26
.codeclimate.yml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
version: "2"
|
||||||
|
checks:
|
||||||
|
argument-count:
|
||||||
|
config:
|
||||||
|
threshold: 5
|
||||||
|
complex-logic:
|
||||||
|
config:
|
||||||
|
threshold: 4
|
||||||
|
file-lines:
|
||||||
|
config:
|
||||||
|
threshold: 350
|
||||||
|
method-complexity:
|
||||||
|
config:
|
||||||
|
threshold: 5
|
||||||
|
method-count:
|
||||||
|
config:
|
||||||
|
threshold: 20
|
||||||
|
method-lines:
|
||||||
|
config:
|
||||||
|
threshold: 60
|
||||||
|
nested-control-flow:
|
||||||
|
config:
|
||||||
|
threshold: 4
|
||||||
|
return-statements:
|
||||||
|
config:
|
||||||
|
threshold: 4
|
@ -4,6 +4,7 @@ stages:
|
|||||||
- prepare
|
- prepare
|
||||||
- build
|
- build
|
||||||
- test
|
- test
|
||||||
|
- packaging
|
||||||
- deploy
|
- deploy
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
@ -11,7 +12,6 @@ cache:
|
|||||||
- node_modules/
|
- node_modules/
|
||||||
|
|
||||||
include:
|
include:
|
||||||
- template: SAST.gitlab-ci.yml
|
|
||||||
- template: Code-Quality.gitlab-ci.yml
|
- template: Code-Quality.gitlab-ci.yml
|
||||||
|
|
||||||
variables:
|
variables:
|
||||||
@ -52,6 +52,24 @@ coverage:
|
|||||||
- ./coverage/cobertura-coverage.xml
|
- ./coverage/cobertura-coverage.xml
|
||||||
needs: ["prepare"]
|
needs: ["prepare"]
|
||||||
|
|
||||||
|
package_debian:
|
||||||
|
stage: packaging
|
||||||
|
image: debian
|
||||||
|
script:
|
||||||
|
- cd deb
|
||||||
|
- mkdir -p "./OpenMediaCenter/var/www/openmediacenter/videos/"
|
||||||
|
- mkdir -p "./OpenMediaCenter/tmp/"
|
||||||
|
- cp -r ../build/* ./OpenMediaCenter/var/www/openmediacenter/
|
||||||
|
- cp -r ../api ./OpenMediaCenter/var/www/openmediacenter/
|
||||||
|
- cp ../database.sql ./OpenMediaCenter/tmp/openmediacenter.sql
|
||||||
|
- chmod -R 0775 *
|
||||||
|
- dpkg-deb --build OpenMediaCenter
|
||||||
|
- mv OpenMediaCenter.deb OpenMediaCenter-0.1_amd64.deb
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- deb/OpenMediaCenter-0.1_amd64.deb
|
||||||
|
needs: ["build"]
|
||||||
|
|
||||||
deploy_test1:
|
deploy_test1:
|
||||||
stage: deploy
|
stage: deploy
|
||||||
image: luki42/alpineopenssh:latest
|
image: luki42/alpineopenssh:latest
|
||||||
|
@ -6,13 +6,13 @@
|
|||||||
* Class with all neccessary stuff for the Database connections.
|
* Class with all neccessary stuff for the Database connections.
|
||||||
*/
|
*/
|
||||||
class Database {
|
class Database {
|
||||||
private static ?Database $instance = null;
|
private static $instance = null;
|
||||||
private mysqli $conn;
|
private $conn;
|
||||||
|
|
||||||
private string $servername = "192.168.0.30";
|
private $servername = "127.0.0.1";
|
||||||
private string $username = "root";
|
private $username = "mediacenteruser";
|
||||||
private string $password = "1qayxsw2";
|
private $password = "mediapassword";
|
||||||
private string $dbname = "mediacenter";
|
private $dbname = "mediacenter";
|
||||||
|
|
||||||
// The db connection is established in the private constructor.
|
// The db connection is established in the private constructor.
|
||||||
private function __construct() {
|
private function __construct() {
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* class handling all Settings used by php scripts
|
* class handling all Settings used by php scripts
|
||||||
*/
|
*/
|
||||||
class SSettings {
|
class SSettings {
|
||||||
private ?Database $database;
|
private $database;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SSettings constructor.
|
* SSettings constructor.
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
require_once 'src/Database.php';
|
require_once 'src/Database.php';
|
||||||
|
|
||||||
abstract class RequestBase {
|
abstract class RequestBase {
|
||||||
protected mysqli $conn;
|
protected $conn;
|
||||||
private array $actions = array();
|
private $actions = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* adds a new action handler to the current api file
|
* adds a new action handler to the current api file
|
||||||
|
@ -7,7 +7,7 @@ require_once 'RequestBase.php';
|
|||||||
* backend for all interactions with videoloads and receiving of video infos
|
* backend for all interactions with videoloads and receiving of video infos
|
||||||
*/
|
*/
|
||||||
class Video extends RequestBase {
|
class Video extends RequestBase {
|
||||||
private string $videopath;
|
private $videopath;
|
||||||
|
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
$settings = new SSettings();
|
$settings = new SSettings();
|
||||||
|
@ -30,16 +30,14 @@ create table if not exists video_tags
|
|||||||
on delete cascade
|
on delete cascade
|
||||||
);
|
);
|
||||||
|
|
||||||
create table settings
|
create table if not exists settings
|
||||||
(
|
(
|
||||||
id enum(1) NOT NULL default 0,
|
|
||||||
video_path varchar(255) null,
|
video_path varchar(255) null,
|
||||||
episode_path varchar(255) null,
|
episode_path varchar(255) null,
|
||||||
password varchar(32) default '-1' null,
|
password varchar(32) default '-1' null,
|
||||||
mediacenter_name varchar(32) default 'OpenMediaCenter' null,
|
mediacenter_name varchar(32) default 'OpenMediaCenter' null,
|
||||||
TMDB_grabbing tinyint null,
|
TMDB_grabbing tinyint null,
|
||||||
DarkMode tinyint default 0 null
|
DarkMode tinyint default 0 null
|
||||||
PRIMARY KEY (id)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
INSERT INTO tags (tag_id, tag_name)
|
INSERT INTO tags (tag_id, tag_name)
|
||||||
|
10
deb/OpenMediaCenter/DEBIAN/control
Executable file
10
deb/OpenMediaCenter/DEBIAN/control
Executable file
@ -0,0 +1,10 @@
|
|||||||
|
Package: OpenMediaCenter
|
||||||
|
Version: 0.1
|
||||||
|
Depends: nginx, php-fpm, php-mysqli, mariadb-server
|
||||||
|
Section: web
|
||||||
|
Priority: optional
|
||||||
|
Architecture: all
|
||||||
|
Essential: no
|
||||||
|
Installed-Size: 1024
|
||||||
|
Maintainer: heili.eu
|
||||||
|
Description: OpenMediaCenter
|
21
deb/OpenMediaCenter/DEBIAN/postinst
Executable file
21
deb/OpenMediaCenter/DEBIAN/postinst
Executable file
@ -0,0 +1,21 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# enable nginx site
|
||||||
|
ln -s /etc/nginx/sites-available/OpenMediaCenter.conf /etc/nginx/sites-enabled/OpenMediaCenter.conf
|
||||||
|
|
||||||
|
# link general socket to current one
|
||||||
|
ln -s /var/run/php/php*-fpm.sock /var/run/php-fpm.sock
|
||||||
|
|
||||||
|
# setup database
|
||||||
|
mysql -uroot -pPASS -e "CREATE DATABASE IF NOT EXISTS mediacenter;"
|
||||||
|
mysql -uroot -pPASS -e "CREATE USER IF NOT EXISTS 'mediacenteruser'@'localhost' IDENTIFIED BY 'mediapassword';"
|
||||||
|
mysql -uroot -pPASS -e "GRANT ALL PRIVILEGES ON mediacenter . * TO 'mediacenteruser'@'localhost';"
|
||||||
|
mysql -u mediacenteruser -pmediapassword mediacenter < /tmp/openmediacenter.sql
|
||||||
|
|
||||||
|
# removed unused sql style file
|
||||||
|
rm /tmp/openmediacenter.sql
|
||||||
|
|
||||||
|
# correct user rights
|
||||||
|
chown -R www-data:www-data /var/www/openmediacenter
|
||||||
|
|
||||||
|
# restart services
|
||||||
|
systemctl restart nginx
|
4
deb/OpenMediaCenter/DEBIAN/preinst
Normal file
4
deb/OpenMediaCenter/DEBIAN/preinst
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#preset db password
|
||||||
|
debconf-set-selections <<< 'mariadb-server-10.0 mysql-server/root_password password PASS'
|
||||||
|
debconf-set-selections <<< 'mariadb-server-10.0 mysql-server/root_password_again password PASS'
|
21
deb/OpenMediaCenter/etc/nginx/sites-available/OpenMediaCenter.conf
Executable file
21
deb/OpenMediaCenter/etc/nginx/sites-available/OpenMediaCenter.conf
Executable file
@ -0,0 +1,21 @@
|
|||||||
|
server {
|
||||||
|
listen 8080 default_server;
|
||||||
|
listen [::]:8080 default_server;
|
||||||
|
|
||||||
|
location ~ \.php$ {
|
||||||
|
include snippets/fastcgi-php.conf;
|
||||||
|
|
||||||
|
fastcgi_pass unix:/var/run/php-fpm.sock;
|
||||||
|
}
|
||||||
|
|
||||||
|
root /var/www/openmediacenter;
|
||||||
|
|
||||||
|
index index.html;
|
||||||
|
|
||||||
|
access_log /var/log/nginx/openmediacenter.access.log;
|
||||||
|
error_log /var/log/nginx/openmediacenter.error.log;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ =404;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user