本文整理汇总了PHP中w3_rmdir函数的典型用法代码示例。如果您正苦于以下问题:PHP w3_rmdir函数的具体用法?PHP w3_rmdir怎么用?PHP w3_rmdir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了w3_rmdir函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: w3_remove_old_folders
/**
* Removes old legacy folders. User gets a note about manual removal if the function can't delete all in 20 seconds.
*/
function w3_remove_old_folders()
{
$config_admin = w3_instance('W3_ConfigAdmin');
$old_folders = w3_find_old_folders();
if ($old_folders) {
$config_admin->set('notes.remove_w3tc', true);
$config_admin->save();
@set_time_limit(20);
foreach ($old_folders as $old_folder) {
w3_rmdir($old_folder);
}
$config_admin->set('notes.remove_w3tc', false);
$config_admin->save();
}
}
示例2: _flush_based_on_regex
/**
* Flush cache based on regex
* @param string $regex
*/
private function _flush_based_on_regex($regex)
{
if (w3_is_multisite() && !w3_is_subdomain_install()) {
$domain = w3_get_home_url();
$parsed = parse_url($domain);
$host = $parsed['host'];
$path = trim($parsed['path'], '/');
$flush_dir = W3TC_CACHE_PAGE_ENHANCED_DIR . '/' . $host . '/' . $path;
} else {
$flush_dir = W3TC_CACHE_PAGE_ENHANCED_DIR . '/' . w3_get_domain(w3_get_host());
}
$dir = @opendir($flush_dir);
if ($dir) {
while (($entry = @readdir($dir)) !== false) {
if ($entry == '.' || $entry == '..') {
continue;
}
if (preg_match('/' . $regex . '/', basename($entry))) {
w3_rmdir($flush_dir . DIRECTORY_SEPARATOR . $entry);
}
}
@closedir($dir);
}
}
示例3: deactivate
/**
* Deactivate plugin action
*
* @return void
*/
function deactivate()
{
delete_option('w3tc_request_data');
// keep for other blogs
if (!$this->locked()) {
@unlink(W3TC_BLOGNAMES_PATH);
}
@unlink(W3TC_CONFIG_PREVIEW_PATH);
w3_rmdir(W3TC_TMP_DIR);
w3_rmdir(W3TC_LOG_DIR);
w3_rmdir(W3TC_CACHE_FILE_MINIFY_DIR);
w3_rmdir(W3TC_CACHE_FILE_PGCACHE_DIR);
w3_rmdir(W3TC_CACHE_FILE_DBCACHE_DIR);
w3_rmdir(W3TC_CACHE_FILE_OBJECTCACHE_DIR);
w3_rmdir(W3TC_CONTENT_DIR);
}
示例4: w3_emptydir
/**
* Recursive empty dir
*
* @param string $path
* @param array $exclude
* @return void
*/
function w3_emptydir($path, $exclude = array())
{
w3_rmdir($path, $exclude, false);
}
示例5: _test_cleanup
private function _test_cleanup()
{
w3_rmdir(self::$test_dir);
}
示例6: action_save_options
/**
* Options save action
*
* @return void
*/
function action_save_options()
{
if (!current_user_can('manage_options')) {
wp_die(__('You do not have the rights to perform this action.', 'w3-total-cache'));
}
/**
* Redirect params
*/
$params = array();
/**
* Store error message regarding permalink not enabled
*/
$redirect_permalink_error = '';
/**
* Read config
* We should use new instance of WP_Config object here
*/
$config = new W3_Config();
$this->read_request($config);
$config_admin = new W3_ConfigAdmin();
$this->read_request($config_admin);
if ($this->_page == 'w3tc_dashboard') {
if (W3_Request::get_boolean('maxcdn')) {
$config->set('cdn.enabled', true);
$config->set('cdn.engine', 'maxcdn');
}
}
/**
* General tab
*/
if ($this->_page == 'w3tc_general') {
$file_nfs = W3_Request::get_boolean('file_nfs');
$file_locking = W3_Request::get_boolean('file_locking');
$config->set('pgcache.file.nfs', $file_nfs);
$config->set('minify.file.nfs', $file_nfs);
$config->set('dbcache.file.locking', $file_locking);
$config->set('objectcache.file.locking', $file_locking);
$config->set('pgcache.file.locking', $file_locking);
$config->set('minify.file.locking', $file_locking);
if (is_network_admin()) {
if ($this->_config->get_boolean('common.force_master') !== $config->get_boolean('common.force_master') || !w3_force_master() && $this->_config->get_boolean('common.force_master') && $config->get_boolean('common.force_master') || w3_force_master() && !$this->_config->get_boolean('common.force_master') && !$config->get_boolean('common.force_master')) {
@unlink(W3TC_CACHE_BLOGMAP_FILENAME);
$blogmap_dir = dirname(W3TC_CACHE_BLOGMAP_FILENAME) . '/' . basename(W3TC_CACHE_BLOGMAP_FILENAME, '.php') . '/';
if (@is_dir($blogmap_dir)) {
w3_rmdir($blogmap_dir);
}
}
if ($config->get_boolean('common.force_master')) {
$config_admin->set('common.visible_by_master_only', true);
}
}
/**
* Check permalinks for page cache
*/
if ($config->get_boolean('pgcache.enabled') && $config->get_string('pgcache.engine') == 'file_generic' && !get_option('permalink_structure')) {
$config->set('pgcache.enabled', false);
$redirect_permalink_error = 'fancy_permalinks_disabled_pgcache';
}
/**
* Get New Relic application id
*/
if ($config->get_boolean('newrelic.enabled')) {
$method = W3_Request::get_string('application_id_method');
$newrelic_prefix = '';
if (w3_is_network() && w3_get_blog_id() != 0) {
$newrelic_prefix = $this->_config->get_string('newrelic.appname_prefix');
}
if (($newrelic_api_key = $config->get_string('newrelic.api_key')) && !$config->get_string('newrelic.account_id')) {
$nerser = w3_instance('W3_NewRelicService');
$account_id = $nerser->get_account_id($newrelic_api_key);
$config->set('newrelic.account_id', $account_id);
}
if ($method == 'dropdown' && $config->get_string('newrelic.application_id')) {
$application_id = $config->get_string('newrelic.application_id');
if ($config->get_string('newrelic.api_key') && $config->get_string('newrelic.account_id')) {
w3_require_once(W3TC_LIB_W3_DIR . '/NewRelicService.php');
$nerser = new W3_NewRelicService($config->get_string('newrelic.api_key'), $config->get_string('newrelic.account_id'));
$appname = $nerser->get_application_name($application_id);
$config->set('newrelic.appname', $appname);
}
} else {
if ($method == 'manual' && $config->get_string('newrelic.appname')) {
if ($newrelic_prefix != '' && strpos($config->get_string('newrelic.appname'), $newrelic_prefix) === false) {
$application_name = $newrelic_prefix . $config->get_string('newrelic.appname');
$config->set('newrelic.appname', $application_name);
} else {
$application_name = $config->get_string('newrelic.appname');
}
if ($config->get_string('newrelic.api_key') && $config->get_string('newrelic.account_id')) {
w3_require_once(W3TC_LIB_W3_DIR . '/NewRelicService.php');
$nerser = new W3_NewRelicService($config->get_string('newrelic.api_key'), $config->get_string('newrelic.account_id'));
$application_id = $nerser->get_application_id($application_name);
if ($application_id) {
$config->set('newrelic.application_id', $application_id);
}
//.........这里部分代码省略.........
示例7: action_save_options
/**
* Options save action
*
* @return void
*/
function action_save_options()
{
/**
* Redirect params
*/
$params = array();
/**
* Store error message regarding permalink not enabled
*/
$redirect_permalink_error = '';
/**
* Read config
* We should use new instance of WP_Config object here
*/
$config = new W3_Config();
if (!$this->_config->own_config_exists()) {
$config->import_legacy_config();
}
$this->read_request($config);
$config_admin = new W3_ConfigAdmin();
$this->read_request($config_admin);
if ($this->_page == 'w3tc_dashboard') {
if (W3_Request::get_boolean('maxcdn')) {
$config->set('cdn.enabled', true);
$config->set('cdn.engine', 'maxcdn');
}
}
/**
* General tab
*/
if ($this->_page == 'w3tc_general') {
$file_nfs = W3_Request::get_boolean('file_nfs');
$file_locking = W3_Request::get_boolean('file_locking');
$config->set('pgcache.file.nfs', $file_nfs);
$config->set('minify.file.nfs', $file_nfs);
$config->set('dbcache.file.locking', $file_locking);
$config->set('objectcache.file.locking', $file_locking);
$config->set('pgcache.file.locking', $file_locking);
$config->set('minify.file.locking', $file_locking);
if ($this->is_network_and_master()) {
if ($this->_config->get_boolean('common.force_master') !== $config->get_boolean('common.force_master') || !w3_force_master() && $this->_config->get_boolean('common.force_master') && $config->get_boolean('common.force_master') || w3_force_master() && !$this->_config->get_boolean('common.force_master') && !$config->get_boolean('common.force_master')) {
@unlink(W3TC_CACHE_BLOGMAP_FILENAME);
$blogmap_dir = dirname(W3TC_CACHE_BLOGMAP_FILENAME) . '/' . basename(W3TC_CACHE_BLOGMAP_FILENAME, '.php') . '/';
if (@is_dir($blogmap_dir)) {
w3_rmdir($blogmap_dir);
}
}
if ($config->get_boolean('common.force_master')) {
$config_admin->set('common.visible_by_master_only', true);
}
}
/**
* Check permalinks for page cache
*/
if ($config->get_boolean('pgcache.enabled') && $config->get_string('pgcache.engine') == 'file_generic' && !get_option('permalink_structure')) {
$config->set('pgcache.enabled', false);
$redirect_permalink_error = 'fancy_permalinks_disabled_pgcache';
}
$w3_cloudflare = w3_instance('W3_CloudFlare');
$w3_cloudflare->reset_settings_cache();
if ($config->get_boolean('cloudflare.enabled') && $w3_cloudflare->minify_enabled() && $config->get_boolean('minify.enabled')) {
$config->set('minify.enabled', false);
}
/**
* Get New Relic application id
*/
if ($config->get_boolean('newrelic.enabled')) {
$method = W3_Request::get_string('application_id_method');
$newrelic_prefix = '';
if (w3_is_network() && w3_get_blog_id() != 0) {
$newrelic_prefix = $this->_config->get_string('newrelic.appname_prefix');
}
if (($newrelic_api_key = $config->get_string('newrelic.api_key')) && !$config->get_string('newrelic.account_id')) {
$nerser = w3_instance('W3_NewRelicService');
$account_id = $nerser->get_account_id($newrelic_api_key);
$config->set('newrelic.account_id', $account_id);
}
if ($method == 'dropdown' && $config->get_string('newrelic.application_id')) {
$application_id = $config->get_string('newrelic.application_id');
if ($config->get_string('newrelic.api_key') && $config->get_string('newrelic.account_id')) {
w3_require_once(W3TC_LIB_W3_DIR . '/NewRelicService.php');
$nerser = new W3_NewRelicService($config->get_string('newrelic.api_key'), $config->get_string('newrelic.account_id'));
$appname = $nerser->get_application_name($application_id);
$config->set('newrelic.appname', $appname);
}
} else {
if ($method == 'manual' && $config->get_string('newrelic.appname')) {
if ($newrelic_prefix != '' && strpos($config->get_string('newrelic.appname'), $newrelic_prefix) === false) {
$application_name = $newrelic_prefix . $config->get_string('newrelic.appname');
$config->set('newrelic.appname', $application_name);
} else {
$application_name = $config->get_string('newrelic.appname');
}
if ($config->get_string('newrelic.api_key') && $config->get_string('newrelic.account_id')) {
w3_require_once(W3TC_LIB_W3_DIR . '/NewRelicService.php');
//.........这里部分代码省略.........
示例8: w3_wp_delete_folders
/**
* @param $folders
* @param string $method Which method to use when creating
* @param string $url Where to redirect after creation
* @param bool|string $context path folder where delete folders resides
* @throws FilesystemCredentialException with S/FTP form if it can't get the required filesystem credentials
* @throws FileOperationException
*/
function w3_wp_delete_folders($folders, $method = '', $url = '', $context = false)
{
$delete_folders = array();
foreach ($folders as $folder) {
if (is_dir($folder)) {
$delete_folders[] = $folder;
}
}
if (empty($delete_folders)) {
return;
}
$removed = true;
foreach ($delete_folders as $folder) {
w3_rmdir($folder);
if (@is_dir($folder)) {
@rmdir($folder);
}
if (@is_dir($folder)) {
$removed = false;
break;
}
}
if ($removed) {
return;
}
w3_wp_request_filesystem_credentials($method, $url, $context);
global $wp_filesystem;
foreach ($delete_folders as $folder) {
w3_rmdir($folder);
if (file_exists($folder)) {
if (!$wp_filesystem->rmdir($folder, FS_CHMOD_DIR)) {
throw new FileOperationException('Could not delete directory: ' . $folder, 'delete', 'folder', $folder);
}
}
}
}
示例9: deactivate
/**
* Deactivate plugin action
* @todo Complete plugin uninstall on site wide activation
*/
function deactivate()
{
$this->link_delete();
delete_option('w3tc_request_data');
w3_rmdir(W3TC_TMP_DIR);
w3_rmdir(W3TC_LOG_DIR);
w3_rmdir(W3TC_CACHE_FILE_MINIFY_DIR);
w3_rmdir(W3TC_CACHE_FILE_PGCACHE_DIR);
w3_rmdir(W3TC_CACHE_FILE_DBCACHE_DIR);
w3_rmdir(W3TC_CONTENT_DIR);
}
示例10: deactivate
/**
* Deactivate plugin action
*
* @return void
*/
function deactivate()
{
delete_option('w3tc_request_data');
w3_rmdir(W3TC_CACHE_DIR);
}
示例11: w3_wp_delete_folder
/**
* @param $folder
* @param string $method Which method to use when creating
* @param string $url Where to redirect after creation
* @param bool|string $context path folder where delete folders resides
* @throws FilesystemRmdirException
*/
function w3_wp_delete_folder($folder)
{
if (!@is_dir($folder)) {
return;
}
w3_rmdir($folder);
if (!@is_dir($folder)) {
return;
}
try {
w3_wp_request_filesystem_credentials();
} catch (FilesystemOperationException $ex) {
throw new FilesystemRmdirException($ex->getMessage(), $ex->credentials_form(), $folder);
}
global $wp_filesystem;
if (!$wp_filesystem->rmdir($folder)) {
throw new FilesystemRmdirException(__('FTP credentials don\'t allow to delete folder ', 'w3-total-cache') . '<strong>' . $folder . '</strong>', w3_get_filesystem_credentials_form(), $folder);
}
}