Writing /home/user/smartcj.com/wiki/data/cache/c/c805393073dd095e93aa073397b93b8f.i failed
Unable to save cache file. Hint: disk full; file permissions; safe_mode setting.
Writing /home/user/smartcj.com/wiki/data/cache/c/c805393073dd095e93aa073397b93b8f.metadata failed
tcms_install
Differences
This shows you the differences between two versions of the page.
| tcms_install [2016/10/18 20:16] – created admin | tcms_install [2026/03/21 10:12] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== | + | ====== |
| - | Thumb CMS - is the next step in development of SmartCJ. | + | Thumb CMS - this is the next step in the development of SmartCJ. |
| - | It' | + | We have always tried to support all possible server configurations, |
| ===== What's new ===== | ===== What's new ===== | ||
| - | New version | + | The new branch |
| - | * DB scheme has been changed | + | * The database was optimized |
| - | * you can run cron jobs as often as you want optimizing server load, of course you have to understand that all actions will be executed as often as you run cronjobs. So if you do that every 5 minutes - all stats we be updated only once every 5 minutes. | + | * Crons can be run as often as you like, this will only affect the speed of statistics updates and history saves. At the same time, crons control their own execution |
| - | * All Db queries are optimized | + | * Database selections and updates have been optimized |
| - | Now the script | + | The script |
| - | * you can install | + | * You can place the script |
| - | * rewrites | + | * Rewrites |
| - | * you can cookieless mode and script | + | * The script |
| - | * You can remove [[TCMS Rotation Parameter]] and still | + | * You can remove [[TCMS Rotation Parameter]] and the script |
| - | Also there are some brand new features | + | Thus the question of ranking sites by Google depending on the script will be completely removed. |
| - | * [[Thumb Split]] - that's a way to make your thumb unique | + | A number of unique |
| - | * [[FaceDetect]] - make sure that if a face has a face it won't be cut out | + | |
| + | * [[Thumb Split]] - uniquification of thumbs by cutting them into multiple parts | ||
| + | * [[FaceDetect]] - automation of thumb cutting, taking into account the position of the face to create higher quality thumbs automatically | ||
| ===== Installation ===== | ===== Installation ===== | ||
| - | Now it really easy to install the script. You don' | + | Installation has become even simpler and should please admins. |
| < | < | ||
| Line 36: | Line 36: | ||
| </ | </ | ||
| - | and the script will be installed in few seconds | + | and the script will be installed in interactive mode. |
| + | PS yes, two dashes at the end are required | ||
| - | PS yes , those two dashes are obligatory | + | you can also specify all parameters directly in the command line |
| - | + | ||
| - | Also there are optional parameter | + | |
| < | < | ||
| Line 58: | Line 57: | ||
| RewriteRule ^([^/ | RewriteRule ^([^/ | ||
| - | RewriteRule ^category/ | + | |
| - | RewriteRule ^category/ | + | # add & |
| + | RewriteRule ^category/ | ||
| + | RewriteRule ^category/ | ||
| #slug galleries | #slug galleries | ||
| Line 66: | Line 67: | ||
| #tags | #tags | ||
| - | RewriteRule ^tag/ | + | RewriteRule ^tag/ |
| - | RewriteRule ^tag/ | + | RewriteRule ^tag/ |
| - | RewriteRule ^tag/ | + | RewriteRule ^tag/ |
| #model galleries | #model galleries | ||
| - | RewriteRule ^model_galleries/ | + | RewriteRule ^model_galleries/ |
| - | RewriteRule ^model_galleries/ | + | RewriteRule ^model_galleries/ |
| - | RewriteRule ^model/ | + | RewriteRule ^model/ |
| - | RewriteRule ^model/ | + | RewriteRule ^model/ |
| - | RewriteRule ^search/ | + | RewriteRule ^search/ |
| - | RewriteRule ^search/ | + | RewriteRule ^search/ |
| </ | </ | ||
| - | For NGINX | + | For nginx |
| < | < | ||
| Line 118: | Line 119: | ||
| location /tag { | location /tag { | ||
| - | rewrite ^/ | + | rewrite ^/ |
| - | rewrite ^/ | + | rewrite ^/ |
| - | rewrite ^/ | + | rewrite ^/ |
| } | } | ||
| location / | location / | ||
| - | rewrite ^/ | + | rewrite ^/ |
| - | rewrite ^/ | + | rewrite ^/ |
| } | } | ||
| location /model { | location /model { | ||
| - | rewrite ^/ | + | rewrite ^/ |
| - | rewrite ^/ | + | rewrite ^/ |
| } | } | ||
| location /search { | location /search { | ||
| - | rewrite ^/ | + | rewrite ^/ |
| - | rewrite ^/ | + | rewrite ^/ |
| } | } | ||
| Line 145: | Line 146: | ||
| ===== Search ===== | ===== Search ===== | ||
| - | There are a few ways to search: regular mysql LIKE statement, mysql MATCH statement. | + | By default, the search |
| - | There' | ||
| - | |||
| - | |||
| - | |||
| Search fields | Search fields | ||
| If you don't use Sphinx the script will use Mysql | If you don't use Sphinx the script will use Mysql | ||
| built-in functionality. It's slower so we limit amount of fields | built-in functionality. It's slower so we limit amount of fields | ||
| - | Please, read the last WIKI about the last option. | + | Please, read the last WIKI about the last option. |
| - | + | ||
| - | + | ||
| - | What you need to know is when we use a regular LIKE option - it's works out-of-the-box, | + | |
| - | So we have 2 suboptions - seatch in Alt (title) only, description only or both title+description. The latter only is a bit slower of course. | ||
| + | By default the script searches in description, | ||
| - | Mysql MATCH is better but it works with new versions of Mysql only (5.6+)> It's called FullText Search. Actually it was introduced long time ago but InnoDB table type can do that only since version 5.6 | + | The best option |
| - | It' | + | But there is a compromise |
| - | If you'd like to use this option you need to add an index to all rot_gallery_data* tables | + | So if you want to use this option, which is somewhat simpler than the Sphinx option in the setup, |
| < | < | ||
| Line 175: | Line 169: | ||
| </ | </ | ||
| + | And switch the option in settings to FullText search. | ||
| - | And the best option so far is Sphinx. | ||
| ===== Sphinx Config ===== | ===== Sphinx Config ===== | ||
| - | Note that most likely | + | Please note that in Sphinx Settings |
| - | Config example | + | Example config |
| < | < | ||
| + | You need to make changes in the section | ||
| searchd | searchd | ||
| Line 192: | Line 187: | ||
| listen | listen | ||
| - | addition of mysql41 | + | the main thing here is adding mysql41, a new way for sphinx to listen over the mysql protocol |
| + | Next is an example for the database | ||
| source your_name_source | source your_name_source | ||
| Line 214: | Line 209: | ||
| (SELECT group_concat(tag_id) FROM rot_gal2tag g2t \ | (SELECT group_concat(tag_id) FROM rot_gal2tag g2t \ | ||
| WHERE g2t.gallery_id = gi.gallery_id) as tag_ids, \ | WHERE g2t.gallery_id = gi.gallery_id) as tag_ids, \ | ||
| + | (SELECT group_concat(name) FROM rot_groups | ||
| + | WHERE rot_groups.id in (SELECT group_id FROM rot_gallery_stats1 WHERE rot_gallery_stats1.gallery_id = gi.gallery_id AND group_id != 0) ) as group_names, | ||
| + | \ | ||
| + | (SELECT group_concat(name) FROM rot_groups | ||
| + | WHERE rot_groups.id in (SELECT group_id FROM rot_gallery_stats1 WHERE rot_gallery_stats1.gallery_id = gi.gallery_id AND group_id != 0) ) as group_names, | ||
| + | |||
| (SELECT group_concat(gss.group_id) FROM rot_gallery_stats1 as gss \ | (SELECT group_concat(gss.group_id) FROM rot_gallery_stats1 as gss \ | ||
| WHERE gss.gallery_id = gi.gallery_id AND group_id != 0) as categories \ | WHERE gss.gallery_id = gi.gallery_id AND group_id != 0) as categories \ | ||
| Line 220: | Line 221: | ||
| JOIN rot_gallery_stats1 AS gs ON gs.gallery_id = gi.gallery_id \ | JOIN rot_gallery_stats1 AS gs ON gs.gallery_id = gi.gallery_id \ | ||
| WHERE gallery_status = ' | WHERE gallery_status = ' | ||
| - | and gs.best_thumb = ' | + | and gs.best_thumb = ' |
| Line 245: | Line 246: | ||
| </ | </ | ||
| + | |||
| + | |||
| ===== Sphinx Delta Config ===== | ===== Sphinx Delta Config ===== | ||
| - | This part make sense only if you have a really big DB (1M+ , for example | + | When creating an index sphinx creates an index of the current state of the database and if there were any changes in the database after indexing, sphinx won't find new data because it was added after indexing. |
| + | |||
| + | The logical conclusion from this: we need to re-index after each change in the database, however the problem is that if the database is large enough, indexing can take a long time. And indexing is a resource-intensive process. | ||
| + | |||
| + | To solve this problem, delta index was invented - this is an index in which changes that occurred from the moment of full indexing to the moment of delta index creation will fall. Since a small amount of data is indexed, the operation is very fast. | ||
| + | |||
| + | When searching, sphinx will search both in the main index and in the delta index, and thus will see all changes. Creating a delta index can be done as often as you like. | ||
| - | When Sphinx creates an index it takes a snapshot of a current state of a DB. So if something has been changed since then - it won't be reflected in index. And if you have a big DB it takes a lot of time to reindex it. | ||
| - | So the good idea is to just reindex those parts that have been changed. That's why you need so called delta index | + | So: |
| - | To make use of it you need to add after | + | in the main part that you already have, you need to add after |
| sql_query_pre = SET NAMES utf8 | sql_query_pre = SET NAMES utf8 | ||
| - | a new line | + | line |
| sql_query_pre = UPDATE rot_settings SET value = (SELECT MAX(gallery_id) FROM rot_gallery_info) WHERE name = ' | sql_query_pre = UPDATE rot_settings SET value = (SELECT MAX(gallery_id) FROM rot_gallery_info) WHERE name = ' | ||
| - | And add a new source | + | Now you need to add the creation of delta index |
| < | < | ||
| Line 272: | Line 280: | ||
| sql_query_pre = SET NAMES utf8 | sql_query_pre = SET NAMES utf8 | ||
| - | sql_query = SELECT gi.gallery_id, | + | sql_query = SELECT gi.gallery_id, |
| - | (SELECT group_concat(tag_name) FROM rot_gal2tag g2t \ | + | \ |
| - | LEFT JOIN rot_tags as t on t.tag_id = g2t.tag_id \ | + | gd.alt, gd.description, |
| - | WHERE g2t.gallery_id = gi.gallery_id) as tags, \ | + | \ |
| - | (SELECT group_concat(gss.group_id) FROM rot_gallery_stats1 as gss \ | + | \ |
| - | WHERE gss.gallery_id = gi.gallery_id AND group_id != 0) as categories \ | + | (SELECT group_concat(tag_id) FROM rot_gal2tag g2t \ |
| - | FROM rot_gallery_info AS gi \ | + | WHERE g2t.gallery_id = gi.gallery_id) as tag_ids, |
| - | JOIN rot_gallery_data1 AS gd ON gi.gallery_id = gd.gallery_id \ | + | \ |
| - | JOIN rot_gallery_stats1 AS gs ON gs.gallery_id = gi.gallery_id \ | + | # TAGS START you can remove this part up to TAG END \ |
| - | WHERE gi.gallery_id > ( SELECT value FROM rot_settings WHERE name = ' | + | # this part indexes tags, if you remove it - tags wont be indexed |
| - | AND | + | # ligther index = less memory usage and faster search |
| - | and gs.best_thumb = ' | + | (SELECT group_concat(tag_name) FROM rot_gal2tag g2t |
| + | LEFT JOIN rot_tags as t on t.tag_id = g2t.tag_id | ||
| + | WHERE g2t.gallery_id = gi.gallery_id) as tags, \ | ||
| + | \ | ||
| + | # TAGS END \ | ||
| + | \ | ||
| + | \ | ||
| + | # GROUP START you can remove this part up to TAG END \ | ||
| + | # this part indexes group names, if you remove it - it wont be indexed | ||
| + | # ligther index = less memory usage and faster search | ||
| + | (SELECT group_concat(name) FROM rot_groups | ||
| + | WHERE rot_groups.id in (SELECT group_id FROM rot_gallery_stats1 | ||
| + | WHERE rot_gallery_stats1.gallery_id = gi.gallery_id AND group_id != 0) \ | ||
| + | ) as group_names, | ||
| + | \ | ||
| + | \ | ||
| + | # GROUP END \ | ||
| + | \ | ||
| + | # Models START you can remove this part up to MODEL END \ | ||
| + | # this part indexes model names, if you remove it - it wont be indexed | ||
| + | # ligther index = less memory usage and faster search | ||
| + | (SELECT group_concat(model_name) FROM rot_models | ||
| + | WHERE rot_models.model_id in (SELECT model_id FROM rot_gal2model | ||
| + | WHERE rot_gal2model.gallery_id = gi.gallery_id) | ||
| + | ) as model_names, | ||
| + | \ | ||
| + | # MODEL END \ | ||
| + | \ | ||
| + | \ | ||
| + | (SELECT group_concat(distinct(gss.group_id)) FROM rot_gallery_stats1 as gss | ||
| + | WHERE gss.gallery_id = gi.gallery_id AND group_id != 0) as categories | ||
| + | | ||
| + | FROM rot_gallery_info AS gi \ | ||
| + | JOIN rot_sponsors on rot_sponsors.sponsor_id = gi.sponsor_id | ||
| + | JOIN rot_gallery_data1 AS gd ON gi.gallery_id = gd.gallery_id | ||
| + | \ | ||
| + | | ||
| + | JOIN rot_gallery_stats1 AS gs ON gs.gallery_id = gi.gallery_id | ||
| + | WHERE gallery_status = ' | ||
| + | and gs.best_thumb = ' | ||
| + | AND gs.group_id NOT IN (SELECT group_id FROM rot_groups_data WHERE status != 1) and gi.gallery_id > ( SELECT value FROM rot_settings WHERE name = ' | ||
| | | ||
| } | } | ||
| Line 298: | Line 346: | ||
| - | You can note that it has the same query with an addition | + | As you can see the query is the same, the only difference is the presence |
| - | Now you have to add a new crontab task that will reindex new parts | + | After this you need to add indexing of new records to the cron as often as you like with the line |
| indexer --rotate delta | indexer --rotate delta | ||
| - | Now you have to add 'delta' into | + | After creating the index, |
| - | once a day you can marge main index and delta index | + | and once a day for example |
| indexer --rotate --merge your_name_index delta | indexer --rotate --merge your_name_index delta | ||
| - | That's it. | + | Done. |
tcms_install.1476821794.txt.gz · Last modified: by admin
