Astra_Addon_Filesystem::maybe_create_uploads_dir( String $dir )
Create uploads directory if it does not exist.
Description
Parameters
- $dir
-
(String) (Required) directory path to be created.
Return
(boolean) True of the directory is created. False if directory is not created.
Source
File: classes/class-astra-addon-filesystem.php
public function maybe_create_uploads_dir( $dir ) { // Create the upload dir if it doesn't exist. if ( ! file_exists( $dir ) ) { // Create the directory. $status = astra_addon_filesystem()->get_filesystem()->mkdir( $dir ); // IF a directory cannot be created, return with false status. if ( false === $status ) { astra_addon_filesystem()->update_filesystem_access_status( $status ); return false; } // Add an index file for security. astra_addon_filesystem()->get_filesystem()->put_contents( $dir . 'index.php', '' ); } return true; }
Expand full source code Collapse full source code View on Trac
Changelog
Version | Description |
---|---|
2.6.4 | Introduced. |