Drupal: update file system path in database

How can I change my Drupal root directory in a database? I transferred Drupal to a different path. I am looking for this value to update in the database. thank

+3
source share
5 answers

Funny, I just moved my drupal to another folder and it worked. I probably didn’t explain my question very well.

0
source

< EDIT > if you want to change it in the database (why?), You can do this by changing the value file_directory_pathin the table variable:

UPDATE variable SET file_directory_path = 's:5:"files";';

variable php-. , file_directory_path (s) 5 files. .

, Drupal ( cache cid variables). , , , DELETE FROM cache WHERE cid = 'variables';. </ EDIT >

: Administer > a > http://yourdrupalsite.com/index.php?q=admin/settings/file-system.

+3

:

//Get the path of the files folder (ex. sites/default/files)
$files_dir = variable_get('file_directory_path', '');

//To set a new path programmatically
variable_set('file_directory_path', 'sites/new-path/files');
+1

, .

Since I have phpmyadmin available to me, I used this to export the file table, then performed some search / replace procedures, then imported the table, overwriting the data.

But if phpmyadmin didn’t help me, I would create an SQL query to replace obsolete paths ...

0
source

$ files_dir =; variable_get ('file_private_path');

enter image description here

0
source

Source: https://habr.com/ru/post/1742762/


All Articles