Use "drush" fix error "Can't install module because configuration already exists in active configurations."
drush ev "\Drupal::service('config.manager')->uninstall('module', 'MODULE_NAME');"
Use "drush" fix error "Can't install module because configuration already exists in active configurations."
drush ev "\Drupal::service('config.manager')->uninstall('module', 'MODULE_NAME');"
ตัวอย่างใน composer.json
ปัญหาการใช้งาน composer แล้วเกิด error ไม่สามารถลบไฟล์ default.services.yml ได้
[RuntimeException]
Could not delete /web/sites/default/defaul
t.services.yml:
วิธีแก้ไข
chmod u+w web/sites/default
โดยใช้คำสั่ง
sudo update-alternatives --set php /usr/bin/php7.3
และลองเช็คดูว่าเปลี่ยน php เวอร์ชั่นหรือเปล่า โดยใช้คำสั่ง
php -v
การเปลี่ยน php เวอร์ชั่น ใช้ตอนที่เรามีปัญหากับการใช้ drush ไม่ได้ และ composer
Update แบบ fix field นั้นๆ ว่าจะเป็นค่าอะไร
mytheme.libraries.yml:
jquery-custom:
remote: https://github.com/jquery/jquery
version: "2.2.4"
license:
name: MIT
url: https://github.com/jquery/jquery/blob/2.2.4/LICENSE.txt
gpl-compatible: true
js:
js/jquery-2.2.4.min.js: { minified: true, weight: -20 }
mytheme.info.yml:
libraries-override:
# Replace an entire library.
core/jquery: mytheme/jquery-custom
curl -OL https://github.com/drush-ops/drush-launcher/releases/latest/download/drush.phar
chmod +x drush.phar && mv drush.phar /usr/local/bin/drush
Drupal 7
if (module_exists('blog')) {
echo 'blog module is enabled';
}
Drupal 8
\Drupal::moduleHandler()->moduleExists($module);
Drupal 7
เราใช้ ฟังชั่น taxonomy_term_load()
สำหรับ tid ตัวเดียว
<?php
$term = taxonomy_term_load($tid);
$name = $term->name;
?>
สำหรับ หรับ tid หลายตัว
<?php
$tids = array(1, 2, 3);
$terms = taxonomy_term_load_multiple($tids);
foreach ($terms as $term) {
$name = $term->name;
}
?>
Drupal 6 and 7
drush cc
drush sql-dump > ~/my-sql-dump-file-name.sql
drush sql-dump --gzip --result-file=backupdbsite.sql
Drupal 8