瀏覽代碼

Merge branches 'laravel' and 'laravel' of https://github.com/visuddhinanda/mint into laravel

bhikkhu-kosalla-china 4 年之前
父節點
當前提交
b578d710d9
共有 52 個文件被更改,包括 482 次插入231 次删除
  1. 4 1
      .env.example
  2. 40 1
      app/Console/Commands/InstallPaliSeries.php
  3. 2 0
      app/Models/BookTitle.php
  4. 14 1
      change-logs.md
  5. 1 0
      composer.json
  6. 1 0
      deploy/.gitignore
  7. 3 3
      deploy/README.md
  8. 4 2
      deploy/group_vars/all.yml
  9. 4 2
      deploy/mint.yml
  10. 24 0
      deploy/roles/certbot-nginx/tasks/main.yml
  11. 11 6
      deploy/roles/mint-assets/tasks/main.yml
  12. 1 1
      deploy/roles/mint-assets/templates/nginx.conf.j2
  13. 0 63
      deploy/roles/mint-clone/main.yml
  14. 98 0
      deploy/roles/mint-clone/tasks/main.yml
  15. 1 1
      deploy/roles/mint-clone/templates/config-v1.js.j2
  16. 10 9
      deploy/roles/mint-clone/templates/config-v1.php.j2
  17. 23 22
      deploy/roles/mint-clone/templates/env-v2.j2
  18. 2 2
      deploy/roles/mint-www/tasks/main.yml
  19. 24 14
      deploy/roles/mint-www/templates/nginx.conf.j2
  20. 0 7
      deploy/roles/os/tasks/init.yml
  21. 5 5
      deploy/roles/os/tasks/main.yml
  22. 4 4
      deploy/roles/os/tasks/ulimits.yml
  23. 5 2
      deploy/roles/php/tasks/main.yml
  24. 12 14
      deploy/roles/ubuntu/tasks/main.yml
  25. 5 0
      deploy/roles/ubuntu/tasks/zsh.yml
  26. 44 0
      deploy/scripts/assets.sh
  27. 6 0
      deploy/staging/hosts
  28. 6 1
      public/app/config.dir.php
  29. 3 0
      public/app/config.table.php
  30. 19 17
      public/app/dict/dict_lookup.php
  31. 1 1
      public/app/install/db_insert_palitext_cli.php
  32. 1 1
      public/app/install/db_update_palitext_cli.php
  33. 5 8
      public/app/palicanon/book_tag.php
  34. 5 8
      public/app/palicanon/get_chapter_children.php
  35. 5 8
      public/app/palicanon/get_chapter_info.php
  36. 15 2
      public/app/pcdl/head_bar.php
  37. 1 1
      public/app/pcdl/html_foot.php
  38. 3 1
      public/app/redis/function.php
  39. 1 0
      public/app/studio/css/style.css
  40. 25 3
      public/app/studio/editor.php
  41. 3 1
      public/app/studio/index.php
  42. 25 4
      public/app/studio/js/editor.js
  43. 1 1
      v1/scripts/install.bat
  44. 1 0
      v1/scripts/install.sh
  45. 8 8
      v1/scripts/migrations/20211125155700_pali_sent_org.php
  46. 6 6
      v1/scripts/migrations/20211127214800_sent_sim.php
  47. 0 0
      v1/windows/install1.bat
  48. 0 0
      v1/windows/install2.bat
  49. 0 0
      v1/windows/install3.bat
  50. 0 0
      v1/windows/install4.bat
  51. 0 0
      v1/windows/install5.bat
  52. 0 0
      v1/windows/install6.bat

+ 4 - 1
.env.example

@@ -58,4 +58,7 @@ MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
 RPC_SERVER="https://rpc.wikipali.org"
 ASSETS_SERVER="https://assets-hk.wikipali.org"
 HELP_SERVER="https://help-hk.wikipali.org"
-GRAMMAR_SERVER="https://grammar-hk.wikipali.org"
+GRAMMAR_SERVER="https://grammar-hk.wikipali.org"
+
+SNOWFLAKE_DATA_CENTER_ID = 1
+SNOWFLAKE_WORKER_ID = 1

+ 40 - 1
app/Console/Commands/InstallPaliSeries.php

@@ -3,6 +3,9 @@
 namespace App\Console\Commands;
 
 use Illuminate\Console\Command;
+use App\Models\BookTitle;
+use Illuminate\Support\Facades\DB;
+use Illuminate\Support\Facades\Log;
 
 class InstallPaliSeries extends Command
 {
@@ -11,7 +14,7 @@ class InstallPaliSeries extends Command
      *
      * @var string
      */
-    protected $signature = 'command:name';
+    protected $signature = 'install:paliseries';
 
     /**
      * The console command description.
@@ -37,6 +40,42 @@ class InstallPaliSeries extends Command
      */
     public function handle()
     {
+		$this->info("upgrade pali text");
+		$startTime = time();
+
+
+
+					DB::transaction(function () {
+						#删除目标数据库中数据
+						BookTitle::where('book','>',0)->delete();
+
+					// 打开csv文件并读取数据										
+						$strFileName = config("app.path.pali_title") . "/pali_serieses.csv";
+						if(!file_exists($strFileName)){
+							return 1;
+						}						
+						$inputRow = 0;
+						if (($fp = fopen($strFileName, "r")) !== false) {
+							while (($data = fgetcsv($fp, 0, ',')) !== false) {
+								if($inputRow>0){
+									$newData = [
+										'book'=>$data[1],
+										'paragraph'=>$data[2],
+										'title'=>$data[3],
+									];
+		
+									BookTitle::create($newData);									
+								}
+								$inputRow++;
+							}
+							fclose($fp);
+							Log::info("res load:" .$strFileName);
+						} else {
+							$this->error("can not open csv $strFileName");
+							Log::error("can not open csv $strFileName");
+						}
+					});
+		$this->info("ok");
         return 0;
     }
 }

+ 2 - 0
app/Models/BookTitle.php

@@ -8,4 +8,6 @@ use Illuminate\Database\Eloquent\Model;
 class BookTitle extends Model
 {
     use HasFactory;
+	
+	protected $fillable = ['book' , 'paragraph' , 'title'];
 }

+ 14 - 1
change-logs.md

@@ -32,4 +32,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 - rename RPC_DOMAIN_NAME -> RPC_SERVER in config.sample.php
 - remove WWW_DOMAIN_NAME  from config.sample.js
 - rename RPC_DOMAIN_NAME -> RPC_SERVER in config.sample.js
-- add RPC_SERVER to .env.example
+- add RPC_SERVER to .env.example
+
+## [1.0.4] - 2022-01-21
+
+- add SNOWFLAKE to .env.example
+- add SnowFlake to config.sample.php
+- add SnowFlakeDate to config.table.php
+- add dependency godruoyi/php-snowflake
+
+## [1.0.5] - 2022-01-24
+
+- add 帮助文件路径 URL_HELP to config.dir.php
+- add 巴利语手册路径 URL_PALI_HANDBOOK to config.dir.php
+- add help & handbook link 

+ 1 - 0
composer.json

@@ -7,6 +7,7 @@
     "require": {
         "php": "^7.3|^8.0",
         "fruitcake/laravel-cors": "^2.0",
+        "godruoyi/php-snowflake": "^2.0",
         "guzzlehttp/guzzle": "^7.0.1",
         "laravel/framework": "^8.75",
         "laravel/sanctum": "^2.11",

+ 1 - 0
deploy/.gitignore

@@ -1,2 +1,3 @@
 /clients/
+/tmp/
 *.log

+ 3 - 3
deploy/README.md

@@ -18,11 +18,11 @@ ssh-copy-id -i .ssh/id_ed25519 USER@HOST
 
 ```bash
 # test ssh connections
-peony -i staging ping.yml
+peony -i clients/CLUSTER ping.yml
 # run on all hosts
-peony -i staging pi.yml
+peony -i clients/CLUSTER ping.yml
 # run on only group
-peony -i staging pi.yml -l GROUP
+peony -i clients/CLUSTER ping.yml -l GROUP
 ```
 
 ## System image

+ 4 - 2
deploy/group_vars/all.yml

@@ -3,6 +3,8 @@ ansible_python_interpreter: /usr/bin/python3
 ansible_ssh_private_key_file: "{{ inventory_dir }}/.ssh/id_ed25519"
 #ansible_ssh_private_key_file: "{{inventory_dir}}/.ssh/id_rsa"
 
-app_www_deploy_target: "/var/www/{{ inventory_hostname }}/{{ ansible_date_time.iso8601_basic }}"
+app_deploy_target: "/var/www/{{ inventory_hostname }}/{{ ansible_date_time.iso8601_basic }}"
+app_downloads: "{{ ansible_env.HOME }}/downloads"
+app_backup: "{{ ansible_env.HOME }}/backups"
 app_python_version: "3.11"
-app_php_version: "8.0"
+app_php_version: "8.1"

+ 4 - 2
deploy/mint.yml

@@ -1,18 +1,20 @@
 - hosts: all
   roles:
-    - os
     - ubuntu
+    - os
     - python3
     - php
-    - mint-clone
 
 - hosts: www
   roles:
+    - mint-clone
     - mint-www
+    - certbot-nginx
 
 - hosts: assets
   roles:
     - mint-assets
+    - certbot-nginx
 
 - hosts: db
   roles:

+ 24 - 0
deploy/roles/certbot-nginx/tasks/main.yml

@@ -0,0 +1,24 @@
+- name: Remove file nginx default host
+  become: true
+  ansible.builtin.file:
+    path: /etc/nginx/sites-enabled/default
+    state: absent
+
+- name: add Let's Encrypt support
+  become: true
+  ansible.builtin.shell:
+    cmd: certbot --nginx --non-interactive --agree-tos -m {{ app_master_email }} --domains {{ inventory_hostname }}
+
+- name: restart nginx
+  become: true
+  ansible.builtin.systemd:
+    state: restarted
+    name: nginx
+
+- name: enable certbot sync
+  become: true
+  ansible.builtin.cron:
+    name: "renew certbot every month"
+    special_time: monthly
+    job: "/usr/bin/certbot renew --force-renewal"
+

+ 11 - 6
deploy/roles/mint-assets/tasks/main.yml

@@ -1,16 +1,21 @@
+# - name: Upload assets folder
+#   become: true
+#   ansible.builtin.copy:
+#     src: public
+#     dest: /var/www/{{ inventory_hostname }}
+#     owner: www-data
+#     group: www-data
+
 - name: Upload assets folder
-  become: true
-  ansible.builtin.copy:
+  ansible.posix.synchronize:
     src: public
     dest: /var/www/{{ inventory_hostname }}
-    owner: www-data
-    group: www-data
 
 - name: upload nginx.conf
-  bacame: true
+  become: true
   ansible.builtin.template:
     src: nginx.conf.j2
-    dest: "/etc/nginx/sites-enabled/{{ inventory_hostname }}"
+    dest: "/etc/nginx/sites-enabled/{{ inventory_hostname }}.conf"
     owner: www-data
     group: www-data
     mode: '0400'

+ 1 - 1
deploy/roles/mint-assets/templates/nginx.conf.j2

@@ -3,7 +3,7 @@ server {
 
     gzip on;
     server_name {{ inventory_hostname }};
-    root /var/www/{{ inventory_hostname }};
+    root /var/www/{{ inventory_hostname }}/public;
 
     access_log off;
     error_log /var/log/nginx/{{ inventory_hostname }}.error.log warn;

+ 0 - 63
deploy/roles/mint-clone/main.yml

@@ -1,63 +0,0 @@
-- name: Creates directory
-  become: true
-  file:
-    path: "/var/www/{{ inventory_hostname }}"
-    state: directory
-    owner: "{{ ansible_user }}"
-
-- name: Git checkout source code
-  ansible.builtin.git:
-    repo: 'https://github.com/iapt-platform/mint.git'
-    dest: "{{ app_www_deploy_target }}"
-    version: laravel
-
-- name: Install v2 php dependencies
-  ansible.builtin.shell: composer install
-  args:
-    chdir: "{{ app_www_deploy_target }}"
-
-- name: Install v2 nodejs dependencies
-  ansible.builtin.shell: npm install
-  args:
-    chdir: "{{ app_www_deploy_target }}"
-
-# TODO will remove in future
-- name: Install v1 php dependencies
-  ansible.builtin.shell: composer install
-  args:
-    chdir: "{{ app_www_deploy_target }}/public"
-
-# TODO will remove in future
-- name: Install v1 nodejs dependencies
-  ansible.builtin.shell: npm install
-  args:
-    chdir: "{{ app_www_deploy_target }}/public"
-
-- name: .env(v2)
-  bacame: true
-  ansible.builtin.template:
-    src: env-v2.j2
-    dest: "{{ app_www_deploy_target }}/.env"
-    owner: www-data
-    group: www-data
-    mode: '0400'
-
-# TODO will remove in future
-- name: config.php(v1)
-  bacame: true
-  ansible.builtin.template:
-    src: config-v1.php.j2
-    dest: "{{ app_www_deploy_target }}/public/app/config.php"
-    owner: www-data
-    group: www-data
-    mode: '0400'
-
-# TODO will remove in future
-- name: config.js(v1)
-  bacame: true
-  ansible.builtin.template:
-    src: config-v1.js.j2
-    dest: "{{ app_www_deploy_target }}/public/app/config.js"
-    owner: www-data
-    group: www-data
-    mode: '0400'

+ 98 - 0
deploy/roles/mint-clone/tasks/main.yml

@@ -0,0 +1,98 @@
+- name: Creates deploy directory
+  become: true
+  file:
+    path: "/var/www/{{ inventory_hostname }}"
+    state: directory
+    owner: "{{ ansible_user }}"
+
+- name: Git checkout source code
+  ansible.builtin.git:
+    repo: 'https://github.com/iapt-platform/mint.git'
+    dest: "{{ app_deploy_target }}"
+    version: laravel
+
+- name: Setup storage folder
+  ansible.builtin.file:
+    path: "{{ app_deploy_target }}/storage"
+    owner: www-data
+    group: www-data
+
+- name: Install v2 php dependencies
+  ansible.builtin.shell: "php{{ app_php_version }} {{ ansible_env.HOME }}/.local/bin/composer install"
+  args:
+    chdir: "{{ app_deploy_target }}"
+
+# - name: Install v2 nodejs dependencies
+#   ansible.builtin.shell: npm install
+#   args:
+#     chdir: "{{ app_deploy_target }}"
+- name: Install v2 nodejs dependencies
+  ansible.builtin.file:
+    src: "/var/www/{{ inventory_hostname }}/node_modules/v2"
+    dest: "{{ app_deploy_target }}/node_modules"
+    state: link
+
+# TODO will remove in future
+- name: Install v1 php dependencies
+  ansible.builtin.shell: "php{{ app_php_version }} {{ ansible_env.HOME }}/.local/bin/composer install"
+  args:
+    chdir: "{{ app_deploy_target }}/public"
+
+# TODO will remove in future
+# - name: Install v1 nodejs dependencies
+#   ansible.builtin.shell: npm install
+#   args:
+#     chdir: "{{ app_deploy_target }}/public"
+- name: Install v1 nodejs dependencies
+  ansible.builtin.file:
+    src: "/var/www/{{ inventory_hostname }}/node_modules/v1"
+    dest: "{{ app_deploy_target }}/public/node_modules"
+    state: link
+
+- name: Install v2 tmp
+  ansible.builtin.file:
+    src: "/var/www/{{ inventory_hostname }}/tmp"
+    dest: "{{ app_deploy_target }}/tmp"
+    state: link
+
+# TODO will remove in future
+- name: Install v1 tmp
+  ansible.builtin.file:
+    src: "/var/www/{{ inventory_hostname }}/tmp"
+    dest: "{{ app_deploy_target }}/public/tmp"
+    state: link
+
+- name: .env(v2)
+  become: true
+  ansible.builtin.template:
+    src: env-v2.j2
+    dest: "{{ app_deploy_target }}/.env"
+    owner: www-data
+    group: www-data
+    mode: '0400'
+
+# TODO will remove in future
+- name: config.php(v1)
+  become: true
+  ansible.builtin.template:
+    src: config-v1.php.j2
+    dest: "{{ app_deploy_target }}/public/app/config.php"
+    owner: www-data
+    group: www-data
+    mode: '0400'
+
+# TODO will remove in future
+- name: config.js(v1)
+  become: true
+  ansible.builtin.template:
+    src: config-v1.js.j2
+    dest: "{{ app_deploy_target }}/public/app/config.js"
+    owner: www-data
+    group: www-data
+    mode: '0400'
+
+- name: Create a current link
+  ansible.builtin.file:
+    src: "{{ app_deploy_target }}"
+    dest: /var/www/{{ inventory_hostname }}/current
+    state: link

+ 1 - 1
deploy/roles/mint-clone/templates/config-v1.js.j2

@@ -11,4 +11,4 @@ var RPC_SERVER="https://rpc.wikipali.org";
   |------------------------
 */
 
-var ASSETS_SERVER = "https://assets-hk.wikipali.org"
+var ASSETS_SERVER = "https://assets-{{ app_cluster_id }}.wikipali.org"

+ 10 - 9
deploy/roles/mint-clone/templates/config-v1.php.j2

@@ -4,6 +4,7 @@ require_once __DIR__."/config.dir.php";
 
 #域名设置
 define("RPC_SERVER","https://rpc.wikipali.org");
+define("ASSETS_SERVER","https://assets-{{ app_cluster_id }}.wikipali.org");
 /*
 电子邮件设置
 PHPMailer
@@ -11,11 +12,11 @@ PHPMailer
 define("Email", [
 				 "Host"=>"smtp.gmail.com",//Set the SMTP server to send through
 				 "SMTPAuth"=>true,//Enable SMTP authentication
-				 "Username"=>'your@gmail.com',//SMTP username
-				 "Password"=>'your_password',//SMTP password
+				 "Username"=>'{{ app_smtp_username }}',//SMTP username
+				 "Password"=>'{{ app_smtp_password }}',//SMTP password
 				 "Port"=>465,//TCP port to connect to 465; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS`
-				 "From"=>"your@gmail.com",
-				 "Sender"=>"sender"
+				 "From"=>"{{ app_smtp_username }}",
+				 "Sender"=>"webmaster"
 				 ]);
 
 /*
@@ -23,12 +24,12 @@ define("Email", [
 */
 define("Database",[
 	"type"=>"pgsql",
-	"server"=>"localhost",
-	"port"=>5432,
-	"name"=>"mint",
+	"server"=>"{{ app_postgresql_host }}",
+	"port"=>{{ app_postgresql_port }},
+	"name"=>"{{ app_postgresql_name }}",
 	"sslmode" => "disable",
-	"user" => "postgres",
-	"password" => "123456"
+	"user" => "{{ app_postgresql_user }}",
+	"password" => "{{ app_postgresql_password }}"
 ]);
 
 

+ 23 - 22
deploy/roles/mint-clone/templates/env-v2.j2

@@ -1,26 +1,26 @@
-BASE_DIR="/workspace/.env.global"
+BASE_DIR="{{ app_deploy_target }}/.env.global"
 CACHE_DIR="${BASE_DIR}/cache"
 TMP_DIR="${BASE_DIR}/tmp"
 
-APP_NAME={{  }}
-APP_ENV=local
-APP_KEY=
-APP_DEBUG=true
-APP_URL=http://localhost
+APP_NAME=wikipali
+APP_ENV=production
+APP_KEY="{{ app_laravel_key }}"
+APP_DEBUG=false
+APP_URL="https://{{ inventory_hostname }}"
 
 LOG_CHANNEL=stack
 LOG_DEPRECATIONS_CHANNEL=null
-LOG_LEVEL=debug
+LOG_LEVEL=info
 
-DB_CONNECTION=mysql
-DB_HOST=127.0.0.1
-DB_PORT=3306
-DB_DATABASE=mint_new
-DB_USERNAME=root
-DB_PASSWORD=
+DB_CONNECTION=postgresql
+DB_HOST={{ app_postgresql_host }}
+DB_PORT={{ app_postgresql_port }}
+DB_DATABASE={{ app_postgresql_name }}
+DB_USERNAME={{ app_postgresql_user }}
+DB_PASSWORD="{{ app_postgresql_password }}"
 
 BROADCAST_DRIVER=log
-CACHE_DRIVER=file
+CACHE_DRIVER=redis
 FILESYSTEM_DRIVER=local
 QUEUE_CONNECTION=sync
 SESSION_DRIVER=file
@@ -28,18 +28,18 @@ SESSION_LIFETIME=120
 
 MEMCACHED_HOST=127.0.0.1
 
-REDIS_HOST=127.0.0.1
+REDIS_HOST={{ app_redis_host }}
 REDIS_PASSWORD=null
 REDIS_PORT=6379
 
 MAIL_MAILER=smtp
-MAIL_HOST=mailhog
-MAIL_PORT=1025
-MAIL_USERNAME=null
-MAIL_PASSWORD=null
-MAIL_ENCRYPTION=null
-MAIL_FROM_ADDRESS=null
-MAIL_FROM_NAME="${APP_NAME}"
+MAIL_HOST=smtp.gmail.com
+MAIL_PORT=465
+MAIL_USERNAME={{ app_smtp_username }}
+MAIL_PASSWORD="{{ app_smtp_password }}"
+MAIL_ENCRYPTION=ssl
+MAIL_FROM_ADDRESS={{ app_smtp_username }}
+MAIL_FROM_NAME="webmaster"
 
 AWS_ACCESS_KEY_ID=
 AWS_SECRET_ACCESS_KEY=
@@ -56,3 +56,4 @@ MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
 MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
 
 ASSETS_SERVER="https://assets-{{ app_cluster_id }}.wikipali.org"
+RPC_SERVER="https://rpc.wikipali.org"

+ 2 - 2
deploy/roles/mint-www/tasks/main.yml

@@ -1,8 +1,8 @@
 - name: upload nginx.conf
-  bacame: true
+  become: true
   ansible.builtin.template:
     src: nginx.conf.j2
-    dest: "/etc/nginx/sites-enabled/{{ inventory_hostname }}"
+    dest: "/etc/nginx/sites-enabled/{{ inventory_hostname }}.conf"
     owner: www-data
     group: www-data
     mode: '0400'

+ 24 - 14
deploy/roles/mint-www/templates/nginx.conf.j2

@@ -1,33 +1,43 @@
+# https://laravel.com/docs/8.x/deployment#nginx
+
 server {
     listen 80;
+    listen [::]:80;
+
+    add_header X-Frame-Options "SAMEORIGIN";
+    add_header X-Content-Type-Options "nosniff";
 
     gzip on;
     server_name {{ inventory_hostname }};
-    root {{ app_www_deploy_target }};
+    root {{ app_deploy_target }}/public;
     client_max_body_size 16M;
+    index index.php;
+    charset utf-8;
 
-    access_log off;
+    access_log /var/log/nginx/{{ inventory_hostname }}.access.log;
     error_log /var/log/nginx/{{ inventory_hostname }}.error.log warn;
 
     location / {
-        index index.html index.php;
+        try_files $uri $uri/ /index.php?$query_string;
     }
 
-    location ~ /.git/ {
-        deny all;
+    location = /favicon.ico {
+        log_not_found off;
+    }
+    location = /robots.txt  {
+        log_not_found off;
     }
 
-    location ~ \.php$ {
-        try_files $fastcgi_script_name =404;
+    error_page 404 /index.php;
 
+    location ~ \.php$ {
+        fastcgi_pass unix:/var/run/php/php{{ app_php_version }}-fpm.sock;
+        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
         include fastcgi_params;
+    }
 
-        fastcgi_pass			unix:/run/php/php{{ app_php_version }}-fpm.sock;
-        fastcgi_index			index.php;
-        fastcgi_buffers			8 16k;
-        fastcgi_buffer_size		32k;
-
-        fastcgi_param DOCUMENT_ROOT     $realpath_root;
-        fastcgi_param SCRIPT_FILENAME   $realpath_root$fastcgi_script_name;
+    location ~ /\.(?!well-known).* {
+        deny all;
     }
+
 }

+ 0 - 7
deploy/roles/os/tasks/init.yml

@@ -1,10 +1,3 @@
-- name: create deploy folder
-  become: true
-  ansible.builtin.file:
-    path: "{{ app_deploy_target }}"
-    state: directory
-    owner: "{{ ansible_user }}"
-
 - name: create downloads folder
   become: true
   ansible.builtin.file:

+ 5 - 5
deploy/roles/os/tasks/main.yml

@@ -1,8 +1,8 @@
-- include: init.yml
-- include: sshd.yml
-- include: ulimits.yml
+- import_tasks: init.yml
+- import_tasks: sshd.yml
+- import_tasks: ulimits.yml
 
-- name: Setup sudo without password 
+- name: Setup sudo without password
   become: true
   ansible.builtin.template:
     src: sudo.conf.j2
@@ -25,7 +25,7 @@
   become: true
   shell: timedatectl set-timezone UTC
 
-- name: Setup journald storage 
+- name: Setup journald storage
   become: true
   lineinfile:
     path: /etc/systemd/journald.conf

+ 4 - 4
deploy/roles/os/tasks/ulimits.yml

@@ -56,17 +56,17 @@
     path: /etc/security/limits.conf
     line: root        soft nofile 10240
 
-- name: Set user level ppen file limits for {{ansible_user}}
+- name: Set user level open file limits for {{ ansible_user }}
   become: true
   lineinfile:
     path: /etc/security/limits.conf
-    line: "{{ansible_user}}        soft nofile 10240"
+    line: "{{ ansible_user }}        soft nofile 10240"
 
 # https://docs.oracle.com/en/database/oracle/oracle-database/12.2/ladbi/changing-kernel-parameter-values.html#GUID-FB0CC366-61C9-4AA2-9BE7-233EB6810A31
 - name: Setup file max
   become: true
   lineinfile:
-    path: "/etc/sysctl.d/100-{{app_vendor}}.conf"
+    path: "/etc/sysctl.d/100-fs.conf"
     state: present
     line: fs.file-max = 6815744
     create: true
@@ -74,7 +74,7 @@
 - name: Setup file max
   become: true
   lineinfile:
-    path: "/etc/sysctl.d/100-{{app_vendor}}.conf"
+    path: "/etc/sysctl.d/100-fs.conf"
     state: present
     line: fs.inotify.max_user_watches = 512000
     create: true

+ 5 - 2
deploy/roles/php/tasks/main.yml

@@ -24,14 +24,17 @@
       - php{{ app_php_version }}-redis
       - php{{ app_php_version }}-bcmath
 
+- name: Creates composer install directory
+  file:
+    path: "{{ ansible_env.HOME }}/.local/bin"
+    state: directory
+
 # https://getcomposer.org/doc/00-intro.md#installation-linux-unix-macos
 - name: Download composer
   get_url:
     url: https://getcomposer.org/download/latest-stable/composer.phar
     dest: "{{ ansible_env.HOME }}/.local/bin/composer"
     mode: 0755
-  args:
-    creates: "{{ ansible_env.HOME }}/.local/bin/composer"
 
 - name: Restart php-fpm
   become: true

+ 12 - 14
deploy/roles/ubuntu/tasks/main.yml

@@ -79,6 +79,7 @@
       - unzip
       - nginx
       - certbot
+      - python3-certbot-nginx
       - openvpn
       - snmpd
       - systemd-cron
@@ -90,12 +91,15 @@
       - python3-pip
       - python3-distutils
       - python3-dev
+      - nodejs
+      - npm
+      - yarnpkg
       - libssl-dev
       - libpq-dev
       - libmysqlclient-dev
 
 
-- include: locales.yml
+- import_tasks: locales.yml
 
 - name: Set default editor to vim
   become: true
@@ -109,7 +113,7 @@
   become: true
   shell: git config --global pull.rebase false
 
-- include: zsh.yml
+- import_tasks: zsh.yml
 
 # ---------------------------------------------------
 
@@ -118,7 +122,7 @@
     path: /etc/friendlyelec-release
   register: app_os_friendlyelec
 
-- include: friendly-core.yml
+- import_tasks: friendly-core.yml
   when: app_os_friendlyelec.stat.islnk is defined and app_os_friendlyelec.stat.isreg
 
 - name: check if armbian
@@ -126,13 +130,13 @@
     path: /etc/armbian-release
   register: app_os_armbian
 
-- include: armbian.yml
+- import_tasks: armbian.yml
   when: app_os_armbian.stat.islnk is defined and app_os_armbian.stat.isreg
 
-- include: raspbian.yml
+- import_tasks: raspbian.yml
   when: ansible_distribution == 'Raspbian'
 
-- include: pi.yml
+- import_tasks: pi.yml
   when: ansible_distribution == 'Raspbian' or (app_os_armbian.stat.islnk is defined and app_os_armbian.stat.isreg) or (app_os_friendlyelec.stat.islnk is defined and app_os_friendlyelec.stat.isreg)
 
 # ---------------------------------------------------
@@ -147,16 +151,10 @@
 - name: enable cron service
   become: true
   ansible.builtin.systemd:
-    name: cron-target
+    name: cron
     enabled: yes
     masked: no
 
-- name: enable certbot sync
-  ansible.builtin.cron:
-    name: "renew certbot"
-    special_time: monthly
-    job: "/usr/bin/certbot renew --force-renewal"
-
 - name: enable ssh service
   become: true
   ansible.builtin.systemd:
@@ -172,4 +170,4 @@
     masked: no
 
 
-- include: clean.yml
+- import_tasks: clean.yml

+ 5 - 0
deploy/roles/ubuntu/tasks/zsh.yml

@@ -21,6 +21,11 @@
     remote_src: true
     mode: 0600
 
+- name: Enable $HOME/.local
+  ansible.builtin.lineinfile:
+    path: "{{ansible_env.HOME}}/.zshrc"
+    line: 'export PATH=$HOME/.local/bin:$PATH'
+
 - name: Use zsh
   become: true
   shell: chsh -s /bin/zsh {{ansible_user}}

+ 44 - 0
deploy/scripts/assets.sh

@@ -0,0 +1,44 @@
+#!/bin/bash
+
+set -e
+
+# rclone copy --drive-shared-with-me $1:assets assets
+
+export WORKSPACE=$PWD
+
+function build_book(){
+    local target=$WORKSPACE/tmp/$1/$2
+    local dist=$WORKSPACE/roles/mint-assets/files/public/$1/$2
+    if [ ! -d $target ]
+    then
+        git clone -b $2 "https://github.com/iapt-platform/$1.git" $target
+    fi
+    cd $target
+    git pull
+    if [ -d $dist ]
+    then
+        rm -r $dist
+    fi
+    mkdir -p $dist
+    $HOME/.local/bin/mdbook build --dest-dir $dist
+}
+
+declare -a languages=(
+    "zh-Hans"
+)
+
+declare -a books=(
+    "pali-handbook"
+    "help"
+)
+
+for b in "${books[@]}"
+do
+    for l in "${languages[@]}"
+    do
+        build_book $b $l
+    done
+done
+
+echo 'done.'
+exit 0

+ 6 - 0
deploy/staging/hosts

@@ -14,4 +14,10 @@
 app_vendor="iapt-platform.mint"
 ; openssl rand -base64 32
 app_secret_key="4i3WKUvKtSGl59htK7XjUNsjalhkG5s7RJCmZruT2m4="
+; php artisan key:generate --show
+app_laravel_key="base64:IQD4vkmAN1oEsc8rVu1nRadQWPUX/LH/jaSbyFbmf/w="
+app_postgresql_host="db-hk-1.wikipali.org"
+app_postgresql_port=5433
+app_postgresql_password=change-me
+app_redis_host="ch-hk-1.wikipali.org"
 

+ 6 - 1
public/app/config.dir.php

@@ -56,4 +56,9 @@ define("_DIR_USER_IMG_LINK_", "../../tmp/user/media/3");
 define("_DIR_MYDOCUMENT_", "/my_document");
 
 # 逐词解析字典文件
-define("_FILE_DB_WBW1_",  __DIR__ . "/../tmp/user/wbw.db3");
+define("_FILE_DB_WBW1_",  __DIR__ . "/../tmp/user/wbw.db3");
+
+# 帮助文件路径
+define("URL_HELP",ASSETS_SERVER."/help");
+# 巴利语手册路径
+define("URL_PALI_HANDBOOK",ASSETS_SERVER."/pali-handbook");

+ 3 - 0
public/app/config.table.php

@@ -1,4 +1,7 @@
 <?php 
+# 雪花算法id 起始日期2021-12-22 绝对不可修改!!!
+define("_SnowFlakeDate_","2021-12-22");
+
 #表名设置,不能更改
 define("_DB_ENGIN_", Database["type"]);
 define("_DB_HOST_", Database["server"]);

+ 19 - 17
public/app/dict/dict_lookup.php

@@ -1,18 +1,18 @@
 <?php
 //查询参考字典
 include("../log/pref_log.php");
-require_once '../config.php';
-require_once '../public/casesuf.inc';
-require_once '../public/union.inc';
-require_once "../public/_pdo.php";
-require_once "../public/load_lang.php"; //语言文件
-require_once "../public/function.php";
-require_once "../search/word_function.php";
-require_once "../ucenter/active.php";
-require_once "../ucenter/function.php";
-require_once "../dict/p_ending.php";
-require_once "../redis/function.php";
-require_once "../dict/grm_abbr.php";
+require_once __DIR__.'/../config.php';
+require_once __DIR__.'/../public/casesuf.inc';
+require_once __DIR__.'/../public/union.inc';
+require_once __DIR__."/../public/_pdo.php";
+require_once __DIR__."/../public/load_lang.php"; //语言文件
+require_once __DIR__."/../public/function.php";
+require_once __DIR__."/../search/word_function.php";
+require_once __DIR__."/../ucenter/active.php";
+require_once __DIR__."/../ucenter/function.php";
+require_once __DIR__."/../dict/p_ending.php";
+require_once __DIR__."/../redis/function.php";
+require_once __DIR__."/../dict/grm_abbr.php";
 
 global $redis;
 $redis = redis_connect();
@@ -45,7 +45,8 @@ $right_word_list = "";
 
         PDO_Connect("" . _FILE_DB_REF_);
         //直接查询
-        $query = "SELECT dict.dict_id,dict.mean,info.shortname from " . _TABLE_DICT_REF_ . " LEFT JOIN info ON dict.dict_id = info.id where word = ? limit 0,100";
+
+        $query = "SELECT dict.dict_id,dict.mean,info.shortname from " . _TABLE_DICT_REF_ . " LEFT JOIN "._TABLE_DICT_REF_NAME_." as info ON dict.dict_id = info.id where word = ? limit 100";
 
         $Fetch = PDO_FetchAll($query, array($word));
         $iFetch = count($Fetch);
@@ -106,8 +107,9 @@ $right_word_list = "";
 				}
 
 				
-                $query = "SELECT dict.id,dict.dict_id,dict.mean,info.shortname from " . _TABLE_DICT_REF_ . " LEFT JOIN info ON dict.dict_id = info.id where word = ? limit 0,30";
-                $Fetch = PDO_FetchAll($query, array($x));
+                //$query = "SELECT dict.dict_id,dict.mean,dn.shortname from " . _TABLE_DICT_REF_ . " LEFT JOIN "._TABLE_DICT_REF_NAME_." as dn ON dict.dict_id = dn.id where word = ? limit 30";
+
+				$Fetch = PDO_FetchAll($query, array($x));
                 $iFetch = count($Fetch);
                 $count_return += $iFetch;
                 if ($iFetch > 0) {
@@ -171,7 +173,7 @@ $right_word_list = "";
 			if (count($arrBase) > 0) {
 				foreach ($arrBase as $x => $x_value) {
 					
-					$query = "SELECT dict.dict_id,dict.mean,info.shortname from " . _TABLE_DICT_REF_ . " LEFT JOIN info ON dict.dict_id = info.id where word = ? limit 0,30";
+					$query = "SELECT dict.dict_id,dict.mean,info.shortname from " . _TABLE_DICT_REF_ . " LEFT JOIN "._TABLE_DICT_REF_NAME_." as info ON dict.dict_id = info.id where word = ? limit 30";
 					$Fetch = PDO_FetchAll($query, array($x));
 					$iFetch = count($Fetch);	
 					$count_return += $iFetch;
@@ -245,7 +247,7 @@ $right_word_list = "";
             $word1 = $org_word;
             $wordInMean = "%$org_word%";
             echo "包含 $org_word 的:<br />";
-            $query = "SELECT dict.dict_id,dict.word,dict.mean,info.shortname from " . _TABLE_DICT_REF_ . " LEFT JOIN info ON dict.dict_id = info.id where mean like ? limit 0,30";
+            $query = "SELECT  dict.dict_id,dict.word,dict.mean,info.shortname from " . _TABLE_DICT_REF_ . " LEFT JOIN "._TABLE_DICT_REF_NAME_." as info ON dict.dict_id = info.id where mean like ? limit 30";
             $Fetch = PDO_FetchAll($query, array($wordInMean));
             $iFetch = count($Fetch);
             $count_return += $iFetch;

+ 1 - 1
public/app/install/db_insert_palitext_cli.php

@@ -1,4 +1,4 @@
-<?php
+<?php
 /*
 生成 巴利原文段落表
  */

+ 1 - 1
public/app/install/db_update_palitext_cli.php

@@ -1,4 +1,4 @@
-<?php
+<?php
 /*
 生成 巴利原文段落表
  */

+ 5 - 8
public/app/palicanon/book_tag.php

@@ -1,12 +1,9 @@
 <?php
-require_once '../config.php';
+require_once __DIR__.'/../config.php';
+require_once __DIR__.'/../redis/function.php';
 
-try {
-    $redis = new redis();
-    $r_conn = $redis->connect('127.0.0.1', 6379);
-} catch (Exception $e) {
-    $r_conn = false;
-}
+
+$redis = redis_connect();
 
 $tag = str_getcsv($_GET["tag"], ","); //
 $arrBookTag = json_decode(file_get_contents("../public/book_tag/en.json"), true);
@@ -50,7 +47,7 @@ foreach ($output as $key => $value) {
         if ($paraInfo) {
             # 查进度
             $paraProgress = false;
-            if ($r_conn) {
+            if ($redis) {
                 $count = $redis->hLen("progress_chapter_{$book}_{$para}");
                 if ($count > 0) {
                     $prog = $redis->hGetAll("progress_chapter_{$book}_{$para}");

+ 5 - 8
public/app/palicanon/get_chapter_children.php

@@ -1,12 +1,9 @@
 <?php
-require_once '../config.php';
+require_once __DIR__.'/../config.php';
+require_once __DIR__.'/../redis/function.php';
 
-try {
-    $redis = new redis();
-    $r_conn = $redis->connect('127.0.0.1', 6379);
-} catch (Exception $e) {
-    $r_conn = false;
-}
+
+$redis = redis_connect();
 
 $dns = _FILE_DB_PALI_TOC_;
 $dbh_toc = new PDO($dns, _DB_USERNAME_, _DB_PASSWORD_, array(PDO::ATTR_PERSISTENT => true));
@@ -44,7 +41,7 @@ if ($paraInfo) {
         foreach ($paraList as $key => $value) {
             # 查进度
             $paraProgress = false;
-            if ($r_conn) {
+            if ($redis) {
                 $count = $redis->hLen("progress_chapter_{$value["book"]}_{$value["para"]}");
                 if ($count > 0) {
                     $prog = $redis->hGetAll("progress_chapter_{$value["book"]}_{$value["para"]}");

+ 5 - 8
public/app/palicanon/get_chapter_info.php

@@ -1,12 +1,9 @@
 <?php
-require_once '../config.php';
+require_once __DIR__.'/../config.php';
+require_once __DIR__.'/../redis/function.php';
 
-try {
-    $redis = new redis();
-    $r_conn = $redis->connect('127.0.0.1', 6379);
-} catch (Exception $e) {
-    $r_conn = false;
-}
+
+$redis = redis_connect();
 
 $dns = _FILE_DB_PALI_TOC_;
 $dbh_toc = new PDO($dns, _DB_USERNAME_, _DB_PASSWORD_, array(PDO::ATTR_PERSISTENT => true));
@@ -34,7 +31,7 @@ $paraInfo = $stmt->fetch(PDO::FETCH_ASSOC);
 if ($paraInfo) {
     # 查进度
     $paraProgress = array();
-    if ($r_conn) {
+    if ($redis) {
         $count = $redis->hLen("progress_chapter_{$book}_{$para}");
         if ($count > 0) {
             $prog = $redis->hGetAll("progress_chapter_{$book}_{$para}");

+ 15 - 2
public/app/pcdl/head_bar.php

@@ -445,7 +445,19 @@
 		}
 	}
 </style>
-
+<?php
+$help_lang = '';
+switch($_COOKIE['language']){
+	case "zh-cn":
+		$help_lang = "zh-Hans";
+		break;
+	case "zh-tw":
+		$help_lang = "zh-Hans";
+		break;
+	default:
+		$help_lang = "zh-Hans";
+}
+?>
 <!-- new tool bar begin-->
 <header>
 	<div class="head-logo">
@@ -468,13 +480,14 @@
 			<li class="nav_link"><a href="../wiki/"><?php echo $_local->gui->encyclopedia; ?></a></li>
 			<li class="nav_link"><a href="../dict/"><?php echo $_local->gui->dictionary; ?></a></li>
 			<li class="nav_link"><a href="../collect/"><?php echo $_local->gui->composition; ?></a></li>
+			<li class="nav_link"><a href="<?php echo URL_HELP.'/'.$help_lang ?>"  target="_blank"><?php echo $_local->gui->help; ?></a></li>
 			<li class="nav_link more_btn">
 				<div id="more" class="dropdown" onmouseover="switchMenu(this,'nav-more')" onmouseout="hideMenu()">
 					<button class="dropbtn icon_btn" style="all:unset;" onClick="switchMenu(this,'nav-more')" id="more_button">
 						<?php echo $_local->gui->more; ?>
 					</button>
 					<ul class="header-dropdown-content left-content" style="display: none;" id="nav-more">
-					<li><a href="https://assets-hk.wikipali.org/pali-handbook/zh-Hans/" target="_blank">
+					<li><a href="<?php echo URL_PALI_HANDBOOK.'/'.$help_lang ?>" target="_blank">
 								<div class="nav_link"><?php echo $_local->gui->palihandbook; ?></div>
 							</a></li>
 						<li><a href="https://assets-hk.wikipali.org/help/zh-Hans/" target="_blank">

+ 1 - 1
public/app/pcdl/html_foot.php

@@ -1,7 +1,7 @@
 <!---->
 
 <div class="foot_div">
-	<div class="">
+	<div class="" style='display:none;'>
 		<div>
 			<div>联系我们</div>
 			<div>

+ 3 - 1
public/app/redis/function.php

@@ -6,8 +6,10 @@ function redis_connect()
 		//code...
 		$redis = new redis();
 		$r_conn = $redis->connect(Redis["host"], Redis["port"]);
-		$redis->auth(Redis["password"]);
 		if ($r_conn) {
+			if(Redis["password"] !== ""){
+				$redis->auth(Redis["password"]);
+			}		
 			return $redis;
 		} else {
 			return false;

+ 1 - 0
public/app/studio/css/style.css

@@ -4155,6 +4155,7 @@ border-bottom: 2px solid red;
 
 .edit_detail_p {
 	display: flex;
+	padding:2px 0;
 }
 
 .edit_detail_span {

+ 25 - 3
public/app/studio/editor.php

@@ -303,7 +303,29 @@ else{$currDevice="computer";}
 	#merge_button:hover>.icon{
 		fill: var(--link-hover-color);
 	}
-	</style>
+	#om_dropdown_area::-webkit-scrollbar {
+		width: 10px;
+		height: 10px;
+	}
+	#om_dropdown_area::-webkit-scrollbar-thumb {
+		background-color: var(--link-color);
+	}
+	#om_dropdown_area::-webkit-scrollbar-thumb:hover {
+		background-color:var(--tool-link-hover-color);
+	}
+	#om_dropdown_area::-webkit-scrollbar-button:single-button {
+		width: 10px
+		height: 10px;
+		display: block;
+		background-color: var(--link-color);
+		border-radius: 10px;
+	}
+
+	#om_dropdown_area::-webkit-scrollbar-button:single-button:hover {
+		background-color:var(--tool-link-hover-color);
+	}
+
+		</style>
 	<link type="text/css" rel="stylesheet" href="css/print.css" media="print" />
 	<style id="display_set">
 	</style>
@@ -754,8 +776,8 @@ foreach($plugin_list as $info){
 				<div class="edit_detail_p" >
 					<guide gid="studio_part_meaning">④</guide>
 					<span class="edit_detail_span"><?php echo $_local->gui->partmeaning;?>:</span>
-					<div id="input_org_select" class="input_bar" style="width:80%; display:inline-flex;"></div>
-					<input type="text" id="input_om" class="input_bar" value="" name="in_om" onblur="input_org_switch('input_om','input_org_select')">
+					<div id="input_org_select" class="input_bar" style="width:80%; display:inline-flex;justify-content: space-between;"></div>
+					<input type="text" id="input_om" class="input_bar" value="" name="in_om" onchange='input_om_change(this)' onblur="input_org_switch('input_om','input_org_select')">
 				</div>
 				<!-- 格位 -->
 				<div class="edit_detail_p">

+ 3 - 1
public/app/studio/index.php

@@ -289,7 +289,8 @@ else{
 		<div class="htlp_title"><?php echo $_local->gui->start;?></div>
 		<ul style="list-style-type: none;">
 			<li><a href="../studio/index_pc.php" target="_block"><?php echo $_local->gui->newproject;?></a></li>
-			<li><a href="" target="_block">自学教程(建設中)</a></li>
+			<li ><a href="<?php echo URL_PALI_HANDBOOK.'/zh-Hans' ?>" target="_blank"><?php echo $_local->gui->palihandbook; ?></a></li>
+			<li><a href="" target="_block">教程(建設中)</a></li>
 		</ul>
 	</div>
 	<div class="help_div">
@@ -304,6 +305,7 @@ else{
 		<?php echo $_local->gui->help;?>
 		</div>
 		<ul style="list-style-type: none;">
+		<li ><a href="<?php echo URL_HELP.'/zh-Hans' ?>" target="_blank"><?php echo $_local->gui->help; ?></a></li>
 			<li><?php echo $_local->gui->function_introduce;?>&nbsp;&nbsp;&nbsp;
 				<a href="https://www.youtube.com/playlist?list=PL_1iJBQvNPFFNLOaZh2u3VwDYUyJuK_xa" target="_block">
 					<svg class="icon">

+ 25 - 4
public/app/studio/js/editor.js

@@ -3144,11 +3144,14 @@ function showModifyWin(sWordId) {
 	//showCurrWordTable(sReal);
 
 	if (g_useMode == "edit") {
+		//初始值
 		$("#input_meaning").val(sMeaning);
 		$("#input_org").val(sOrg);
 		$("#input_om").val(sOm);
 		$("#input_case").val(sCase);
-
+		$("#input_parent_grammar").val(sParentGrammar);
+		$("#id_text_prt_prt").val(sParent2);
+		
 		if (sParentGrammar != "" || sParent2 != "" || sParent2 != " ") {
 			document.getElementById("edit_detail_prt_prt").style.display = "block";
 			document.getElementById("svg_parent2").style.transform = "rotate(90deg)";
@@ -3157,7 +3160,7 @@ function showModifyWin(sWordId) {
 			document.getElementById("svg_parent2").style.transform = "rotate(0deg)";
 		}
 		document.getElementById("parent_grammar").innerHTML = getLocalGrammaStr(sParentGrammar);
-		$("#id_text_prt_prt").val(sParent2);
+
 
 		//右侧修改菜单
 		$("#word_mdf_mean_dropdown").html(render_word_menu_mean(g_currEditWord, 1));
@@ -3450,7 +3453,24 @@ function load_my_formula() {
 		}
 	);
 }
+/*
+  |------------------------------------
+  |当人工输入拆分意思后,更新拆分意思数组
+  |------------------------------------
+  |obj : 输入框
+  |------------------------------------
+*/
+function input_om_change(obj){
+	g_arrPartMean = obj.value().split('+');
+}
 
+/*
+  |------------------------------------
+  |当选择拆分意思菜单后,更新拆分意思输入框
+  |------------------------------------
+  | 
+  |------------------------------------
+*/
 function part_mean_ok() {
 	var part_mean_ok_str = g_arrPartMean.join("+");
 	part_mean_ok_str = "#" + part_mean_ok_str + "#";
@@ -3490,7 +3510,7 @@ function refreshPartMeaningSelect() {
 	if (g_initPartMeaning) {
 		g_arrPartMean = part.split("+");
 	}
-	var output = "<div style='overflow-x: scroll;white-space: nowrap;max-width: 13em;'>";
+	var output = "<div id='om_dropdown_area' style='overflow-x: auto;white-space: nowrap;max-width: 13em;'>";
 	//output="<span style='width:90%' onclick=\"input_org_switch('input_org_select','input_om')\"></span><br/>"
 	for (iPart in arrPart) {
 		output += getMeaningMenuList(iPart, arrPart[iPart]);
@@ -3500,7 +3520,8 @@ function refreshPartMeaningSelect() {
 			output += "+";
 		}
 	}
-	output += "</div><div>";
+	output += "</div>";
+	output += "<div style='width: 5.5em;'>";
 	output += "<button style='margin-left:auto; padding: 1px 6px;' onclick=\"copy_part_mean_to_mean()\">";
 	output += '<svg class="icon"><use xlink="http://www.w3.org/1999/xlink" href="svg/icon.svg#ic_vertical_align_top">';
 	output += "</button>";

+ 1 - 1
v1/scripts/install.bat

@@ -20,5 +20,5 @@ php ./migrations/20211127214900-sent_sim_index.php
 php ../../public/app/fts/sql.php
 
 php ../../public/app/admin/word_index_weight_refresh.php 1 217
-
+php ./migrations/20211125155600_word_statistics.php
 net time \\127.0.0.1

+ 1 - 0
v1/scripts/install.sh

@@ -23,5 +23,6 @@ php ./migrations/20211127214900-sent_sim_index.php
 php ../../public/app/fts/sql.php
 
 php ../../public/app/admin/word_index_weight_refresh.php 1 217
+php ./migrations/20211125155600_word_statistics.php
 
 date

+ 8 - 8
v1/scripts/migrations/20211125155700_pali_sent_org.php

@@ -64,13 +64,13 @@ try{
 while($srcData = $stmtSrc->fetch(PDO::FETCH_ASSOC)){
 	#插入目标表
 	$data = array(
-					(int)$srcData["id"],
-					(int)$srcData["book"],
-					(int)$srcData["paragraph"],
-					(int)$srcData["begin"],
-					(int)$srcData["end"],
-					(int)$srcData["length"],
-					(int)$srcData["count"],
+					$srcData["id"],
+					$srcData["book"],
+					$srcData["paragraph"],
+					$srcData["begin"],
+					$srcData["end"],
+					$srcData["length"],
+					$srcData["count"],
 					$srcData["text"],
 					$srcData["html"],
 					$srcData["sim_sents"]
@@ -89,7 +89,7 @@ while($srcData = $stmtSrc->fetch(PDO::FETCH_ASSOC)){
 
 // 提交更改
 $PDO_DEST->commit();
-fwrite(STDOUT, "done".PHP_EOL);
+fwrite(STDOUT, "done insert {$count} rows".PHP_EOL);
 
 
 

+ 6 - 6
v1/scripts/migrations/20211127214800_sent_sim.php

@@ -62,11 +62,11 @@ try{
 while($srcData = $stmtSrc->fetch(PDO::FETCH_ASSOC)){
 	#插入目标表
 	$data = array(
-					(int)$srcData["sent1"],
-					(int)$srcData["sent2"],
-					(int)$srcData["sim"]
-	);
-	try{					
+					$srcData["sent1"],
+					$srcData["sent2"],
+					$srcData["sim"]
+				);
+	try{
 		$stmtDEST->execute($data);		
 	}catch(PDOException $e){
 		fwrite(STDERR,"error:".$e->getMessage().PHP_EOL);
@@ -83,7 +83,7 @@ while($srcData = $stmtSrc->fetch(PDO::FETCH_ASSOC)){
 
 // 提交更改
 $PDO_DEST->commit();
-fwrite(STDOUT, "done".PHP_EOL);
+fwrite(STDOUT, "done insert {$count} rows".PHP_EOL);
 
 
 

+ 0 - 0
deploy/install1.bat → v1/windows/install1.bat


+ 0 - 0
deploy/install2.bat → v1/windows/install2.bat


+ 0 - 0
deploy/install3.bat → v1/windows/install3.bat


+ 0 - 0
deploy/install4.bat → v1/windows/install4.bat


+ 0 - 0
deploy/install5.bat → v1/windows/install5.bat


+ 0 - 0
deploy/install6.bat → v1/windows/install6.bat