Skip to content
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

Local files error? #7

Open
jeremy-schweitzer opened this issue Apr 14, 2017 · 9 comments
Open

Local files error? #7

jeremy-schweitzer opened this issue Apr 14, 2017 · 9 comments
Assignees

Comments

@jeremy-schweitzer
Copy link

I've been testing this plugin because I think it's exactly what we need, but I'm running into an issue. I think it's a bug, but it's always possible user error. I just don't see an obvious problem.

I've setup the plugin on two sites and enabled it. I can search the remote site for courses, but when I click on a course title to import it. I've tested on 3.1, 3.2, and 3.3dev. I get the following exception on each version:

Unknown exception related to local files (Can not fetch file form URL)

More information about this error

Debug info:
Error code: storedfileproblem

Stack trace:
line 1371 of /lib/filestorage/file_storage.php: file_exception thrown
line 83 of /local/remote_backup_provider/index.php: call to file_storage->create_file_from_url()

Output buffer:

Notice: Undefined property: stdClass::$url in /var/www/html/moodle/local/remote_backup_provider/index.php on line 83

@mackensen
Copy link
Collaborator

@jeremy-schweitzer thanks for the report. If I had to hazard a guess, the plugin is getting a bad response from the web service. I need to add better troubleshooting; could you try adding this statement (or something similar) immediately after line 69 in index.php and report back what's in the log:

error_log(print_r($resp, true));

@danisierravergel
Copy link

danisierravergel commented Oct 5, 2017

Hi, I have the same error, I do print_r ($ resp) on line 69.
answer: stdClass Object ( [exception] => backup_controller_exception [errorcode] => backup_check_user_not_exists [message] => error/backup_check_user_not_exists )
Has anyone already fixed it?
image

error in the log

[05-Oct-2017 23:05:08 Europe/London] PHP Notice: Undefined property: stdClass::$url in D:\wamp64\www\moodle312-hijo\local\remote_backup_provider\index.php on line 85

[05-Oct-2017 23:05:08 Europe/London] PHP Stack trace:

[05-Oct-2017 23:05:08 Europe/London] PHP 1. {main}() D:\wamp64\www\moodle312-hijo\local\remote_backup_provider\index.php:0

[05-Oct-2017 23:05:08 Europe/London] Default exception handler: Excepción desconocida relacionadas con los archivos locales (Can not fetch file form URL) Debug:

Error code: storedfileproblem

  • line 1357 of \lib\filestorage\file_storage.php: file_exception thrown
  • line 85 of \local\remote_backup_provider\index.php: call to file_storage->create_file_from_url()

@haasdijk
Copy link

Hi all,
I just installed this plugin and encountered the same error. Has one of you already found a solution?
Regards,
Peter

@danisierravergel
Copy link

Hola, ese error fue hace mucho, si recuerdo bien, es porque un moodle no puede verse con el otro, o acceder a la carpeta del otro.
Si quieres cúentame que necesitas, quizá te pueda ayudar

@haasdijk
Copy link

Hi,
I Google-translated your reply. My Spanish is a little bit rusted :-)

But this shouldn't be a problem if I call the backup function via web services with the right user (rights), should it?

@danisierravergel
Copy link

The backup is created in a directory outside of www, so you can not access it.
Postscript: my English is bad

ak4t0sh added a commit to ak4t0sh/moodle-local_remote_backup_provider that referenced this issue May 24, 2019
In the WS query the username was provided by the client based on connected user ($USER).
This could lead to inconsistency with token if the username does not match the WS account on the provider.
@ak4t0sh
Copy link

ak4t0sh commented May 24, 2019

Steps to reproduce

On the provider

  • create an user for webservice with username 'wsaccount' and configure WS as described in README.md

On the client

  1. Log in as an administrator on the client. (Important : username must not be 'wsaccount' for example 'foo')
  2. Configure the client to use the 'wsaccount' token.
  3. Try to restore a remote course you should see the error appear.

Explanation

Client send current user's username (foo) to the provider and try to use it to do the backup instead of wsaccount user. But this account may be inexistant or do not have required permission on the provider.

Fix

See PR #13 it remove username param to directly use $USER which is the WS user (so 'wsaccount')

@behoof
Copy link

behoof commented Aug 10, 2019

When I add on the client the same username and I log in with that username: the error is gone.
So the username on the client and the provider must be equal?

@ak4t0sh
Copy link

ak4t0sh commented Aug 13, 2019

Exactly, username on client and provider must be equal. That's what #13 intend to fix.

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

No branches or pull requests

6 participants