Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #48316, comment 35


Ignore:
Timestamp:
02/07/2024 01:31:29 PM (12 months ago)
Author:
gerardreches
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #48316, comment 35

    initial v1  
    1919I am not using Git and I am not using symlinks, nor intend to. Not all hosting providers allow you to make use of those.
    2020
    21 While moving the core files and the wp-content directory is easy, it was impossible to achieve this structure by using the `UPLOADS` constant in the wp-config.php file. The only way to do it was by using the `uploads_path` option with either the absolute path or the relative path `../uploads`.
     21While moving the core files and the wp-content directory is easy, it was impossible to achieve this structure by using the `UPLOADS` constant in the wp-config.php file. The only way to do it was by using the `upload_path` option with either the absolute path or the relative path `../uploads`.
    2222
    2323Using the database option for this matter isn't a good approach, because it doesn't allow for easy migrations (after migrating the database from another site, the option will be replaced and the uploads path will be broken). Swapping the database could also break it. It's simply not obvious as a constant in the `wp-config.php` file is.
    2424
    25 Now, I do not understand what is going on with the `UPLOADS` constant and why it cannot be an absolute path nor why it doesn't behave in the same way as `uploads_path`. Maybe it is because the constant is taking care of both the path and the URL while the option only takes care of the path while there is another option taking care of the URL.
     25Now, I do not understand what is going on with the `UPLOADS` constant and why it cannot be an absolute path nor why it doesn't behave in the same way as `upload_path`. Maybe it is because the constant is taking care of both the path and the URL while the option only takes care of the path while there is another option taking care of the URL.
    2626
    27 My point is, **why don't we have a new pair of constants for the uploads path** just like we have `WP_CONTENT_DIR` and `WP_CONTENT_URL` for the **wp-content** directory that mimic what the database options do?
     27My point is, **why don't we have a new pair of constants for the upload path** just like we have `WP_CONTENT_DIR` and `WP_CONTENT_URL` for the **wp-content** directory that mimic what the database options do?
    2828
    29 Constants could be named **`WP_UPLOADS_DIR`** and **`WP_UPLOADS_URL`** and **they should not do other thing than exactly what the `uploads_path` and `uploads_url_path` options do**. Checking if the constant is defined, and in that case, using it wherever `get_option( 'uploads_path' )` and `get_option( 'uploads_url_path' )` are used. Their goal would be no more and no less than overriding the database option when defined.
     29Constants could be named **`WP_UPLOAD_DIR`** and **`WP_UPLOAD_URL`** and **they should not do other thing than exactly what the `upload_path` and `upload_url_path` options do**. Checking if the constant is defined, and in that case, using it wherever `get_option( 'upload_path' )` and `get_option( 'upload_url_path' )` are used. Their goal would be no more and no less than overriding the database option when defined.
    3030
    31 It makes so much sense in my head that I don't understand why this haven't been done yet, there has to be a catch. I'm no security expert, but if we can use an absolute path in `wp-config.php` for `WP_CONTENT_DIR` why couldn't we have it for a new `WP_UPLOADS_DIR` constant? It would just take precedence over the database value, and less than `UPLOADS`. I can't imagine any backward compatibility issues either.
     31It makes so much sense in my head that I don't understand why this haven't been done yet, there has to be a catch. I'm no security expert, but if we can use an absolute path in `wp-config.php` for `WP_CONTENT_DIR` why couldn't we have it for a new `WP_UPLOAD_DIR` constant? It would just take precedence over the database value, and less than `UPLOADS`. I can't imagine any backward compatibility issues either.