General developer forum

Bug in creating File System API for using FPT of /moodledata/filedir

 
Picture of Nhien Nguyen Phuoc Thuat
Bug in creating File System API for using FPT of /moodledata/filedir
 

Dear everyone,

I'm Moodle development beginner, I installed Moodle 3.4 source code in NetBeans / Ubuntu 16.4 and it works every well.

However i want modify the Moodle File System for purpose of moving the file folder ../moodledata/filedir to remote computer.

So i tried to do following instruction in this link, doing exactly what is in the example of using FTP for Moodle File System

https://docs.moodle.org/dev/File_System_API

However I start moodle and it throw: "Exception - Class '\core_file_system_ftp' not found"
I also change the line in config.php
$CFG->alternative_file_system_class = '\\core_file_system_ftp';
to
$CFG->alternative_file_system_class = 'core_file_system_ftp';
then it throw
"Exception - Class 'core_file_system_ftp' not found"

I checked many things about Moodle automatic class loading... but it still show this exception. Googling 2 days but help not found.
Could anyone help me ?
Thank you and best regards

Nhien

 
Average of ratings: -
Picture of Nhien Nguyen Phuoc Thuat
Re: Bug in creating File System API for using FPT of /moodledata/filedir
 

Dear everyone,

I'm not sure this is the best way to fix, but it works.

1> in the file file_system_ftp i put the line :

....

defined('MOODLE_INTERNAL') || die;

require_once("$CFG->libdir/filestorage/file_system.php");

.....

2.  In the config.php i put the lines :

require_once(__DIR__ . '/lib/classes/file_system_ftp.php');
$CFG->alternative_file_system_class = 'core_file_system_ftp';
$CFG->file_system_ftp_user = 'nhien';
$CFG->file_system_ftp_pass = 'Nh_12345';
$CFG->file_system_ftp_host = 'www.nhien.net';
$CFG->file_system_ftp_path = 'testing';

And testing upload an image to moodle server then the image is upload to remote ftp server www.nhien.net as the file

/testing/filedir/fef85862113061d9dfc40d292a2120c551885e81


Thank you


 
Average of ratings: -