Перейти к основному содержимому

Хранение данных очистки

В общем, Pimcore довольно без технического обслуживания с точки зрения очистки файловой системы от временных файлов, файлов журнала, Информация об выборе версий и другие сгенерированные данные. Однако есть некоторые изменения, которые вы можете использовать для уменьшения или очистки вашего Следует хранилище в вашей файловой системе.

Данные версии

Уменьшите количество этапов версий активов, объектов и документов

Pimcore сохраняет метадаты для версии в базе данных, однако сами данные хранятся в файловой системе (var/versions) в качестве сжатых файлов (GZIP), чтобы удержать базу данных максимально наклоненной. Важно знать, что Pimcore хранит завершенные дампы данных в момент создания версии, он не Используйте любой вид дифференциала данных/инкрементной или дедупликации по нескольким причинам. Это означает, что данные об управлении версиями могут расти очень быстро, особенно при работе с огромными активами. Вы можете сократить количество точек восстановления индивидуально для активов, объектов и документов в настройках системы.

После того, как вы сократили значение, рекомендуется запустить следующую команду вручную (Он также будет работать автоматически как часть регулярного сценария технического обслуживания):

./bin/console pimcore:maintenance -j versioncleanup  

Example

Assuming an Asset, 100MB in size, in system settings 10 versioning steps are configured. Every time the Asset get's saved a new dump of the file is created, so the max. space required for this particular Asset is 1.1 GB (100MB for the original Asset + 10 x 100MB for the version dumps).

Flush all Versions of a certain Type

Sometimes it's necessary to clean all versioning information for a certain type, eg. for Assets or Objects. The easiest way is to do this manually with the following commands:

WARNING: The following commands will delete all versioning information of your installation

// replace ### with the name of your database  
// you can also use "object" or "document" instead of "asset"
mysql -e "DELETE FROM ###.versions WHERE ctype='asset';"
rm -r var/versions/asset

Logging Data

All logging information is located in var/log/. Pimcore rotates & compresses and cleans up the logs automatically: Rotate: when the file is bigger than 200MB
Compress: immediately after rotating (gzip)
Delete: After 30 days

Logs can be deleted manually at any time.
It's also possible to use a custom log rotator, for this purpose please deactivate the logmaintenance job in your maintenance command: ./bin/console pimcore:maintenance -J logmaintenance

Temporary Files

Pimcore stores temporary files in 2 different locations, depending on whether they are public accessible or not.
Private temporary directory: var/tmp/
Used for uploads, imports, exports, page, previews, ...
Public temporary directory: public/var/tmp/
Used for image/video/document thumbnails used in the web-application.

Clearing Temporary Files

// clear public files  
Tool\Storage::get('thumbnail')->deleteDirectory('/');
Db::get()->executeQuery('TRUNCATE TABLE assets_image_thumbnail_cache');

Tool\Storage::get('asset_cache')->deleteDirectory('/');

// clear system files
recursiveDelete(PIMCORE_SYSTEM_TEMP_DIRECTORY, false);

All temporary files can be deleted at any time.
WARNING: Deleting all files in public/var/tmp/ can have a huge impact on performance until all needed thumbnails are generated again.

Recycle Bin

Deleting items in Pimcore moves them to the recycle bin first. The recycle bin works quite similar to the versioning, so the references are kept in the database but the contents itself are dumped into files in var/recyclebin/.
In the admin user-interface, under Tools > Recycle Bin, you can review items in the bin or flush the entire content.

If you need to delete items based on how long they were stored in the recycle bin, the following command may come in handy:

./bin/console  pimcore:recyclebin:cleanup --older-than-days=60  

It's also possible to flush the entire bin manually, this is especially useful when automating this process, or if you have a huge amount of items in your recycle bin:

// replace ### with the name of your database  
mysql -e "TRUNCATE TABLE ###.recyclebin;"
rm -r var/recyclebin

WARNING: The recycle bin is an administrative tool that displays any user's deleted elements. Due to the nature and complexity of the elements deletion and restoration process, this tool should be reserved for administrator and advanced users

Output Cache

When enabled, the full page cache stores the whole frontend request response including the headers from a request and stores it into the cache.

The output cache can be cleared with the following snippet:

// remove "output" out of the ignored tags, if a cache lifetime is specified  
Cache::removeIgnoredTagOnClear('output');

// empty document cache
Cache::clearTags(['output', 'output_lifetime']);


Вы можете предложить улучшение документации или задать вопрос в комментариях.
Если вам нужна полноценная консультация — вы можете заказать её на нашем сайте.