PHP Класс HM\BackUpWordPress\Path

Handles calculating & protecting the directory that backups will be stored in as well as the directory that is being backed up
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
calculate_path ( ) Calculate the backup path and create the directory if it doesn't exist.
cleanup ( ) Clean any temporary / incomplete backups from the backups directory
get_custom_path ( ) Get the path to the custom backup location if it's been set
get_default_path ( ) Get the path to the default backup location in wp-content
get_existing_path ( ) : string Returns the first existing path if there is one
get_existing_paths ( ) : array Builds an array containing existing backups folders.
get_fallback_path ( ) Get the path to the fallback backup location in uploads
get_home_path ( string $site_path = ABSPATH ) Calculate the path to the site "home" directory.
get_instance ( ) : Path Returns the *Singleton* instance of this class.
get_path ( ) Convenience method for quickly grabbing the path
get_root ( ) Convenience method for quickly grabbing the root
merge_existing_paths ( ) If we have more than one path then move any existing backups to the current path and remove them
move_old_backups ( string $from ) Move backup files from an existing directory and the new location.
protect_path ( string $reset = 'no' ) Protect the directory that backups are stored in
reset_path ( )
set_path ( $path ) Set the path directly, overriding the default
set_root ( $root ) Set the root path directly, overriding the default

Защищенные методы

Метод Описание
__construct ( ) Protected constructor to prevent creating a new instance of the *Singleton* via the new operator from outside of this class.

Приватные методы

Метод Описание
__clone ( ) Private clone method to prevent cloning of the instance of the *Singleton* instance.
__wakeup ( ) Private unserialize method to prevent unserializing of the *Singleton* instance.
get_calculated_path ( ) get the calculated path to the directory where backups will be stored
get_calculated_root ( ) get the calculated path to the directory that will be backed up

Описание методов

__construct() защищенный Метод

Protected constructor to prevent creating a new instance of the *Singleton* via the new operator from outside of this class.
protected __construct ( )

calculate_path() публичный Метод

Tries all possible locations and uses the first one possible.
public calculate_path ( )

cleanup() публичный Метод

Clean any temporary / incomplete backups from the backups directory
public cleanup ( )

get_custom_path() публичный Метод

Get the path to the custom backup location if it's been set
public get_custom_path ( )

get_default_path() публичный Метод

Get the path to the default backup location in wp-content
public get_default_path ( )

get_existing_path() публичный Метод

Returns the first existing path if there is one
public get_existing_path ( ) : string
Результат string Backup path if found empty string if not

get_existing_paths() публичный Метод

Builds an array containing existing backups folders.
public get_existing_paths ( ) : array
Результат array

get_fallback_path() публичный Метод

Get the path to the fallback backup location in uploads
public get_fallback_path ( )

get_home_path() публичный статический Метод

The home directory is the path equivalent to the home_url. That is, the path to the true root of the website. In situations where WordPress is installed in a subdirectory the home path is different to ABSPATH
public static get_home_path ( string $site_path = ABSPATH )
$site_path string The site_path to use when calculating the home path, defaults to ABSPATH

get_instance() публичный статический Метод

Returns the *Singleton* instance of this class.
public static get_instance ( ) : Path
Результат Path The *Singleton* instance.

get_path() публичный статический Метод

Convenience method for quickly grabbing the path
public static get_path ( )

get_root() публичный статический Метод

Convenience method for quickly grabbing the root
public static get_root ( )

merge_existing_paths() публичный Метод

If we have more than one path then move any existing backups to the current path and remove them

move_old_backups() публичный Метод

Move backup files from an existing directory and the new location.
public move_old_backups ( string $from )
$from string The path to move the backups from.

protect_path() публичный Метод

- Adds an index.html file in an attempt to disable directory browsing - Adds a .httaccess file to deny direct access if on Apache
public protect_path ( string $reset = 'no' )
$reset string

reset_path() публичный Метод

public reset_path ( )

set_path() публичный Метод

Set the path directly, overriding the default
public set_path ( $path )
$path

set_root() публичный Метод

Set the root path directly, overriding the default
public set_root ( $root )
$root