Skip to content

Configure Elfinder Bundle to connect with a MySQL database #300

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
masteropen opened this issue Jan 13, 2018 · 5 comments
Closed

Configure Elfinder Bundle to connect with a MySQL database #300

masteropen opened this issue Jan 13, 2018 · 5 comments

Comments

@masteropen
Copy link

I get problem to connect elfinder with my MySQL database, I changed the driver : 'LocalFileSystem' to` driver : 'MySQL', and i configured the configuration of my database in Driver\ElFinderVolumeMySQL, but it steel not working, i get this error "Invalid backend configuration. Readable volumes not available."

Can you help me please to solve this problem ???

@helios-ag
Copy link
Owner

@nouridev can you post full configration of elfinder bundle, and what version of symfony and bundle do you use.

@CoreAptics
Copy link

CoreAptics commented Feb 22, 2018

I have the same error, i'm using Symfony 3.4.4 and FMElfinderBundle 7.0.1, my config:

fm_elfinder:
    #assets_path: / # default is /assets, this is where css/js elfinder files are
    instances:
        form:
            locale: %locale% # defaults to current request locale
            editor: form # other options are tinymce, tinymce4, fm_tinymce, form, simple, custom
            include_assets: true # disable if you want to manage loading of javascript and css assets manually
            connector:
                roots:       # at least one root must be defined, defines root filemanager directories
                    uploads:
                        alias: Fichiers
                        driver: MySQL
                        path: uploads
                        upload_allow: ['all']
                        upload_max_size: 128M # also file upload sizes restricted in php.ini

And I had to overwrite the class because it didn't respect the abstract class ElFinderVolumeDriver. Where can I find a doc for MySQLDriver ?

Differents parts of the class i had to change:

I needed to this function:

public function _chmod($path, $mode)
    {
        parent::__chmod($path, $mode);
    }

I needed to had $jpgQuality option:

public function resize($hash, $width, $height, $x, $y, $mode = 'resize', $bg = '', $degree = 0, $jpgQuality = null) {
		if ($this->commandDisabled('resize')) {
			return $this->setError(ElFinder::ERROR_PERM_DENIED);
		}
		
		if (($file = $this->file($hash)) == false) {
			return $this->setError(ElFinder::ERROR_FILE_NOT_FOUND);
		}
               /** ... **/
}

I needed to had $hash option:

public function search($q, $mimes, $hash = null) {
		$result = array();
                /** ... **/
}

Tanks a lot !

@helios-ag
Copy link
Owner

@CoreAptics, @nouridev hi
You can try to use dev branch (it's synced with latest elfinder (2.1.32), and uses original elfinder repo as php lib) for mysql support with following configuration

        default:
            locale: "%locale%"
            editor: form # other choices are tinymce or simple
            include_assets: true
            relative_path: true
            connector:
                roots:       # at least one root must be defined
                    uploads:
                        show_hidden: false
                        driver: MySQL
                        mysql_settings:
                            user: 'root'
                            password: 'root'
                            db: 'elfinder'
                            host: 'localhost'
                        path: 1

@CoreAptics
Copy link

CoreAptics commented Feb 26, 2018

Hi, same error,

I think it's an Elfinder's issue, because I deployed Elfinder demo with all requirements and I have the same error. I'll post another issue on Studio42's repo.

Thanks for your availability,

EDIT:

I fixed the problem by creating another user to my Database, the password is required to use the MySQLDriver. I use WAMP and the default password is null.

@helios-ag
Copy link
Owner

Thanks for sharing your solution 👍
I think issue can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants