wordpress的多语言站点与单点登录

1.其登录后台的权限关键代码在【wp-admin/includes/menu.php】中,如下所示:

wordpress是支持多语言站点,但如果希望多站点实现单点登录的话,需要修改如下几项。

// 不同的语言的站点均配置相同的用户表。
define('CUSTOM_USER_TABLE', 'ayd_users'); 
define('CUSTOM_USER_META_TABLE', 'ayd_usermeta');

共享的用户表,ayd_usermeta表需要添加管理员权限,否则是无法登录后台的。其字段格式是以表前缀开头的,如下:

$table_prefix . _capabilities和 $table_prefix ._user_level,假如$table_prefix是cn,则如下内容为【key, value】
cn_capabilities = a:1:{s:13:"administrator";b:1;}
cn_user_level = 10
如果还有另外其个项也顺便修改它,如:cn_user-settings / cn_user-settings-time

如果在登录后台时,仍然报错,则可能是表前缀是由其它前缀修改过来的,此时仍需要修改【$table_prefix .option】表的cn_user_roles,如下所示:

cn_user_roles的值如下:
a:5:{s:13:"administrator";a:2:{s:4:"name";s:13:"Administrator";s:12:"capabilities";a:65:{s:13:"switch_themes";b:1;s:11:"edit_themes";b:1;s:16:"activate_plugins";b:1;s:12:"edit_plugins";b:1;s:10:"edit_users";b:1;s:10:"edit_files";b:1;s:14:"manage_options";b:1;s:17:"moderate_comments";b:1;s:17:"manage_categories";b:1;s:12:"manage_links";b:1;s:12:"upload_files";b:1;s:6:"import";b:1;s:15:"unfiltered_html";b:1;s:10:"edit_posts";b:1;s:17:"edit_others_posts";b:1;s:20:"edit_published_posts";b:1;s:13:"publish_posts";b:1;s:10:"edit_pages";b:1;s:4:"read";b:1;s:8:"level_10";b:1;s:7:"level_9";b:1;s:7:"level_8";b:1;s:7:"level_7";b:1;s:7:"level_6";b:1;s:7:"level_5";b:1;s:7:"level_4";b:1;s:7:"level_3";b:1;s:7:"level_2";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:17:"edit_others_pages";b:1;s:20:"edit_published_pages";b:1;s:13:"publish_pages";b:1;s:12:"delete_pages";b:1;s:19:"delete_others_pages";b:1;s:22:"delete_published_pages";b:1;s:12:"delete_posts";b:1;s:19:"delete_others_posts";b:1;s:22:"delete_published_posts";b:1;s:20:"delete_private_posts";b:1;s:18:"edit_private_posts";b:1;s:18:"read_private_posts";b:1;s:20:"delete_private_pages";b:1;s:18:"edit_private_pages";b:1;s:18:"read_private_pages";b:1;s:12:"delete_users";b:1;s:12:"create_users";b:1;s:17:"unfiltered_upload";b:1;s:14:"edit_dashboard";b:1;s:14:"update_plugins";b:1;s:14:"delete_plugins";b:1;s:15:"install_plugins";b:1;s:13:"update_themes";b:1;s:14:"install_themes";b:1;s:11:"update_core";b:1;s:10:"list_users";b:1;s:12:"remove_users";b:1;s:13:"promote_users";b:1;s:18:"edit_theme_options";b:1;s:13:"delete_themes";b:1;s:6:"export";b:1;s:11:"smartslider";b:1;s:18:"smartslider_config";b:1;s:16:"smartslider_edit";b:1;s:18:"smartslider_delete";b:1;}}s:6:"editor";a:2:{s:4:"name";s:6:"Editor";s:12:"capabilities";a:34:{s:17:"moderate_comments";b:1;s:17:"manage_categories";b:1;s:12:"manage_links";b:1;s:12:"upload_files";b:1;s:15:"unfiltered_html";b:1;s:10:"edit_posts";b:1;s:17:"edit_others_posts";b:1;s:20:"edit_published_posts";b:1;s:13:"publish_posts";b:1;s:10:"edit_pages";b:1;s:4:"read";b:1;s:7:"level_7";b:1;s:7:"level_6";b:1;s:7:"level_5";b:1;s:7:"level_4";b:1;s:7:"level_3";b:1;s:7:"level_2";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:17:"edit_others_pages";b:1;s:20:"edit_published_pages";b:1;s:13:"publish_pages";b:1;s:12:"delete_pages";b:1;s:19:"delete_others_pages";b:1;s:22:"delete_published_pages";b:1;s:12:"delete_posts";b:1;s:19:"delete_others_posts";b:1;s:22:"delete_published_posts";b:1;s:20:"delete_private_posts";b:1;s:18:"edit_private_posts";b:1;s:18:"read_private_posts";b:1;s:20:"delete_private_pages";b:1;s:18:"edit_private_pages";b:1;s:18:"read_private_pages";b:1;}}s:6:"author";a:2:{s:4:"name";s:6:"Author";s:12:"capabilities";a:10:{s:12:"upload_files";b:1;s:10:"edit_posts";b:1;s:20:"edit_published_posts";b:1;s:13:"publish_posts";b:1;s:4:"read";b:1;s:7:"level_2";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:12:"delete_posts";b:1;s:22:"delete_published_posts";b:1;}}s:11:"contributor";a:2:{s:4:"name";s:11:"Contributor";s:12:"capabilities";a:5:{s:10:"edit_posts";b:1;s:4:"read";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:12:"delete_posts";b:1;}}s:10:"subscriber";a:2:{s:4:"name";s:10:"Subscriber";s:12:"capabilities";a:2:{s:4:"read";b:1;s:7:"level_0";b:1;}}}

WordPress安装主题等提示FTP问题

wordpress为了安全考虑,故意留下来的。
需要在wp_config.php的文件中添加如下代码,即可:

define('WP_TEMP_DIR',ABSPATH.'wp-content/tmp');
define("FS_METHOD","direct");
define("FS_CHMOD_DIR",0777);
define("FS_CHMOD_FILE",0777);

xdebug的nginx配置

修改请求的Cookie信息。如下:
proxy_set_header Cookie “$http_cookie; XDEBUG_SESSION=PHPSTROM”;

完整的一份配置

server {
     listen 80;  #from https port to http port .
     location / {
         proxy_pass   http://127.0.0.1:8080/;
         proxy_set_header Cookie "$http_cookie; XDEBUG_SESSION=PHPSTROM";
         proxy_set_header Host $host;
     }
}

server {
    listen 8080;
    location ~ \.php$ {     
        fastcgi_pass   127.0.0.1:9090;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }

}

Jetbrain的安装包带JBR与不带JBR的区别

以GoLang2019.3.4为例。

带JBR是指该JBR使用的版本为jetbrain公司自家的运行时库。因为该运行时库不是OpenJDK的认证版本,故可能在某个平台上如Centos7.5的平台上,某些时候可能会运行故障。
故应该使用不带JBR标识别的版本,该版本才真正的与openJDK认证的高兼容性的版本。
在centos环境下,建议使用不带JBR的版本

以下是其安装包解压后的差异对比。

gitlab的部署方式

version: '3'

services:
  gitlab:
    image: gitlab/gitlab-ce:11.9.12-ce.0
    restart: always
    container_name: gitlab
    hostname: gitlab.pointsmart.cn
    privileged: true
    user: root
    ports:
      - "80:80"
      - "443:443"
      - "222:22"
    environment:
      GITLAB_OMNIBUS_CONFIG: |
        gitlab_rails['time_zone'] = 'Asia/Shanghai'
        gitlab_rails['gitlab_shell_ssh_port'] = 222
        gitlab_rails['gitlab_shell_git_timeout'] = 800
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /data/gitlab/config:/etc/gitlab
      - /data/gitlab/logs:/var/log/gitlab
      - /data/gitlab/data:/var/opt/gitlab

通过进程ID查找容器

for i in  `docker ps -q`;do docker top $i; done
 for i in $(docker ps -q); do docker top $i; done
或
for i in  `docker ps |grep Up|awk '{print $1}'`;do docker top $i; done