本文整理汇总了PHP中backupbuddy_core::hashGlob方法的典型用法代码示例。如果您正苦于以下问题:PHP backupbuddy_core::hashGlob方法的具体用法?PHP backupbuddy_core::hashGlob怎么用?PHP backupbuddy_core::hashGlob使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类backupbuddy_core
的用法示例。
在下文中一共展示了backupbuddy_core::hashGlob方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
// End backupbuddy_dbMediaSince().
// Get list of active plugins and remove BackupBuddy from it so we don't update any BackupBuddy files when deploying. Could cause issues with the API replacing files mid-deploy.
$activePlugins = backupbuddy_api::getActivePlugins();
foreach ($activePlugins as $activePluginIndex => $activePlugin) {
if (false !== strpos($activePlugin['name'], 'BackupBuddy')) {
unset($activePlugins[$activePluginIndex]);
}
}
$activePluginDirs = array();
foreach ($activePlugins as $activePluginDir => $activePlugin) {
$activePluginDirs[] = dirname(WP_PLUGIN_DIR . '/' . $activePluginDir);
}
$allPluginDirs = glob(WP_PLUGIN_DIR . '/*', GLOB_ONLYDIR);
$inactivePluginDirs = array_diff($allPluginDirs, $activePluginDirs);
// Remove active plugins from directories of all plugins to get directories of inactive plugins to exclude later.
$inactivePluginDirs[] = pb_backupbuddy::plugin_path();
// Also exclude BackupBuddy directory.
// Calculate media files signatures.
$upload_dir = wp_upload_dir();
$mediaExcludes = array('/backupbuddy_backups', '/pb_backupbuddy', '/backupbuddy_temp');
$mediaSignatures = backupbuddy_core::hashGlob($upload_dir['basedir'], $sha1, $mediaExcludes, $handle_utf8 = true);
// Calculate child theme file signatures, excluding main theme directory..
if (get_stylesheet_directory() == get_template_directory()) {
// Theme & childtheme are same so do not send any childtheme files!
$childThemeSignatures = array();
} else {
$childThemeSignatures = backupbuddy_core::hashGlob(get_stylesheet_directory(), $sha1);
}
global $wp_version;
return array('backupbuddyVersion' => pb_backupbuddy::settings('version'), 'wordpressVersion' => $wp_version, 'localTime' => time(), 'php' => array('upload_max_filesize' => $upload_max_filesize, 'max_execution_time' => $max_execution_time, 'memory_limit' => $memory_limit, 'max_post_size' => $max_post_size), 'abspath' => ABSPATH, 'siteurl' => site_url(), 'homeurl' => home_url(), 'tables' => $dbTables, 'dbPrefix' => $wpdb->prefix, 'activePlugins' => $activePlugins, 'activeTheme' => get_template(), 'activeChildTheme' => get_stylesheet(), 'themeSignatures' => backupbuddy_core::hashGlob(get_template_directory(), $sha1), 'childThemeSignatures' => $childThemeSignatures, 'pluginSignatures' => backupbuddy_core::hashGlob(WP_PLUGIN_DIR, $sha1, $inactivePluginDirs), 'mediaSignatures' => $mediaSignatures, 'mediaCount' => count($mediaSignatures), 'notifications' => array());
示例2: files_init
public static function files_init($state = array())
{
$start_time = time(true);
$state = array_merge(array('current_step' => 'media', 'step_start' => time(), 'sha1' => false), $state);
/* STEPS
* 1. Generate list of files, leaving stats blank.
* 2. Loop through list. Skip anything set to delete. If scantime is too old, calculate filesize, mtime, and optional sha1. Compare with existing values & update them. If they changed then mark sent to false.
*
* array[filename] => {
* size
* mtime
* sha1
* scantime
* [sent]
* [delete]
* }
*
*/
/***** MEDIA *****/
if ('1' != pb_backupbuddy::$options['live']['scan_media']) {
pb_backupbuddy::status('details', 'Scanning media files disabled based on settings.');
} else {
$upload_dir = wp_upload_dir();
$mediaExcludes = array('/backupbuddy_backups', '/pb_backupbuddy', '/backupbuddy_temp');
$mediaExcludes = array_merge($mediaExcludes, self::_getOption('media_excludes', true));
$scandir = $upload_dir['basedir'];
pb_backupbuddy::status('details', 'Scanning directory `' . $scandir . '`.');
$mediaSignatures = backupbuddy_core::hashGlob($scandir, $state['sha1'], $mediaExcludes);
self::_processSignatures($type = 'media', $mediaSignatures);
unset($mediaSignatures);
pb_backupbuddy::status('details', 'Time elapsed since files_init: `' . (time() - $start_time) . '` secs.');
}
/***** THEMES & CHILDTHEMES *****/
if ('1' != pb_backupbuddy::$options['live']['scan_themes']) {
pb_backupbuddy::status('details', 'Scanning theme files disabled based on settings.');
} else {
$themeExcludes = self::_getOption('theme_excludes', true);
$scandir = get_theme_root();
pb_backupbuddy::status('details', 'Scanning directory `' . $scandir . '`.');
$themeSignatures = backupbuddy_core::hashGlob($scandir, $state['sha1'], $themeExcludes);
self::_processSignatures($type = 'theme', $themeSignatures);
unset($themeSignatures);
pb_backupbuddy::status('details', 'Time elapsed since files_init: `' . (time() - $start_time) . '` secs.');
}
/***** CHILDTHEME *****/
/*
$childThemeExcludes = self::_getOption( pb_backupbuddy::$options['live']['childtheme_excludes'] );
if ( get_stylesheet_directory() == get_template_directory() ) { // Theme & childtheme are same so do not send any childtheme files!
$childThemeSignatures = array();
} else {
$childThemeSignatures = backupbuddy_core::hashGlob( get_stylesheet_directory(), $sha1, $childThemeExcludes );
}
self::_processSignatures( $type = 'childtheme', $childThemeSignatures );
unset( $childThemeSignatures );
pb_backupbuddy::status( 'details', 'Time elapsed since files_init: `' . ( time() - $start_time ) . '` secs.' );
*/
/***** PLUGIN *****/
if ('1' != pb_backupbuddy::$options['live']['scan_plugins']) {
pb_backupbuddy::status('details', 'Scanning plugin files disabled based on settings.');
} else {
$activePlugins = backupbuddy_api::getActivePlugins();
foreach ($activePlugins as $activePluginIndex => $activePlugin) {
if (false !== strpos($activePlugin['name'], 'BackupBuddy')) {
unset($activePlugins[$activePluginIndex]);
}
}
$activePluginDirs = array();
foreach ($activePlugins as $activePluginDir => $activePlugin) {
$activePluginDirs[] = dirname(WP_PLUGIN_DIR . '/' . $activePluginDir);
}
$allPluginDirs = glob(WP_PLUGIN_DIR . '/*', GLOB_ONLYDIR);
$inactivePluginDirs = array_diff($allPluginDirs, $activePluginDirs);
// Remove active plugins from directories of all plugins to get directories of inactive plugins to exclude later.
$pluginExcludes = array_merge($inactivePluginDirs, self::_getOption('plugin_excludes', true));
$scandir = WP_PLUGIN_DIR;
pb_backupbuddy::status('details', 'Scanning directory `' . $scandir . '`.');
$pluginSignatures = backupbuddy_core::hashGlob($scandir, $state['sha1'], $pluginExcludes);
self::_processSignatures($type = 'plugins', $pluginSignatures);
unset($pluginSignatures);
pb_backupbuddy::status('details', 'Time elapsed since files_init: `' . (time() - $start_time) . '` secs.');
}
/***** CUSTOM *****/
if ('1' != pb_backupbuddy::$options['live']['scan_custom']) {
pb_backupbuddy::status('details', 'Scanning custom additional directories disabled based on settings.');
} else {
$customIncludes = self::_getOption('custom_includes', true);
$customSignatures = array();
$abspath_len = strlen(ABSPATH);
foreach ($customIncludes as $customInclude) {
if ('' == $customInclude || substr($customInclude, 0, $abspath_len) !== ABSPATH) {
// Not within ABSPATH.
continue;
}
pb_backupbuddy::status('details', 'Scanning directory `' . $customInclude . '`.');
$customSignatures = array_merge($customSignatures, backupbuddy_core::hashGlob($customInclude, $state['sha1']));
}
self::_processSignatures($type = 'custom', $customSignatures);
unset($customSignatures);
pb_backupbuddy::status('details', 'Time elapsed since files_init: `' . (time() - $start_time) . '` secs.');
}
//.........这里部分代码省略.........