本文整理汇总了PHP中hmbkp_path函数的典型用法代码示例。如果您正苦于以下问题:PHP hmbkp_path函数的具体用法?PHP hmbkp_path怎么用?PHP hmbkp_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了hmbkp_path函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: testBackUpDirIsExcludedWhenBackUpDirIsInRoot
public function testBackUpDirIsExcludedWhenBackUpDirIsInRoot()
{
HM\BackUpWordPress\Path::get_instance()->set_path(dirname(__FILE__) . '/test-data/tmp');
$this->assertContains($this->backup->get_root(), hmbkp_path());
$this->assertNotEmpty($this->backup->get_excludes());
$this->assertContains(trailingslashit(hmbkp_path()), $this->backup->get_excludes());
}
开发者ID:rolka,项目名称:backupwordpress,代码行数:7,代码来源:testExcludesTest.php
示例2: hmbkp_backup_complete
function hmbkp_backup_complete($backup)
{
if ($backup->errors()) {
hmbkp_cleanup();
$file = hmbkp_path() . '/.backup_errors';
if (file_exists($file)) {
unlink($file);
}
if (!($handle = @fopen($file, 'w'))) {
return;
}
fwrite($handle, json_encode($backup->errors()));
fclose($handle);
} elseif ($backup->warnings()) {
$file = hmbkp_path() . '/.backup_warnings';
if (file_exists($file)) {
unlink($file);
}
if (!($handle = @fopen($file, 'w'))) {
return;
}
fwrite($handle, json_encode($backup->warnings()));
fclose($handle);
}
}
开发者ID:ryanurban,项目名称:Orbit,代码行数:25,代码来源:backup.actions.php
示例3: tearDown
/**
* Cleanup the backup file and tmp directory
* after every test
*
* @access public
*/
public function tearDown()
{
hmbkp_rmdirtree(hmbkp_path());
delete_option('hmbkp_path');
delete_option('hmbkp_default_path');
unset($this->backup);
}
开发者ID:leewillis77,项目名称:backupwordpress,代码行数:13,代码来源:testFullBackupTest.php
示例4: tearDown
/**
* Cleanup the backup file and tmp directory
* after every test
*
*/
public function tearDown()
{
hmbkp_rmdirtree(hmbkp_path());
chmod($this->backup->get_root() . '/test-data.txt', 0664);
unset($this->backup);
HM\BackUpWordPress\Path::get_instance()->reset_path();
}
开发者ID:rolka,项目名称:backupwordpress,代码行数:12,代码来源:testUnreadableFileTest.php
示例5: testDeltaBackupWithCommands
public function testDeltaBackupWithCommands()
{
if (!$this->backup->get_zip_command_path()) {
$this->markTestSkipped('Empty zip command path');
}
if (!$this->backup->get_mysqldump_command_path()) {
$this->markTestSkipped('Empty mysqldump command path');
}
$this->backup->backup();
$this->assertEquals('zip', $this->backup->get_archive_method());
$this->assertEquals('mysqldump', $this->backup->get_mysqldump_method());
$this->assertFileExists($this->backup->get_archive_filepath());
$this->assertArchiveContains($this->backup->get_archive_filepath(), array('test-data.txt', $this->backup->get_database_dump_filename()));
$this->assertArchiveFileCount($this->backup->get_archive_filepath(), 4);
if (!copy($this->backup->get_archive_filepath(), hmbkp_path() . '/delta.zip')) {
$this->markTestSkipped('Unable to copy backup');
}
// create a new file
file_put_contents($this->backup->get_root() . '/new.file', 'test');
if (!file_exists($this->backup->get_root() . '/new.file')) {
$this->markTestSkipped('new.file couldn\'t be created');
}
$this->backup->set_archive_filename('delta.zip');
$this->backup->backup();
$this->assertFileExists($this->backup->get_archive_filepath());
$this->assertArchiveContains($this->backup->get_archive_filepath(), array('new.file', 'test-data.txt', $this->backup->get_database_dump_filename()));
$this->assertArchiveFileCount($this->backup->get_archive_filepath(), 5);
}
开发者ID:rjagadishsingh,项目名称:backupwordpress,代码行数:28,代码来源:testBackUpProcessTest.php
示例6: tearDown
/**
* Cleanup the backup file and tmp directory
* after every test
*
*/
public function tearDown()
{
hmbkp_rmdirtree(hmbkp_path());
unset($this->backup);
if (file_exists($this->symlink)) {
unlink($this->symlink);
}
HM\BackUpWordPress\Path::get_instance()->reset_path();
}
开发者ID:rjagadishsingh,项目名称:backupwordpress,代码行数:14,代码来源:testSymlinkDirTest.php
示例7: tearDown
/**
* Cleanup the backup file and tmp directory
* after every test
*
* @access public
*/
public function tearDown()
{
hmbkp_rmdirtree($this->backup->get_path());
hmbkp_rmdirtree(hmbkp_path());
delete_option('hmbkp_path');
delete_option('hmbkp_default_path');
chmod($this->backup->get_root() . '/test-data.txt', 0664);
unset($this->backup);
}
开发者ID:humanmade,项目名称:hm-backup,代码行数:15,代码来源:testUnreadableFileTest.php
示例8: tearDown
/**
* Cleanup the backup file and tmp directory
* after every test
*
*/
public function tearDown()
{
if (!function_exists('symlink')) {
return;
}
hmbkp_rmdirtree(hmbkp_path());
unset($this->backup);
@unlink($this->symlink);
HM\BackUpWordPress\Path::get_instance()->reset_path();
}
开发者ID:rjagadishsingh,项目名称:backupwordpress,代码行数:15,代码来源:testBrokenSymlinkTest.php
示例9: tearDown
/**
* Cleanup the backup file and tmp directory
* after every test
*
* @access public
*/
public function tearDown()
{
hmbkp_rmdirtree($this->backup->get_path());
hmbkp_rmdirtree(hmbkp_path());
delete_option('hmbkp_path');
delete_option('hmbkp_default_path');
unset($this->backup);
if (file_exists($this->hidden)) {
unlink($this->hidden);
}
}
开发者ID:humanmade,项目名称:hm-backup,代码行数:17,代码来源:testHiddenFileTest.php
示例10: testRootBackupPath
/**
* What if the backup path is in root
*
*/
public function testRootBackupPath()
{
HM\BackUpWordPress\Path::get_instance()->set_path('/');
$this->backup->set_archive_filename('backup.zip');
$this->assertEquals('/', hmbkp_path());
$this->assertEquals('/backup.zip', $this->backup->get_archive_filepath());
if (!is_writable(hmbkp_path())) {
$this->markTestSkipped('Root not writable');
}
$this->backup->backup();
$this->assertFileExists($this->backup->get_archive_filepath());
}
开发者ID:rolka,项目名称:backupwordpress,代码行数:16,代码来源:testBackupPropertiesTest.php
示例11: tearDown
/**
* Cleanup the backup file and tmp directory
* after every test
*
* @access public
*/
public function tearDown()
{
if (!function_exists('symlink')) {
return;
}
hmbkp_rmdirtree($this->backup->get_path());
hmbkp_rmdirtree(hmbkp_path());
delete_option('hmbkp_path');
delete_option('hmbkp_default_path');
unset($this->backup);
@unlink($this->symlink);
}
开发者ID:humanmade,项目名称:hm-backup,代码行数:18,代码来源:testBrokenSymlinkTest.php
示例12: hmbkp_setup_hm_backup
/**
* Setup the HM_Backup class
*
* @return null
*/
function hmbkp_setup_hm_backup()
{
$hm_backup = HM_Backup::get_instance();
$hm_backup->path = hmbkp_path();
$hm_backup->files_only = hmbkp_get_files_only();
$hm_backup->database_only = hmbkp_get_database_only();
if (defined('HMBKP_MYSQLDUMP_PATH')) {
$hm_backup->mysql_command_path = HMBKP_MYSQLDUMP_PATH;
}
if (defined('HMBKP_ZIP_PATH')) {
$hm_backup->zip_command_path = HMBKP_ZIP_PATH;
}
$hm_backup->excludes = hmbkp_valid_custom_excludes();
}
开发者ID:ryanurban,项目名称:Orbit,代码行数:19,代码来源:plugin.php
示例13: backup
/**
* Perform a Backup.
*
* ## OPTIONS
*
* [--files_only]
* : Backup files only, default to off
*
* [--database_only]
* : Backup database only, defaults to off
*
* [--destination]
* : dir that the backup should be save in, defaults to your existing backups directory
*
* [--root]
* : dir that should be backed up, defaults to site root.
*
* [--zip_command_path]
* : path to your zip binary, standard locations are automatically used
*
* [--mysqldump_command_path]
* : path to your mysqldump binary, standard locations are automatically used
*
* [--archive_filename]
* : filename for the resulting zip file
*
* [--excludes]
* : list of paths you'd like to exclude
*
* ## Usage
*
* wp backupwordpress backup [--files_only] [--database_only] [--path<dir>] [--root<dir>] [--zip_command_path=<path>] [--mysqldump_command_path=<path>]
*
* @todo errors should be bubbled from Backup, Scheduled_Backup and the like instead of being repeated.
*/
public function backup($args, $assoc_args)
{
add_action('hmbkp_mysqldump_started', function () {
WP_CLI::line(__('Backup: Dumping database...', 'backupwordpress'));
});
add_action('hmbkp_archive_started', function () {
WP_CLI::line(__('Backup: Zipping everything up...', 'backupwordpress'));
});
$hm_backup = new HM\BackUpWordPress\Backup();
if (!empty($assoc_args['destination'])) {
Path::get_instance()->set_path($assoc_args['destination']);
}
HM\BackUpWordPress\Path::get_instance()->cleanup();
if (!empty($assoc_args['root'])) {
$hm_backup->set_root($assoc_args['root']);
}
if (!is_dir(hmbkp_path())) {
WP_CLI::error(__('Invalid backup path', 'backupwordpress'));
return false;
}
if (!is_dir($hm_backup->get_root()) || !is_readable($hm_backup->get_root())) {
WP_CLI::error(__('Invalid root path', 'backupwordpress'));
return false;
}
if (isset($assoc_args['archive_filename'])) {
$hm_backup->set_archive_filename($assoc_args['archive_filename']);
}
if (!empty($assoc_args['files_only'])) {
$hm_backup->set_type('file');
}
if (!empty($assoc_args['database_only'])) {
$hm_backup->set_type('database');
}
if (isset($assoc_args['mysqldump_command_path'])) {
$hm_backup->set_mysqldump_command_path($assoc_args['mysqldump_command_path']);
}
if (isset($assoc_args['zip_command_path'])) {
$hm_backup->set_zip_command_path($assoc_args['zip_command_path']);
}
if (!empty($assoc_args['excludes'])) {
$hm_backup->set_excludes($assoc_args['excludes']);
}
$hm_backup->backup();
if (file_exists($hm_backup->get_archive_filepath())) {
WP_CLI::success(__('Backup Complete: ', 'backupwordpress') . $hm_backup->get_archive_filepath());
} else {
WP_CLI::error(__('Backup Failed', 'backupwordpress'));
}
}
开发者ID:NicoGill,项目名称:Archistyle,代码行数:84,代码来源:class-backupwordpress-wp-cli-command.php
示例14: __construct
/**
* Setup the schedule object
* Loads the options from the database and populates properties
*
* @param string $id
* @throws Exception
*/
public function __construct($id)
{
// Verify the schedule id
if (!is_string($id) || !trim($id)) {
throw new Exception('Argument 1 for ' . __METHOD__ . ' must be a non empty string');
}
// Setup HM Backup
parent::__construct();
// Store id for later
$this->id = $id;
// Load the options
$this->options = array_filter((array) get_option('hmbkp_schedule_' . $this->get_id()));
// Some properties can be overridden with defines
if (defined('HMBKP_ROOT') && HMBKP_ROOT) {
$this->set_root(HMBKP_ROOT);
}
if (defined('HMBKP_PATH') && HMBKP_PATH) {
$this->set_path(HMBKP_PATH);
}
if (defined('HMBKP_EXCLUDE') && HMBKP_EXCLUDE) {
parent::set_excludes(HMBKP_EXCLUDE, true);
}
parent::set_excludes($this->default_excludes(), true);
if (defined('HMBKP_MYSQLDUMP_PATH')) {
$this->set_mysqldump_command_path(HMBKP_MYSQLDUMP_PATH);
}
if (defined('HMBKP_ZIP_PATH')) {
$this->set_zip_command_path(HMBKP_ZIP_PATH);
}
if (defined('HMBKP_ZIP_PATH') && HMBKP_ZIP_PATH === 'PclZip' && ($this->skip_zip_archive = true)) {
$this->set_zip_command_path(false);
}
if (defined('HMBKP_SCHEDULE_START_TIME') && strtotime('HMBKP_SCHEDULE_START_TIME')) {
$this->set_schedule_start_time(strtotime('HMBKP_SCHEDULE_START_TIME'));
}
// Set the path - TODO remove external function dependancy
$this->set_path(hmbkp_path());
// Set the archive filename to site name + schedule slug + date
$this->set_archive_filename(implode('-', array(sanitize_title(str_ireplace(array('http://', 'https://', 'www'), '', home_url())), $this->get_id(), $this->get_type(), date('Y-m-d-H-i-s', current_time('timestamp')))) . '.zip');
$this->set_database_dump_filename(implode('-', array(sanitize_title(str_ireplace(array('http://', 'https://', 'www'), '', home_url())), $this->get_id(), $this->get_type(), date('Y-m-d-H-i-s', current_time('timestamp')))) . '.sql');
// Setup the schedule if it isn't set
if (!$this->is_cron_scheduled() && $this->get_reoccurrence() !== 'manually') {
$this->schedule();
}
}
开发者ID:erkmen,项目名称:wpstartersetup,代码行数:52,代码来源:class-schedule.php
示例15: tearDown
/**
* Cleanup the backup file and tmp directory
* after every test
*
*/
public function tearDown()
{
hmbkp_rmdirtree(hmbkp_path());
unset($this->backup);
HM\BackUpWordPress\Path::get_instance()->reset_path();
}
开发者ID:rjagadishsingh,项目名称:backupwordpress,代码行数:11,代码来源:testDatabaseDumpTest.php
示例16: __
<?php
} else {
if (!hmbkp_get_database_only() && !hmbkp_get_files_only()) {
$what_to_backup = '<code>' . __('database', 'hmbkp') . '</code> ' . __('&', 'hmbkp') . ' <code>' . __('files', 'hmbkp') . '</code>';
} elseif (hmbkp_get_database_only()) {
$what_to_backup = '<code>' . __('database', 'hmbkp') . '</code>';
} else {
$what_to_backup = '<code>' . __('files', 'hmbkp') . '</code>';
}
?>
<?php
$offset = current_time('timestamp') - time();
$schedules = wp_get_schedules();
$schedule = $schedules[wp_get_schedule('hmbkp_schedule_backup_hook')]['display'];
printf(__('Your %s will be automatically backed up <code>%s</code>. The next backup will occur at %s on %s and be saved to %s.', 'hmbkp'), $what_to_backup, $schedule, '<code>' . date_i18n(get_option('time_format'), wp_next_scheduled('hmbkp_schedule_backup_hook') + $offset) . '</code>', '<code title="' . sprintf(__('It\'s currently %s', 'hmbkp'), date_i18n(get_option('time_format'))) . '">' . date_i18n(get_option('date_format'), wp_next_scheduled('hmbkp_schedule_backup_hook') + $offset) . '</code>', '<code>' . hmbkp_path() . '</code>');
?>
<?php
}
?>
</p>
<p>✓ <span class="hmbkp_estimated-size"><?php
printf(__('Your site is %s. Backups will be compressed and should be smaller than this.', 'hmbkp'), get_transient('hmbkp_estimated_filesize') ? '<code>' . hmbkp_calculate() . '</code>' : '<code class="calculate">' . __('Calculating Size...', 'hmbkp') . '</code>');
?>
</span></p>
<?php
if (hmbkp_get_email_address()) {
开发者ID:ryanurban,项目名称:Orbit,代码行数:31,代码来源:admin.status.php
示例17: hmbkp_cleanup
/**
* Remove any non backup.zip files from the backups dir.
*
* @return void
*/
function hmbkp_cleanup()
{
if (defined('HMBKP_PATH') && HMBKP_PATH) {
return;
}
$hmbkp_path = hmbkp_path();
if (!is_dir($hmbkp_path)) {
return;
}
if ($handle = opendir($hmbkp_path)) {
while (false !== ($file = readdir($handle))) {
if (!in_array($file, array('.', '..', 'index.html')) && pathinfo($file, PATHINFO_EXTENSION) !== 'zip') {
hmbkp_rmdirtree(trailingslashit($hmbkp_path) . $file);
}
}
closedir($handle);
}
}
开发者ID:shahadat014,项目名称:geleyi,代码行数:23,代码来源:core.php
示例18: sprintf
case 'hmbkp_weekly':
$reoccurrence = sprintf(__('weekly on %1$s at %2$s', 'hmbkp'), '<span ' . $next_backup . '>' . esc_html($day) . '</span>', '<span>' . esc_html(date_i18n(get_option('time_format'), $schedule->get_next_occurrence(false))) . '</span>');
break;
case 'hmbkp_fortnightly':
$reoccurrence = sprintf(__('fortnightly on %1$s at %2$s', 'hmbkp'), '<span ' . $next_backup . '>' . $day . '</span>', '<span>' . esc_html(date_i18n(get_option('time_format'), $schedule->get_next_occurrence(false))) . '</span>');
break;
case 'hmbkp_monthly':
$reoccurrence = sprintf(__('on the %1$s of each month at %2$s', 'hmbkp'), '<span ' . $next_backup . '>' . esc_html(date_i18n('jS', $schedule->get_next_occurrence(false))) . '</span>', '<span>' . esc_html(date_i18n(get_option('time_format'), $schedule->get_next_occurrence(false))) . '</span>');
break;
case 'manually':
$reoccurrence = __('manually', 'hmbkp');
break;
default:
$schedule->set_reoccurrence('manually');
}
$server = '<span title="' . esc_attr(hmbkp_path()) . '">' . __('this server', 'hmbkp') . '</span>';
// Backup to keep
switch ($schedule->get_max_backups()) {
case 1:
$backup_to_keep = sprintf(__('store only the last backup on %s', 'hmbkp'), $server);
break;
case 0:
$backup_to_keep = sprintf(__('don\'t store any backups on %s', 'hmbkp'), $server);
break;
default:
$backup_to_keep = sprintf(__('store only the last %1$s backups on %2$s', 'hmbkp'), esc_html($schedule->get_max_backups()), $server);
}
$email_msg = '';
foreach (HMBKP_Services::get_services($schedule) as $file => $service) {
if ('Email' == $service->name) {
$email_msg = wp_kses_post($service->display());
开发者ID:shahadat014,项目名称:geleyi,代码行数:31,代码来源:schedule.php
示例19: __
break;
case 'manually':
$reoccurrence = __('manually', 'backupwordpress');
break;
default:
$schedule->set_reoccurrence('manually');
}
$server = '<span title="' . esc_attr(hmbkp_path()) . '">' . __('this server', 'backupwordpress') . '</span>';
$server = '<code>' . esc_attr(str_replace($schedule->get_home_path(), '', hmbkp_path())) . '</code>';
// Backup to keep
switch ($schedule->get_max_backups()) {
case 1:
$backup_to_keep = sprintf(__('store the most recent backup in %s', 'backupwordpress'), $server);
break;
case 0:
$backup_to_keep = sprintf(__('don\'t store any backups in on this server', 'backupwordpress'), hmbkp_path());
break;
default:
$backup_to_keep = sprintf(__('store the last %1$s backups in %2$s', 'backupwordpress'), esc_html($schedule->get_max_backups()), $server);
}
$email_msg = $services = '';
foreach (HMBKP_Services::get_services($schedule) as $file => $service) {
if ('Email' === $service->name) {
$email_msg = wp_kses_post($service->display());
} elseif ($service->is_service_active()) {
$services[] = esc_html($service->display());
}
}
if (!empty($services) && count($services) > 1) {
$services[count($services) - 2] .= ' & ' . $services[count($services) - 1];
array_pop($services);
开发者ID:Natedaug,项目名称:WordPressSites,代码行数:31,代码来源:schedule-sentence.php
示例20: hmbkp_request_cancel_backup
/**
* Cancels a running backup then redirect back to the backups page
*/
function hmbkp_request_cancel_backup()
{
check_admin_referer('hmbkp_request_cancel_backup', 'hmbkp-request_cancel_backup_nonce');
$schedule = new HMBKP_Scheduled_Backup(sanitize_text_field(urldecode($_GET['hmbkp_schedule_id'])));
// Delete the running backup
if ($schedule->get_running_backup_filename() && file_exists(trailingslashit(hmbkp_path()) . $schedule->get_running_backup_filename())) {
unlink(trailingslashit(hmbkp_path()) . $schedule->get_running_backup_filename());
}
if ($schedule->get_schedule_running_path() && file_exists($schedule->get_schedule_running_path())) {
unlink($schedule->get_schedule_running_path());
}
HMBKP_Path::get_instance()->cleanup();
wp_safe_redirect(hmbkp_get_settings_url(), 303);
die;
}
开发者ID:Natedaug,项目名称:WordPressSites,代码行数:18,代码来源:actions.php
注:本文中的hmbkp_path函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论