V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
programV2
V2EX  ›  程序员

求教大佬们 Drupal8 有没有办法直接在服务器上删除 /停用 recaptcha 模块

  •  1
     
  •   programV2 · 2020-02-04 10:44:14 +08:00 · 1556 次点击
    这是一个创建于 1547 天前的主题,其中的信息可能已经有所发展或是发生改变。
    前些天将备份的旧网站迁移到 docker 里,由于原来老网站开启了 reCAPTCHA 模块, 绑定的谷歌帐号被封并且旧域名也被注册了, 后台密码也忘记现在进不了后台了,, 求助 V 友们给!谢谢🙏
    Drupal Version 8.5.5

    现在需要先停用 recaptcha 模块, 请问有没有办法直接在服务器上删除 /停用 recaptcha 模块?

    我试着把 recaptcha 和 captcha 两个 module 文件夹都删除掉了, 然后进入数据库执行了下列命令清除缓存, 并重启所有容器, 但是 captcha 错误提示还是出现(见附图)
    TRUNCATE cache_config;
    TRUNCATE cache_container;
    TRUNCATE cache_data;
    TRUNCATE cache_default;
    TRUNCATE cache_discovery;
    TRUNCATE cache_dynamic_page_cache;
    TRUNCATE cache_entity;
    TRUNCATE cache_menu;
    TRUNCATE cache_render;
    TRUNCATE cache_toolbar;

    附图:![PNG]( https://i.loli.net/2020/01/23/OFRub36ecsyAJfD.png)

    已多次重启本地电脑和浏览器使用隐私模式,排除本地缓存问题
    10 条回复    2020-02-06 16:46:11 +08:00
    drush
        1
    drush  
       2020-02-04 12:07:13 +08:00   ❤️ 1
    drush pm-uninstall recaptcha
    drush
        2
    drush  
       2020-02-04 12:09:49 +08:00
    而且其实可以用 drush uli 去 login 后台
    mafeifan
        3
    mafeifan  
       2020-02-04 18:05:36 +08:00
    哈哈,楼上这头像配这回复真绝了
    programV2
        4
    programV2  
    OP
       2020-02-04 20:48:05 +08:00
    @drush 谢谢大佬! 请问要如何在 docker 容器安装 drush? 网上找不到文档, 用 stackoverflow 之前有人分享的方法老是安装出错, 求大佬指教. 谢谢 !

    把 drush 安装在 drupal 容器内:

    $ docker exec -ti <MY_DRUPAL_CONTAINER> \
    bash -c 'php -r "readfile('https://s3.amazonaws.com/files.drush.org/drush.phar');" \
    > drush && chmod +x drush && mv drush /usr/local/bin'

    执行上面那个命令 得到的错误如下:

    OCI runtime exec failed: exec failed: container_linux.go:345: starting container process caused "exec: \"bash\": executable file not found in $PATH": unknown
    programV2
        5
    programV2  
    OP
       2020-02-04 22:03:09 +08:00
    @mafeifan
    @programV2 然后我尝试使用 docker-compose.yml 建一个 drush 容器并把它挂载到 drupal 容器上,又碰到报错信息:



    Pulling drush (drush/drush:)...
    latest: Pulling from drush/drush
    c87736221ed0: Pull complete
    bcb58026c06e: Pull complete
    6c24eee1bf47: Pull complete
    864f09cef0fe: Pull complete
    9107aebea488: Pull complete
    e674e7b6cfae: Pull complete
    fc2489165087: Pull complete
    0b45d6fb692c: Pull complete
    1452b3ed7eef: Pull complete
    3e9c078fa313: Pull complete
    6efeada2aeab: Pull complete
    5f493cb151ef: Pull complete
    656e2628aadc: Pull complete
    31ccf03e7a0c: Pull complete
    c31dbcded259: Pull complete
    f33ad91f829f: Pull complete
    dcfca166b834: Pull complete
    ef7668c04a97: Pull complete
    616dff10d9a8: Pull complete
    71e8edf7fb7f: Pull complete
    Digest: sha256:cb26e96449bdbf2fe34f016a19d74957017f1332093bc6b7f20a7b835f5da682
    Status: Downloaded newer image for drush/drush:latest
    Creating drupal8_mysql ...
    Creating drupal8_drush_1 ... error

    ERROR: for drupal8_drush_1 Cannot start service drush: OCI runtime create faile d: container_linux.go:345: starting container process caused "process_linux.go:430: container init caused \"rootfs_linux.go:58: mounting \\\"/root/drupal8/drupal/drush/drush\\\" to rootfs \\\"/var/lib/docker/overlay2/3d4c873a30ff0fdf5ad7805 43789f1ccbf7e5d5046ca91dbe9928fecec954044/merged\\\" at \\\"/var/lib/docker/over lay2/3d4c873a30ff0fdf5ad780543789f1ccbf7e5d5046ca91dbe9928fecec954044/merged/usr/local/bin/drush\\\" caused \\\"not a directory\\\"\"": unknown: Are you trying
    Creating drupal8_mysql ... done
    th exists and is the expected type
    Creating drupal8_drupal ... done
    Creating drupal8_nginx ... done

    ERROR: for drush Cannot start service drush: OCI runtime create failed: contain er_linux.go:345: starting container process caused "process_linux.go:430: container init caused \"rootfs_linux.go:58: mounting \\\"/root/drupal8/drupal/drush/drush\\\" to rootfs \\\"/var/lib/docker/overlay2/3d4c873a30ff0fdf5ad780543789f1ccb f7e5d5046ca91dbe9928fecec954044/merged\\\" at \\\"/var/lib/docker/overlay2/3d4c8 73a30ff0fdf5ad780543789f1ccbf7e5d5046ca91dbe9928fecec954044/merged/usr/local/bin /drush\\\" caused \\\"not a directory\\\"\"": unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type
    ERROR: Encountered errors while bringing up the project.




    我的 docker-compose.yml 内容如下:

    # docker-compose.yml
    version: "3"
    services:
    web:
    image: nginx:$NGINX_TAG
    container_name: "${PROJECT_NAME}_nginx"
    ports:
    - $NGINX_PORTA
    - $NGINX_PORTB
    volumes:
    - "./drupal/web:/var/www/html"
    - "./drupal/logs/nginx:/var/log/nginx"
    - "./drupal/nginx.conf:/etc/nginx/conf.d/default.conf"
    - "./drupal/cloudflare:/etc/ssl"
    depends_on:
    - php
    php:
    image: drupal:$DRUPAL_TAG
    container_name: "${PROJECT_NAME}_drupal"
    volumes:
    - "./drupal/drush/drush:/usr/local/bin/drush"
    - "./drupal/drush/composer:/usr/local/bin/composer"
    - "./drupal/mysql/mysql:/var/lib/mysql"
    - "./drupal/mysql/bin:/usr/bin"
    - "./drupal/web:/var/www/html"
    restart: always
    depends_on:
    - mysql
    drush:
    image: drush/drush
    volumes:
    - "./drupal/drush/drush:/usr/local/bin/drush"
    - "./drupal/drush/composer:/usr/local/bin/composer"
    mysql:
    image: mysql:$MYSQL_TAG
    container_name: "${PROJECT_NAME}_mysql"
    entrypoint: ['/entrypoint.sh', '--default-authentication-plugin=mysql_native_password']
    environment:
    MYSQL_ROOT_PASSWORD: $DB_ROOT_PASSWORD
    MYSQL_USER: $DB_USER
    MYSQL_PASSWORD: $DB_PASSWORD
    MYSQL_DATABASE: $DB_NAME
    volumes:
    - "./drupal/mysql/mysql:/var/lib/mysql"
    - "./drupal/mysql/bin:/usr/bin"
    restart: always
    programV2
        6
    programV2  
    OP
       2020-02-04 22:15:27 +08:00
    @mafeifan
    @drush 我根据上一条报错信息修改 docker-compose.yml 内容如下: 但是又遇到新的报错信息

    # docker-compose.yml
    version: "3"
    services:
    web:
    image: nginx:$NGINX_TAG
    container_name: "${PROJECT_NAME}_nginx"
    ports:
    - $NGINX_PORTA
    - $NGINX_PORTB
    volumes:
    - "./drupal/web:/var/www/html"
    - "./drupal/logs/nginx:/var/log/nginx"
    - "./drupal/nginx.conf:/etc/nginx/conf.d/default.conf"
    - "./drupal/cloudflare:/etc/ssl"
    depends_on:
    - php
    php:
    image: drupal:$DRUPAL_TAG
    container_name: "${PROJECT_NAME}_drupal"
    volumes:
    - "./drupal/drush:/usr/local/bin"
    - "./drupal/mysql/mysql:/var/lib/mysql"
    - "./drupal/mysql/bin:/usr/bin"
    - "./drupal/web:/var/www/html"
    restart: always
    depends_on:
    - mysql
    drush:
    image: drush/drush
    container_name: "${PROJECT_NAME}_drush"
    volumes:
    - "./drupal/drush:/usr/local/bin"
    mysql:
    image: mysql:$MYSQL_TAG
    container_name: "${PROJECT_NAME}_mysql"
    entrypoint: ['/entrypoint  .sh', '--default-authentication-plugin=mysql_native_password']
    environment:
    MYSQL_ROOT_PASSWORD: $DB_ROOT_PASSWORD
    MYSQL_USER: $DB_USER
    MYSQL_PASSWORD: $DB_PASSWORD
    MYSQL_DATABASE: $DB_NAME
    volumes:
    - "./drupal/mysql/mysql:/var/lib/mysql"
    - "./drupal/mysql/bin:/usr/bin"
    restart: always



    报错信息如下
      Creating drupal8_mysql ...
    Creating drupal8_drush ... error

    ERROR: for drupal8_drush Cannot start service drush: OCI runtime create failed: container_linux. Creating drupal8_mysql ... done
    unknown
    Creating drupal8_drupal ... error

    ERROR: for drupal8_drupal Cannot start service php: OCI runtime create failed: container_linux.g o:345: starting container process caused "exec: \"docker-php-entrypoint\": executable file not fo und in $PATH": unknown

    ERROR: for php Cannot start service php: OCI runtime create failed: container_linux.go:345: star ting container process caused "exec: \"docker-php-entrypoint\": executable file not found in $PAT H": unknown

    ERROR: for drush Cannot start service drush: OCI runtime create failed: container_linux.go:345: starting container process caused "exec: \"drush\": executable file not found in $PATH": unknown
    ERROR: Encountered errors while bringing up the project.
    drush
        7
    drush  
       2020-02-04 22:28:55 +08:00
    嗯。。其实我觉得不用太复习,你在 drupal 那个 docker container 里,composer require drush/drush 然后那里面那个 drush.phar 跑就行了
    drush
        8
    drush  
       2020-02-04 22:34:09 +08:00
    若果非要用 docker 装 drush 的话,可以试下 base 这个 php image https://github.com/wodby/drupal-php/blob/master/7/Dockerfile
    programV2
        9
    programV2  
    OP
       2020-02-04 23:25:27 +08:00
    @drush 谢谢大佬的回复! 我想访问 drupal 容器直接报错 ;

    $docker-compose exec php bash

    OCI runtime exec failed: exec failed: container_linux.go:345: starting container process caused "exec: \"bash\": executable file not found in $PATH": unknown

    用 docker-compose ps 查看如下 :

    drupal8_drupal docker-php-entrypoint php-fpm Up  
    drupal8_mysql /entrypoint.sh --default-a ... Restarting
    drupal8_nginx nginx -g daemon off; Up


    另外不知道为什么 mysql 一直在 restarting? 大佬您看我这个 docker-compose.yml 有问题吗? 为了让 drush 能访问 mysql, 我把 mysql 的 volumes 也复制到 drupal 容器

    # docker-compose.yml
    version: "3"
    services:
    web:
    image: nginx:$NGINX_TAG
    container_name: "${PROJECT_NAME}_nginx"
    ports:
    - $NGINX_PORTA
    - $NGINX_PORTB
    volumes:
    - "./drupal/web:/var/www/html"
    - "./drupal/logs/nginx:/var/log/nginx"
    - "./drupal/nginx.conf:/etc/nginx/conf.d/default.conf"
    - "./drupal/cloudflare:/etc/ssl"
    depends_on:
    - php
    php:
    image: drupal:$DRUPAL_TAG
    container_name: "${PROJECT_NAME}_drupal"
    volumes:
    - "./drupal/mysql/mysql:/var/lib/mysql"
    - "./drupal/mysql/bin:/usr/bin"
    - "./drupal/web:/var/www/html"
    restart: always
    depends_on:
    - mysql
    mysql:
    image: mysql:$MYSQL_TAG
    container_name: "${PROJECT_NAME}_mysql"
    entrypoint: ['/entrypoint.sh', '--default-authentication-plugin=mysql_native_password']
    environment:
    MYSQL_ROOT_PASSWORD: $DB_ROOT_PASSWORD
    MYSQL_USER: $DB_USER
    MYSQL_PASSWORD: $DB_PASSWORD
    MYSQL_DATABASE: $DB_NAME
    volumes:
    - "./drupal/mysql/mysql:/var/lib/mysql"
    - "./drupal/mysql/bin:/usr/bin"
    restart: always
    programV2
        10
    programV2  
    OP
       2020-02-06 16:46:11 +08:00
    @drush V 友你好, 我执行 composer require drush/drush 后显示 没有 composer 这个命令, 然后我用以下代码手动安装:

    php -r "readfile('http://files.drush.org/drush.phar');" > drush && chmod +x drush && mv drush /usr/bin/

    但是执行# /usr/local/bin/drush uli 报错:
    /usr/local/bin/drush: line 2: syntax error: unexpected "("

    请问还有什么办法安装上drush吗? 谢谢!
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2513 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 11:33 · PVG 19:33 · LAX 04:33 · JFK 07:33
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.