1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <?php
- namespace fectfurnilife\administer;
- use Yii;
- /**
- * 应用安装类
- * 您可以在这里添加类变量,在配置中的值可以注入进来。
- */
- class Install implements \fecshop\services\extension\InstallInterface
- {
-
- public $version = '1.0.0';
-
- public $test;
-
- /**
- * @return mixed|void
- */
- public function run()
- {
- if (!$this->installDbSql()) {
- return false;
- }
- if (!$this->copyImageFile()) {
- return false;
- }
- return true;
- }
- /**
- * 进行数据库的初始化
- * sql语句执行,多个sql用分号 `;`隔开
- */
- public function installDbSql()
- {
- // $sql = "";
- // 执行sql, 创建表结构的时候,这个函数会返回0,因此不能以返回值作为return
- // Yii::$app->getDb()->createCommand($sql)->execute();
-
- return true;
- }
-
- /**
- * 复制图片文件到appimage/common/addons/{namespace},如果存在,则会被强制覆盖
- */
- public function copyImageFile()
- {
- $sourcePath = Yii::getAlias('@fectfurnilife/app/appimage/common/addons/fectfurnilife');
-
- Yii::$service->extension->administer->copyThemeFile($sourcePath);
-
- return true;
- }
-
- }
|