本文整理汇总了PHP中WP_Upgrader_Skin::feedback方法的典型用法代码示例。如果您正苦于以下问题:PHP WP_Upgrader_Skin::feedback方法的具体用法?PHP WP_Upgrader_Skin::feedback怎么用?PHP WP_Upgrader_Skin::feedback使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WP_Upgrader_Skin
的用法示例。
在下文中一共展示了WP_Upgrader_Skin::feedback方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* @param $options
*/
public function run($options)
{
$defaults = array('package' => '', 'destination' => '', 'clear_destination' => false, 'abort_if_destination_exists' => true, 'clear_working' => true, 'is_multi' => false, 'hook_extra' => array());
$options = wp_parse_args($options, $defaults);
// Connect to the Filesystem first.
$res = $this->fs_connect(array(WP_CONTENT_DIR, $options['destination']));
// Mainly for non-connected filesystem.
if (!$res) {
/*if ( ! $options['is_multi'] ) {
$this->skin->footer();
}*/
return false;
}
//Download the package (Note, This just returns the filename of the file if the package is a local file)
if (file_exists($options['package'])) {
$download = $options['package'];
} else {
$download = $this->download_package($options['package']);
}
if (is_wp_error($download)) {
$this->skin->error($download);
//$this->skin->after();
return $download;
}
$delete_package = $download != $options['package'];
// Do not delete a "local" file
//Unzips the file into a temporary directory
$working_dir = $this->unpack_package($download, $delete_package);
if (is_wp_error($working_dir)) {
$this->skin->error($working_dir);
$this->skin->after();
return $working_dir;
}
$options['source'] = $working_dir;
$options['package_folder'] = basename($working_dir);
//With the given options, this installs it to the destination directory.
$result = $this->install_package(array('source' => $working_dir, 'destination' => $options['destination'], 'clear_destination' => $options['clear_destination'], 'abort_if_destination_exists' => $options['abort_if_destination_exists'], 'clear_working' => $options['clear_working'], 'hook_extra' => $options['hook_extra']));
$this->skin->set_result($result);
if (is_wp_error($result)) {
$this->skin->error($result);
$this->skin->feedback('process_failed');
} else {
//Install Succeeded
$this->skin->feedback('process_success');
//update packages xml file
$result = $this->update_packages_wxr($options);
if (is_wp_error($result)) {
$this->skin->error($result);
$this->skin->feedback('process_failed');
} else {
$this->skin->feedback('process_success');
}
}
$this->update_packages_wxr($options);
$this->skin->feedback('go_manage_page');
$this->skin->after();
return $result;
}
示例2: maintenance_mode
/**
* Toggle maintenance mode for the site.
*
* Creates/deletes the maintenance file to enable/disable maintenance mode.
*
* @since 2.8.0
*
* @global WP_Filesystem_Base $wp_filesystem Subclass
*
* @param bool $enable True to enable maintenance mode, false to disable.
*/
public function maintenance_mode( $enable = false ) {
global $wp_filesystem;
$file = $wp_filesystem->abspath() . '.maintenance';
if ( $enable ) {
$this->skin->feedback('maintenance_start');
// Create maintenance file to signal that we are upgrading
$maintenance_string = '<?php $upgrading = ' . time() . '; ?>';
$wp_filesystem->delete($file);
$wp_filesystem->put_contents($file, $maintenance_string, FS_CHMOD_FILE);
} elseif ( ! $enable && $wp_filesystem->exists( $file ) ) {
$this->skin->feedback('maintenance_end');
$wp_filesystem->delete($file);
}
}