Skip to content

Commit

Permalink
Fix install & update package paper
Browse files Browse the repository at this point in the history
  • Loading branch information
yoosefap committed Nov 7, 2021
1 parent 06efe03 commit d8b56eb
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app.db
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ CREATE TABLE `{dbprefix}tag` (
-- ----------------------------

ALTER TABLE `{dbprefix}user`
ADD CONSTRAINT `{dbprefix}user_user_id` FOREIGN KEY (`user_id`) REFERENCES `pincore_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE
ADD CONSTRAINT `{dbprefix}user_user_id` FOREIGN KEY (`user_id`) REFERENCES `pincore_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;

ALTER TABLE `{dbprefix}category`
ADD CONSTRAINT `{dbprefix}category_parent_id` FOREIGN KEY (`parent_id`) REFERENCES `{dbprefix}category` (`cat_id`) ON DELETE CASCADE ON UPDATE CASCADE;
Expand Down
4 changes: 2 additions & 2 deletions model/user.model.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ public static function where_status($status)
self::$db->where('status', $status);
}

public static function fetch_by_app()
public static function fetch_by_app($app = null)
{
$app = AppProvider::get('package-name');
$app = !empty($app)? $app : AppProvider::get('package-name');
self::$db->where('app', $app);
return self::$db->getOne(self::user);
}
Expand Down
10 changes: 10 additions & 0 deletions service/app/install.service.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@

namespace pinoox\app\com_pinoox_paper\service\app;

use pinoox\app\com_pinoox_manager\component\Wizard;
use pinoox\app\com_pinoox_paper\model\PostModel;
use pinoox\app\com_pinoox_paper\model\UserModel;
use pinoox\model\UserModel as UserModelCore;
use pinoox\component\interfaces\ServiceInterface;
use pinoox\component\User;
use pinoox\model\FileModel;
Expand All @@ -24,6 +26,14 @@ class InstallService implements ServiceInterface
public function _run()
{
$user = UserModel::fetch_by_app();
if (!$user) {
$package_name = app('package-name');
$user = UserModel::fetch_by_app('com_pinoox_manager');
if ($user) {
UserModelCore::copy($user['user_id'], $package_name);
}
}

UserModel::insert_self([
'user_id' => $user['user_id'],
'group_key' => 'administrator',
Expand Down
4 changes: 2 additions & 2 deletions service/app/update.db
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ CREATE TABLE `{dbprefix}user` (
-- ----------------------------
ALTER TABLE `{dbprefix}category` ADD `cat_key` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL;
ALTER TABLE `{dbprefix}category` ADD `image_id` int(0) NULL DEFAULT NULL;
ALTER TABLE `{dbprefix}post` ADD `schedule_date` datetime NULL DEFAULT NULL,
ALTER TABLE `{dbprefix}post` ADD `schedule_date` datetime NULL DEFAULT NULL;

-- ----------------------------
-- Foreign keys
-- ----------------------------
ALTER TABLE `{dbprefix}user`
ADD CONSTRAINT `{dbprefix}user_user_id` FOREIGN KEY (`user_id`) REFERENCES `pincore_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE
ADD CONSTRAINT `{dbprefix}user_user_id` FOREIGN KEY (`user_id`) REFERENCES `pincore_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;

ALTER TABLE `{dbprefix}category`
ADD CONSTRAINT `{dbprefix}category_image_id` FOREIGN KEY (`image_id`) REFERENCES `pincore_file` (`file_id`) ON DELETE CASCADE ON UPDATE CASCADE;
Expand Down
2 changes: 1 addition & 1 deletion service/app/update.service.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
use pinoox\model\FileModel;
use pinoox\model\PinooxDatabase;

class InstallService implements ServiceInterface
class UpdateService implements ServiceInterface
{

public function _run()
Expand Down
2 changes: 1 addition & 1 deletion theme/panel/papyrus/dist/paper/main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion theme/panel/papyrus/dist/paper/manifest.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"main":["main.css?f227af918be8df01aa27","main.js?f227af918be8df01aa27"],"vendor":["vendor.css?626f3379839155a2a2b0","vendor.js?626f3379839155a2a2b0"]}
{"main":["main.css?9ef88e6b984248bb687d","main.js?9ef88e6b984248bb687d"],"vendor":["vendor.css?626f3379839155a2a2b0","vendor.js?626f3379839155a2a2b0"]}
2 changes: 1 addition & 1 deletion theme/panel/papyrus/src/vue/main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ export default {
if ((!token || !this.isLogin() || !this._module('panel')) && (!this.$route.name || this.$route.name !== 'login')) {
this._routerReplace({name: 'login'});
} else if (this._module(path)) {
if (name === 'login' || name === 'splash') {
if (name === 'login' || path === 'panel/account' || name === 'splash') {
this._routerReplace({name: 'dashboard'});
} else {
this._routerReplace(route_path);
Expand Down

0 comments on commit d8b56eb

Please sign in to comment.