Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenDocCN
yii2_fecshop
提交
2e6542a9
Y
yii2_fecshop
项目概览
OpenDocCN
/
yii2_fecshop
通知
18
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Y
yii2_fecshop
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2e6542a9
编写于
9月 10, 2019
作者:
T
Terry
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
应用插件部分
上级
b3d5efd5
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
35 addition
and
21 deletion
+35
-21
services/extension/Administer.php
services/extension/Administer.php
+26
-5
services/extension/generate/administer/Install.php
services/extension/generate/administer/Install.php
+4
-6
services/extension/generate/administer/Uninstall.php
services/extension/generate/administer/Uninstall.php
+1
-2
services/extension/generate/administer/Upgrade.php
services/extension/generate/administer/Upgrade.php
+4
-8
未找到文件。
services/extension/Administer.php
浏览文件 @
2e6542a9
...
@@ -23,6 +23,8 @@ class Administer extends Service
...
@@ -23,6 +23,8 @@ class Administer extends Service
// 卸载应用,是否删除掉应用的文件夹
// 卸载应用,是否删除掉应用的文件夹
public
$uninstallRemoveFile
=
true
;
public
$uninstallRemoveFile
=
true
;
public
$currentNamespace
;
/**
/**
* 1.插件的安装
* 1.插件的安装
* @param $extension_name | string , 插件名称(唯一)
* @param $extension_name | string , 插件名称(唯一)
...
@@ -39,6 +41,7 @@ class Administer extends Service
...
@@ -39,6 +41,7 @@ class Administer extends Service
return
false
;
return
false
;
}
}
$this
->
currentNamespace
=
$extension_namespace
;
// 插件已经安装
// 插件已经安装
$installed_status
=
$modelOne
[
'installed_status'
];
$installed_status
=
$modelOne
[
'installed_status'
];
if
(
!
$forceInstall
&&
Yii
::
$service
->
extension
->
isInstalledStatus
(
$installed_status
))
{
if
(
!
$forceInstall
&&
Yii
::
$service
->
extension
->
isInstalledStatus
(
$installed_status
))
{
...
@@ -93,7 +96,7 @@ class Administer extends Service
...
@@ -93,7 +96,7 @@ class Administer extends Service
return
false
;
return
false
;
}
}
$this
->
currentNamespace
=
$extension_namespace
;
// 通过数据库找到应用的配置文件路径
// 通过数据库找到应用的配置文件路径
$extensionConfigFile
=
Yii
::
getAlias
(
$modelOne
[
'config_file_path'
]);
$extensionConfigFile
=
Yii
::
getAlias
(
$modelOne
[
'config_file_path'
]);
if
(
!
file_exists
(
$extensionConfigFile
))
{
if
(
!
file_exists
(
$extensionConfigFile
))
{
...
@@ -144,6 +147,7 @@ class Administer extends Service
...
@@ -144,6 +147,7 @@ class Administer extends Service
return
false
;
return
false
;
}
}
$this
->
currentNamespace
=
$extension_namespace
;
// 插件如果没有安装
// 插件如果没有安装
$installed_status
=
$modelOne
[
'installed_status'
];
$installed_status
=
$modelOne
[
'installed_status'
];
if
(
!
Yii
::
$service
->
extension
->
isInstalledStatus
(
$installed_status
))
{
if
(
!
Yii
::
$service
->
extension
->
isInstalledStatus
(
$installed_status
))
{
...
@@ -369,13 +373,30 @@ class Administer extends Service
...
@@ -369,13 +373,30 @@ class Administer extends Service
// theme文件进行copy到@app/theme/base/addons 下面。
// theme文件进行copy到@app/theme/base/addons 下面。
protected
function
copyThemeFile
(
$
modelOne
)
protected
function
copyThemeFile
(
$
sourcePath
)
{
{
if
(
!
$this
->
currentNamespace
)
{
Yii
::
$service
->
helper
->
errors
->
add
(
'copyThemeFile: current extension: {namespace} is not exist'
,
[
'namespace'
=>
$this
->
currentNamespace
]);
return
false
;
}
$targetPath
=
Yii
::
getAlias
(
'@appimage/common/addons/'
.
$this
->
currentNamespace
);
Yii
::
$service
->
helper
->
copyDirImage
(
$sourcePath
,
$targetPath
);
}
}
// theme文件进行copy到@app/theme/base/addons 下面。
protected
function
removeThemeFile
()
{
if
(
!
$this
->
currentNamespace
)
{
Yii
::
$service
->
helper
->
errors
->
add
(
'copyThemeFile: current extension: {namespace} is not exist'
,
[
'namespace'
=>
$this
->
currentNamespace
]);
return
false
;
}
$sourcePath
=
Yii
::
getAlias
(
'@appimage/common/addons/'
.
$this
->
currentNamespace
);
Yii
::
$service
->
helper
->
deleteDir
(
$sourcePath
);
return
true
;
}
}
}
services/extension/generate/administer/Install.php
浏览文件 @
2e6542a9
...
@@ -98,16 +98,14 @@ class Install implements \fecshop\services\extension\InstallInterface
...
@@ -98,16 +98,14 @@ class Install implements \fecshop\services\extension\InstallInterface
}
}
/**
/**
* 复制图片文件到appimage,如果存在,则会被强制覆盖
* 复制图片文件到appimage/common/addons/{namespace},如果存在,则会被强制覆盖
* 模板应用一般会用到改函数
*/
*/
public function copyImageFile()
public function copyImageFile()
{
{
/*
/*
$sourcePath = Yii::getAlias('@
<?=
$namespaces
?>
/app/appimage');
$sourcePath = Yii::getAlias('@
<?=
$namespaces
?>
/app/appimage/common/addons/
<?=
$namespaces
?>
');
$targetPath = Yii::getAlias('@appimage');
// 只复制产品文件到appimage,其他的文件将会被过滤掉。(安全)
Yii::$service->extension->administer->copyThemeFile($sourcePath);
Yii::$service->helper->copyDirImage($sourcePath, $targetPath);
*/
*/
return true;
return true;
}
}
...
...
services/extension/generate/administer/Uninstall.php
浏览文件 @
2e6542a9
...
@@ -48,8 +48,7 @@ class Uninstall implements \fecshop\services\extension\UninstallInterface
...
@@ -48,8 +48,7 @@ class Uninstall implements \fecshop\services\extension\UninstallInterface
public function removeImageFile()
public function removeImageFile()
{
{
/*
/*
$targetPath = Yii::getAlias('@appimage/common/appfront/media/fect/xxxxxxxxx');
return Yii::$service->extension->administer->removeThemeFile();
Yii::$service->helper->deleteDir($targetPath);
*/
*/
return true;
return true;
...
...
services/extension/generate/administer/Upgrade.php
浏览文件 @
2e6542a9
...
@@ -77,21 +77,17 @@ class Upgrade implements \fecshop\services\extension\UpgradeInterface
...
@@ -77,21 +77,17 @@ class Upgrade implements \fecshop\services\extension\UpgradeInterface
}
}
/**
/**
* 复制图片文件到appimage,如果存在,则会被强制覆盖
* 复制图片文件到appimage/common/addons/{namespace},如果存在,则会被强制覆盖
* 如果更新的版本中有新增的图片,可以执行copy image
*/
*/
public function copyImageFile()
public function copyImageFile()
{
{
/*
/*
$sourcePath = Yii::getAlias('@
<?=
$namespaces
?>
/app/appimage');
$sourcePath = Yii::getAlias('@
<?=
$namespaces
?>
/app/appimage/common/addons/
<?=
$namespaces
?>
');
$targetPath = Yii::getAlias('@appimage');
// 只复制产品文件到appimage,其他的文件将会被过滤掉。(安全)
Yii::$service->extension->administer->copyThemeFile($sourcePath);
Yii::$service->helper->copyDirImage($sourcePath, $targetPath);
*/
*/
return true;
return true;
}
}
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录