Drupal

drupal 管理员密码忘了怎么办?

怎么办?怎么办?怎么办? 我已经忘了3次了。。。。

不要担心,官网给出的方案,前提是可以登录后台服务器。

Note: leaving this password reset script on your server after resetting the password constitutes a highly critical security hole that enables anyone to reset your administrator password. Use this script carefully, and always delete the script after you're finished using it.

2019年05月02日
2 mins

Drupal 8 里两种查询方式的分页实例

D8 里有两种数据查询:一种是利用 db_query 直接对数据库表操作,一种是采用 entityTypeManager 进行实体操作。 两种方式的分页处理略有不同,在实际应用中可以灵活使用。下面是两个实例展示:
2019年04月29日
1 min

drupal entity type 和 bundle 概念理解

Entity 在 drupal 里是一个很重要的概念。个人理解:drupal 也是在面向对象的思想上对其提炼,即世上万物皆对象。其概念有点类似生物学上的界门纲目科属种层级关系。Entity type 就是大类,比如水果;Bundle 就是子类,比如西瓜;Field 就是水果属性,比如西瓜是圆的,绿皮带条纹,有籽无籽等。而 Entity 就是更具象指这个西瓜(实例)。

Entity

  • An entity type is a base class
  • A bundle is an extended class
  • A field is a class member, property, variable or field instance (depending on your naming preference)
  • An entity is an object or instance of a base or extended class
2019年04月28日
2 mins

用 composer 安装 drupal 及用 drush 升级

  1. 安装 composer

    curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin

  2. composer 不建议用 root 用户,新建用户并授权

    useradd -d /home/ng -m ng passwd ng usermod -s /bin/bash ng chown -R ng /var/www/*

  3. 建库

    CREATE DATABASE example_database DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; GRANT ALL ON example_database.* TO 'example_user'@'localhost' IDENTIFIED BY 'pwd';

  4. 下载 drupal 源码

    composer create-project drupal-composer/drupal-project:8.x-dev jetdrupal.com --no-interaction --no-dev

  5. 安装, 新版本需要在上级目录新建这两个文件夹

    mkdir -p config/sync

  6. 安装 drush

    composer require drush/drush

    (https://github.com/drush-ops/drush-launcher)

  7. 升级

    sql-dump --result-file=../db.sql

    drush pm:security

    composer update drupal/core webflo/drupal-core-require-dev --with-dependencies

    composer update drupal/modulename --with-dependencies

    drush updatedb

    drush cr

2019年03月11日
1 min

AltStyle によって変換されたページ (->オリジナル) /