neilime / zf2-assets-bundle

AssetsBundle is a module for Zend Framework 2 allowing asset managment (bundling & caching)
https://neilime.github.io/zf2-assets-bundle/
MIT License
33 stars 20 forks source link

How can config auto remove tmp file? #44

Closed thminhVN closed 7 years ago

thminhVN commented 8 years ago

After long time run website, server has a lot of temp files and it make hard disk full Can you help me fix it?

neilime commented 8 years ago

Hum,

What kind of temp files are generated by this module ? It should not generate temp files after first cache generation. Can you publish some examples ?

thminhVN commented 8 years ago

This is my config file

return array(
    'assets_bundle' => array(
        'tmpDirPath' => '@zfRootPath/public/tmp',
        'mediaExt' => array(
            'jpeg',
            'jpg',
            'png',
            'gif',
            'cur',
            'ttf',
            'eot',
            'svg',
            'woff',
            'woff2',
        ),
        'production' => false,
        'assets' => array(
            'css' => array(
                '/lib/bootstrap/css/bootstrap.min.css',
                '/lib/font-awesome/css/font-awesome.min.css',
            ),
            'js' => array(
                '/js/html5shiv.js',
                '/js/respond.min.js',
                '/js/jquery.min.js',
                '/lib/bootstrap/js/bootstrap.min.js'
            ),
            'media' => array(
                'img',
                'lib/bootstrap/fonts',
                'lib/font-awesome/fonts',
                'fonts',
            ),
            'no_module' => array(
                'css' => array(
                    '/css/style.css',
                ),
                'js' => array(
                    '/js/application/main.js',
                ), 
            ),
            //Modules specific assets
            'Application' => array(
                'css' => array(
                    '/css/style.css',
                ),
                'js' => array(
                    '/js/application/main.js',
                ),
                //Controller specific assets
                'Application\Controller\Auth' => array(
                    'css' => array(
                        '/css/auth.css'
                    ),
                ),
                'Application\Controller\Index' => array(
                    'index' => array(
                        'css' => array(
                            '/css/home.css'
                        ),
                        'js' => array(
                            '/js/application/slider.js'
                        )
                    ),
                ),
                'Application\Controller\Blog' => array(
                    'css' => array(
                        '/css/blog.css',
                    ),
                    'js' => array(
                        '/js/application/blog.js',
                    ),
                ),
            ),
            'Admin' => array(
                'css' => array(
                    '/lib/datatable/css/dataTables.bootstrap.min.css',
                    '/lib/jquery-ui/css/jquery-ui.min.css',
                    '/lib/colorbox/colorbox.css',
                    '/lib/bootstrap-plugin/datetimepicker/css/bootstrap-datetimepicker.min.css',
                    '/css/admin',
                ),
                'js' => array(
                    '/lib/datatable/js/jquery.dataTables.min.js',
                    '/lib/datatable/js/dataTables.bootstrap.min.js',
                    '/lib/bootstrap-plugin/bootbox.min.js',
                    '/lib/jquery-ui/js/jquery-ui.min.js',
                    '/lib/colorbox/jquery.colorbox-min.js',
                    '/lib/bootstrap-plugin/datetimepicker/js/moment.js',
                    '/lib/bootstrap-plugin/datetimepicker/js/bootstrap-datetimepicker.min.js',
                    '/lib/metisMenu.min.js',
                    '/lib/ckeditor/ckeditor.js',
                    '/lib/ckeditor',
                ),
                'media' => array(
                    '/lib/colorbox/images',
                    '/lib/datatable/images',
                    '/lib/ckeditor',
                ),
                'Admin\Controller\Media' => array(
                    'css' => array(
                        '/lib/jstree/themes/default/style.min.css',
                        '/lib/fileupload/css/jquery.fileupload.css',
                        '/lib/fileupload/css/jquery.fileupload-ui.css',
                    ),
                    'js' => array(
                        '/lib/jstree/jstree.min.js',
                        '/lib/fileupload/js/vendor/jquery.ui.widget.js',
                        '/lib/fileupload/js/tmpl.min.js',
                        '/lib/fileupload/js/load-image.min.js',
                        '/lib/fileupload/js/canvas-to-blob.min.js',
                        '/lib/fileupload/js/jquery.blueimp-gallery.min.js',
                        '/lib/fileupload/js/jquery.iframe-transport.js',
                        '/lib/fileupload/js/jquery.fileupload.js',
                        '/lib/fileupload/js/jquery.fileupload-process.js',
                        '/lib/fileupload/js/jquery.fileupload-image.js',
                        '/lib/fileupload/js/jquery.fileupload-audio.js',
                        '/lib/fileupload/js/jquery.fileupload-video.js',
                        '/lib/fileupload/js/jquery.fileupload-validate.js',
                        '/lib/fileupload/js/jquery.fileupload-ui.js',
                        '/lib/fileupload/js/main.js',
                    ),
                    'media' => array(
                        '/lib/jstree/themes/default',
                        '/lib/fileupload/img'
                    ),
                ),

            ),
            'Crm' => array(
                'css' => array(
                    '/lib/datatable/css/dataTables.bootstrap.min.css',
                    '/lib/jquery-ui/css/jquery-ui.min.css',
                    '/lib/bootstrap-plugin/datetimepicker/css/bootstrap-datetimepicker.min.css',
                    '/css/admin',
                ),
                'js' => array(
                    '/lib/datatable/js/jquery.dataTables.min.js',
                    '/lib/datatable/js/dataTables.bootstrap.min.js',
                    '/lib/bootstrap-plugin/bootbox.min.js',
                    '/lib/jquery-ui/js/jquery-ui.min.js',
                    '/lib/bootstrap-plugin/datetimepicker/js/moment.js',
                    '/lib/bootstrap-plugin/datetimepicker/js/bootstrap-datetimepicker.min.js',
                    '/lib/metisMenu.min.js',
                ),
                'media' => array(
                    '/lib/datatable/images',
                ),
            ),
        )
    ),
);

and after rune website sometime, I have a lots of files like: 1ECZ2, 1DRZ2,.. in folder tmp

neilime commented 8 years ago

Hello,

An improvement has been made, to remove tmp files after assets rendering, can you try the very last version and check if it works as you need ?

thminhVN commented 8 years ago

Thank you :). I will try it soon

On Monday, 23 May 2016, neilime notifications@github.com wrote:

Hello,

An improvement has been made, to remove tmp files after assets rendering, can you try the very last version and check if it works as you need ?

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/neilime/zf2-assets-bundle/issues/44#issuecomment-220907951


Web Developer

Trần Hữu Minh

STARSEED ASIA

436A/139 Ba Tháng Hai, Phường 12, Quận 10, HCM

Tel: 0975252822

minh@starseed.fr b.tortorelli@starseed.fr

neilime commented 7 years ago

Any feedback ?

thminhVN commented 7 years ago

It worked with css and js but for less it continues generate many tmp files

On Aug 30, 2016, at 3:50 PM, neilime notifications@github.com wrote:

Any feedback ?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/neilime/zf2-assets-bundle/issues/44#issuecomment-243374619, or mute the thread https://github.com/notifications/unsubscribe-auth/AKu97iEzBDBWI2WO2QS36vyAxuhafRzVks5qk-7VgaJpZM4H255y.

neilime commented 7 years ago

Hum curious...

This part of code should remove all tmp files : https://github.com/neilime/zf2-assets-bundle/blob/master/src/AssetsBundle/AssetFile/AssetFilesManager.php#L48. It works fine with phpunit tests and for many applications in production.

Which version do you use ? Have you try to remove these files manually and then regenerate assets ?

thminhVN commented 7 years ago

@neilime I updated new version and it worked