#10 fix creation table, remove sql transaction, fix drop table on error, fix refresh install page on error

pull/12/head
root 4 years ago
parent 57a1adaf55
commit 62f4947a3e

172
composer.lock generated

@ -8,16 +8,16 @@
"packages": [
{
"name": "composer/installers",
"version": "v1.9.0",
"version": "v1.11.0",
"source": {
"type": "git",
"url": "https://github.com/composer/installers.git",
"reference": "b93bcf0fa1fccb0b7d176b0967d969691cd74cca"
"reference": "ae03311f45dfe194412081526be2e003960df74b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/composer/installers/zipball/b93bcf0fa1fccb0b7d176b0967d969691cd74cca",
"reference": "b93bcf0fa1fccb0b7d176b0967d969691cd74cca",
"url": "https://api.github.com/repos/composer/installers/zipball/ae03311f45dfe194412081526be2e003960df74b",
"reference": "ae03311f45dfe194412081526be2e003960df74b",
"shasum": ""
},
"require": {
@ -28,17 +28,18 @@
"shama/baton": "*"
},
"require-dev": {
"composer/composer": "1.6.* || 2.0.*@dev",
"composer/semver": "1.0.* || 2.0.*@dev",
"phpunit/phpunit": "^4.8.36",
"sebastian/comparator": "^1.2.4",
"composer/composer": "1.6.* || ^2.0",
"composer/semver": "^1 || ^3",
"phpstan/phpstan": "^0.12.55",
"phpstan/phpstan-phpunit": "^0.12.16",
"symfony/phpunit-bridge": "^4.2 || ^5",
"symfony/process": "^2.3"
},
"type": "composer-plugin",
"extra": {
"class": "Composer\\Installers\\Plugin",
"branch-alias": {
"dev-master": "1.0-dev"
"dev-main": "1.x-dev"
}
},
"autoload": {
@ -76,6 +77,7 @@
"Porto",
"RadPHP",
"SMF",
"Starbug",
"Thelia",
"Whmcs",
"WolfCMS",
@ -109,6 +111,7 @@
"majima",
"mako",
"mediawiki",
"miaoxing",
"modulework",
"modx",
"moodle",
@ -116,6 +119,7 @@
"phpbb",
"piwik",
"ppi",
"processwire",
"puppet",
"pxcms",
"reindex",
@ -125,13 +129,32 @@
"sydes",
"sylius",
"symfony",
"tastyigniter",
"typo3",
"wordpress",
"yawik",
"zend",
"zikula"
],
"time": "2020-04-07T06:57:05+00:00"
"support": {
"issues": "https://github.com/composer/installers/issues",
"source": "https://github.com/composer/installers/tree/v1.11.0"
},
"funding": [
{
"url": "https://packagist.com",
"type": "custom"
},
{
"url": "https://github.com/composer",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/composer/composer",
"type": "tidelift"
}
],
"time": "2021-04-28T06:42:17+00:00"
},
{
"name": "fuel/auth",
@ -163,6 +186,10 @@
],
"description": "FuelPHP 1.x Auth Package",
"homepage": "https://github.com/fuel/auth",
"support": {
"issues": "https://github.com/fuel/auth/issues",
"source": "https://github.com/fuel/auth/tree/1.8.2"
},
"time": "2019-06-27T14:59:18+00:00"
},
{
@ -171,12 +198,12 @@
"source": {
"type": "git",
"url": "https://github.com/fuel/core.git",
"reference": "f6bb6bb682805d12bd985a28153e7f7a1e1b1ea9"
"reference": "a4838ce7c12fc47777fcab67b1519b2126558c69"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/fuel/core/zipball/f6bb6bb682805d12bd985a28153e7f7a1e1b1ea9",
"reference": "f6bb6bb682805d12bd985a28153e7f7a1e1b1ea9",
"url": "https://api.github.com/repos/fuel/core/zipball/a4838ce7c12fc47777fcab67b1519b2126558c69",
"reference": "a4838ce7c12fc47777fcab67b1519b2126558c69",
"shasum": ""
},
"require": {
@ -186,6 +213,7 @@
"paragonie/sodium_compat": "^1.6",
"phpseclib/phpseclib": "^2.0.0"
},
"default-branch": true,
"type": "fuel-package",
"notification-url": "https://packagist.org/downloads/",
"license": [
@ -199,7 +227,11 @@
],
"description": "FuelPHP 1.x Core",
"homepage": "https://github.com/fuel/core",
"time": "2019-10-25T14:09:36+00:00"
"support": {
"issues": "https://github.com/fuel/core/issues",
"source": "https://github.com/fuel/core/tree/1.9/develop"
},
"time": "2021-04-10T19:18:44+00:00"
},
{
"name": "fuel/email",
@ -231,6 +263,10 @@
],
"description": "FuelPHP 1.x Email Package",
"homepage": "https://github.com/fuel/email",
"support": {
"issues": "https://github.com/fuel/email/issues",
"source": "https://github.com/fuel/email/tree/1.8.2"
},
"time": "2019-06-27T14:58:38+00:00"
},
{
@ -263,6 +299,10 @@
],
"description": "FuelPHP 1.x Oil Package",
"homepage": "https://github.com/fuel/oil",
"support": {
"issues": "https://github.com/fuel/oil/issues",
"source": "https://github.com/fuel/oil/tree/1.8.2"
},
"time": "2019-06-27T14:58:13+00:00"
},
{
@ -295,6 +335,10 @@
],
"description": "FuelPHP 1.x ORM Package",
"homepage": "https://github.com/fuel/orm",
"support": {
"issues": "https://github.com/fuel/orm/issues",
"source": "https://github.com/fuel/orm/tree/1.8.2"
},
"time": "2019-06-27T14:57:32+00:00"
},
{
@ -327,6 +371,10 @@
],
"description": "FuelPHP 1.x Parser Package",
"homepage": "https://github.com/fuel/parser",
"support": {
"issues": "https://github.com/fuel/parser/issues",
"source": "https://github.com/fuel/parser/tree/1.8.2"
},
"time": "2019-06-27T14:57:06+00:00"
},
{
@ -377,6 +425,10 @@
"file uploads",
"upload"
],
"support": {
"issues": "https://github.com/fuelphp/upload/issues",
"source": "https://github.com/fuelphp/upload/tree/master"
},
"time": "2015-11-04T17:19:56+00:00"
},
{
@ -414,9 +466,9 @@
"authors": [
{
"name": "Michel Fortin",
"role": "Developer",
"email": "michel.fortin@michelf.ca",
"homepage": "https://michelf.ca/"
"homepage": "https://michelf.ca/",
"role": "Developer"
},
{
"name": "John Gruber",
@ -428,20 +480,24 @@
"keywords": [
"markdown"
],
"support": {
"issues": "https://github.com/michelf/php-markdown/issues",
"source": "https://github.com/michelf/php-markdown/tree/1.7.0"
},
"time": "2016-10-29T18:58:20+00:00"
},
{
"name": "monolog/monolog",
"version": "1.25.3",
"version": "1.26.0",
"source": {
"type": "git",
"url": "https://github.com/Seldaek/monolog.git",
"reference": "fa82921994db851a8becaf3787a9e73c5976b6f1"
"reference": "2209ddd84e7ef1256b7af205d0717fb62cfc9c33"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/fa82921994db851a8becaf3787a9e73c5976b6f1",
"reference": "fa82921994db851a8becaf3787a9e73c5976b6f1",
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/2209ddd84e7ef1256b7af205d0717fb62cfc9c33",
"reference": "2209ddd84e7ef1256b7af205d0717fb62cfc9c33",
"shasum": ""
},
"require": {
@ -455,11 +511,10 @@
"aws/aws-sdk-php": "^2.4.9 || ^3.0",
"doctrine/couchdb": "~1.0@dev",
"graylog2/gelf-php": "~1.0",
"jakub-onderka/php-parallel-lint": "0.9",
"php-amqplib/php-amqplib": "~2.4",
"php-console/php-console": "^3.1.3",
"phpstan/phpstan": "^0.12.59",
"phpunit/phpunit": "~4.5",
"phpunit/phpunit-mock-objects": "2.3.0",
"ruflin/elastica": ">=0.90 <3.0",
"sentry/sentry": "^0.13",
"swiftmailer/swiftmailer": "^5.3|^6.0"
@ -478,11 +533,6 @@
"sentry/sentry": "Allow sending log messages to a Sentry server"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Monolog\\": "src/Monolog"
@ -506,24 +556,38 @@
"logging",
"psr-3"
],
"time": "2019-12-20T14:15:16+00:00"
"support": {
"issues": "https://github.com/Seldaek/monolog/issues",
"source": "https://github.com/Seldaek/monolog/tree/1.26.0"
},
"funding": [
{
"url": "https://github.com/Seldaek",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/monolog/monolog",
"type": "tidelift"
}
],
"time": "2020-12-14T12:56:38+00:00"
},
{
"name": "paragonie/random_compat",
"version": "v9.99.99",
"version": "v9.99.100",
"source": {
"type": "git",
"url": "https://github.com/paragonie/random_compat.git",
"reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95"
"reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/paragonie/random_compat/zipball/84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95",
"reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95",
"url": "https://api.github.com/repos/paragonie/random_compat/zipball/996434e5492cb4c3edcb9168db6fbb1359ef965a",
"reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a",
"shasum": ""
},
"require": {
"php": "^7"
"php": ">= 7"
},
"require-dev": {
"phpunit/phpunit": "4.*|5.*",
@ -551,20 +615,25 @@
"pseudorandom",
"random"
],
"time": "2018-07-02T15:55:56+00:00"
"support": {
"email": "info@paragonie.com",
"issues": "https://github.com/paragonie/random_compat/issues",
"source": "https://github.com/paragonie/random_compat"
},
"time": "2020-10-15T08:29:30+00:00"
},
{
"name": "paragonie/sodium_compat",
"version": "v1.13.0",
"version": "v1.16.0",
"source": {
"type": "git",
"url": "https://github.com/paragonie/sodium_compat.git",
"reference": "bbade402cbe84c69b718120911506a3aa2bae653"
"reference": "928e0565c9fe4f60b8f09119656c1aa418fc84ab"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/paragonie/sodium_compat/zipball/bbade402cbe84c69b718120911506a3aa2bae653",
"reference": "bbade402cbe84c69b718120911506a3aa2bae653",
"url": "https://api.github.com/repos/paragonie/sodium_compat/zipball/928e0565c9fe4f60b8f09119656c1aa418fc84ab",
"reference": "928e0565c9fe4f60b8f09119656c1aa418fc84ab",
"shasum": ""
},
"require": {
@ -572,7 +641,7 @@
"php": "^5.2.4|^5.3|^5.4|^5.5|^5.6|^7|^8"
},
"require-dev": {
"phpunit/phpunit": "^3|^4|^5|^6|^7"
"phpunit/phpunit": "^3|^4|^5|^6|^7|^8|^9"
},
"suggest": {
"ext-libsodium": "PHP < 7.0: Better performance, password hashing (Argon2i), secure memory management (memzero), and better security.",
@ -633,7 +702,11 @@
"secret-key cryptography",
"side-channel resistant"
],
"time": "2020-03-20T21:48:09+00:00"
"support": {
"issues": "https://github.com/paragonie/sodium_compat/issues",
"source": "https://github.com/paragonie/sodium_compat/tree/v1.16.0"
},
"time": "2021-05-14T03:03:19+00:00"
},
{
"name": "phpseclib/phpseclib",
@ -746,16 +819,16 @@
},
{
"name": "psr/log",
"version": "1.1.3",
"version": "1.1.4",
"source": {
"type": "git",
"url": "https://github.com/php-fig/log.git",
"reference": "0f73288fd15629204f9d42b7055f72dacbe811fc"
"reference": "d49695b909c3b7628b6289db5479a1c204601f11"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc",
"reference": "0f73288fd15629204f9d42b7055f72dacbe811fc",
"url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11",
"reference": "d49695b909c3b7628b6289db5479a1c204601f11",
"shasum": ""
},
"require": {
@ -779,7 +852,7 @@
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
"homepage": "https://www.php-fig.org/"
}
],
"description": "Common interface for logging libraries",
@ -789,7 +862,10 @@
"psr",
"psr-3"
],
"time": "2020-03-23T09:12:05+00:00"
"support": {
"source": "https://github.com/php-fig/log/tree/1.1.4"
},
"time": "2021-05-03T11:20:27+00:00"
}
],
"packages-dev": [
@ -823,6 +899,10 @@
],
"description": "FuelPHP 1.x Documenataion",
"homepage": "https://github.com/fuel/docs",
"support": {
"issues": "https://github.com/fuel/docs/issues",
"source": "https://github.com/fuel/docs/tree/1.8.2"
},
"time": "2019-06-27T14:54:29+00:00"
}
],

@ -37,12 +37,12 @@ class Controller_Install extends Controller
$view->set('db_password', isset($config_db['connection']['password']) ? $config_db['connection']['password'] : null);
try {
$config_plex = Model_Server::find()[0];
$config_plex = Model_Server::find() ? Model_Server::find()[0] : null;
if($config_plex) {
$view->set('plex_url', $config_plex->url);
$view->set('plex_port', $config_plex->port);
$view->set('plex_token', $config_plex->token);
$view->set('plex_url', $config_plex ? $config_plex->url : null);
$view->set('plex_port', $config_plex ? $config_plex->port : null);
$view->set('plex_token', $config_plex ? $config_plex->token : null);
}
}catch (FuelException $e){
//@TODO
@ -50,4 +50,4 @@ class Controller_Install extends Controller
return $view;
}
}
}

@ -0,0 +1,14 @@
<?php
use Fuel\Core\Controller_Rest;
class Controller_Rest_Index extends Controller_Rest
{
public function before()
{
$user = Session::get('user');
if(!$user)
Response::redirect('/login');
}
}

@ -77,8 +77,6 @@ class Controller_Rest_Install extends Controller_Rest
$logs = '';
try {
DB::start_transaction();
$logs .= 'Creation table user'."\r\n";
/**
* CREATE TABLE USER
@ -310,7 +308,7 @@ class Controller_Rest_Install extends Controller_Rest
'movie_id' => array('constraint' => 36, 'type' => 'varchar'),
'watching_time' => array('constraint' => 11, 'type' => 'int'),
'ended_time' => array('constraint' => 11, 'type' => 'int', 'default' => 0),
'isFinish' => array('constraint' => 1, 'type' => 'int', 'default' => 0)
'is_ended' => array('constraint' => 1, 'type' => 'int', 'default' => 0)
),
array('id'), false, 'InnoDB', 'utf8_unicode_ci'
);
@ -429,8 +427,8 @@ class Controller_Rest_Install extends Controller_Rest
'on_update' => 'NO ACTION',
'on_delete' => 'NO ACTION',
));
DBUtil::add_foreign_key('user_watching', array(
'constraint' => 'constraintUserWatching',
/*DBUtil::add_foreign_key('user_watching', array(
'constraint' => 'constraintUserUserWatching',
'key' => 'user_id',
'reference' => array(
'table' => 'user',
@ -438,7 +436,7 @@ class Controller_Rest_Install extends Controller_Rest
),
'on_update' => 'NO ACTION',
'on_delete' => 'NO ACTION',
));
));*/
DBUtil::add_foreign_key('user_watching', array(
'constraint' => 'constraintMovieWatching',
'key' => 'movie_id',
@ -449,8 +447,8 @@ class Controller_Rest_Install extends Controller_Rest
'on_update' => 'NO ACTION',
'on_delete' => 'NO ACTION',
));
DBUtil::add_foreign_key('user_setting', array(
'constraint' => 'constraintUserSetting',
DBUtil::add_foreign_key('user_settings', array(
'constraint' => 'constraintUserUserSetting',
'key' => 'user_id',
'reference' => array(
'table' => 'user',
@ -501,23 +499,25 @@ class Controller_Rest_Install extends Controller_Rest
->values(['RIGHT_MAX_DOWNLOAD', 1])
;
DB::commit_transaction();
$logs .= 'All Tables and Foreign Key successfully!'."\r\n";
return $this->response(['error' => false, 'message' => $logs]);
} catch (FuelException $e) {
try {
DBUtil::drop_table('user_watching');
DBUtil::drop_table('user_watching');
DBUtil::drop_table('user_permission');
DBUtil::drop_table('libraries_permission');
DBUtil::drop_table('permission');
DBUtil::drop_table('library');
DBUtil::drop_table('user_settings');
DBUtil::drop_table('library_permission');
DBUtil::drop_table('movie');
DBUtil::drop_table('season');
DBUtil::drop_table('tvshow');
DBUtil::drop_table('library');
DBUtil::drop_table('server');
DBUtil::drop_table('configurations');
DBUtil::drop_table('user');
DB::rollback_transaction();
DBUtil::drop_table('user');
DBUtil::drop_table('permission');
DBUtil::drop_table('library');
return $this->response(array('error' => true, 'message' => $e->getMessage()), 400);
} catch (FuelException $e) {
return $this->response(array('error' => true, 'message' => $e->getMessage()), 400);

Loading…
Cancel
Save