快轉到主要內容

drupal8 dursh config-import使用簡介

·285 字·1 分鐘
Y Cheung
作者
Y Cheung
Blogger, Programer & Traveler.
  • GIT CLONE 代碼
  • 正常流程 stander 安裝drupal8
  • 修改/sites/default/settings.php 指定 config 文件夾位置
1$config_directories['sync'] = 'sites/config/sync';
  • 執行drush命令導入config
1drush config-import

提示報錯:

1Drupal\Core\Config\ConfigImporterException: There were errors validating the config synchronization. in                      [error]
2Drupal\Core\Config\ConfigImporter->validate() (line 728 of
3/var/www/spark-crm/core/lib/Drupal/Core/Config/ConfigImporter.php).
4The import failed due for the following reasons:                                                                             [error]
5Site UUID in source storage does not match the target storage.
6Entities exist of type <em class="placeholder">Shortcut link</em> and <em class="placeholder"></em> <em
7class="placeholder">Default</em>. These entities need to be deleted before importing.
  • 修復 Site UUID in source storage does not match the target storage. 錯誤

在要導入的config文件夾中找到system.site.yml文件,複製裡面的uuid值,執行以下drush設置命令

1drush cset system.site uuid 4a0b2a69-2df3-4ee3-8936-c6a2a03fc03d
  • 修復 Entities exist of type ... These entities need to be deleted before importing. 錯誤

可以在web頁面管理content中刪除相應的內容,也可以執行php代碼

1entity_delete_multiple('shortcut', \Drupal::entityQuery('shortcut')->execute());
  • 再次執行 drush config-import 命令,成功導入。

相關文章

在DRUPAL 7自定義多行表格表單中設置添加行按鈕與刪除行按鈕

·1506 字·4 分鐘
標題有點拗口,YCHEUNG也想不出來更好的中文表達,沒懂的朋友直接看內文吧(或者看url的英文標題)。 這種功能的表格表單YCHEUNG已經嘗試了五六種方式來寫,但都不滿意。不然就是功能上多少有缺陷,比如無法使用drupal 7 form API的日期type,不然就是很繁瑣的一堆代碼和判斷,看着都頭暈……等,今天終於試出了一個令YCHEUNG較滿意的寫法!分享給大家,也是一種記錄,YCHEUNG有預感,之後還會寫很多個這樣的表單QAQ

drupal 7中操作遠程oracle數據庫

·584 字·2 分鐘
系統環境需求 # PHP環境最好是 PHP 7,系統最好是紅帽系。 操作步驟 # 安裝Oracle Instant Client # 在Oracle官網頁面中找到系統對應的客戶端下載安裝,比如Y CHEUNG選擇的就是 Instant Client Downloads for Linux x86-64 ,Fedora可以下載RPM包直接安裝,非RedHat系統的可能需要先編譯,用make install的方式安裝。

Drupal7中自定义表格输入

·1240 字·3 分鐘
Drupal默认的节点表单(entity form)输入有时候并不能满足我们的需求,比如我想做一个类似excel表格输入形式的表单呢? = DEMO点这里 (PS. 用Pantheon的sandbox做了一个随意折腾的drupal站点,真的是折腾死我了= =) 首先,新建一个自定义模块,在你的*.module文件中hook_menu() 指定一个页面路径,设置页面调用表单,比如这样:

Drupal7 中Restful模组应用简单介绍

·1918 字·4 分鐘
安装并启用Restful Module # Restful 2.x 下载 drush 安装 drush dl restful, drush en restful 自定义RESTFUL API模组 # 可参考restful里的范例 sites/all/modules/restful/modules/restful_example 或者测试文件内容 sites/all/modules/restful/tests 模组文件结构 # 1custom_restfulapi/ 2├─ src/ 3│ ├─ Plugin/ 4│ │ ├─ resource/ 5│ │ │ ├─ entity/ 6│ │ │ │ ├─ Testentity__1_0.php 7├─ custom_restfulapi.info 8├─ custom_restfulapi.module API RESOURCES要放在src/Plugin下。 *.info 和 *.module 的内容跟其他自定义模组的相差无几,方法一样,此处从略。

Centos 7 使用 certbot 安裝Let’s Encrypt SSL 證書

·707 字·2 分鐘
安裝環境 # CentOS7 主機 Nginx 操作步驟 # 安裝certbot # 1#如果你已經安裝了EPEL,這個步驟可以省略 2sudo yum install epel-release 3#安裝certbot客戶端 4sudo yum install certbot 使用嚮導自動安裝證書 # 使用certbot嚮導安裝,有界面,根據指示一步步操作就行,但是YCHEUNG進行到設置webroot的時候就error了,只好放棄