本文整理汇总了PHP中w3_writable_error函数的典型用法代码示例。如果您正苦于以下问题:PHP w3_writable_error函数的具体用法?PHP w3_writable_error怎么用?PHP w3_writable_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了w3_writable_error函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: activate
/**
* Activate plugin action
*/
function activate()
{
if (!$this->locked() && !@copy(W3TC_INSTALL_FILE_OBJECT_CACHE, W3TC_ADDIN_FILE_OBJECT_CACHE)) {
w3_writable_error(W3TC_ADDIN_FILE_OBJECT_CACHE);
}
$this->schedule();
}
示例2: activate
/**
* Activate plugin action
*/
function activate()
{
require_once W3TC_INC_DIR . '/functions/activation.php';
if ($this->_config->get_boolean('pgcache.enabled') && $this->_config->get_string('pgcache.engine') == 'file_generic') {
/**
* Disable enhanced mode if permalink structure is disabled
*/
$permalink_structure = get_option('permalink_structure');
if ($permalink_structure == '') {
$this->_config->set('pgcache.engine', 'file');
$this->_config->save();
} else {
if (w3_can_modify_rules(w3_get_pgcache_rules_core_path())) {
$this->write_rules_core();
}
if (w3_can_modify_rules(w3_get_pgcache_rules_cache_path())) {
$this->write_rules_cache();
}
}
}
if (!$this->locked()) {
if (!@copy(W3TC_INSTALL_FILE_ADVANCED_CACHE, W3TC_ADDIN_FILE_ADVANCED_CACHE)) {
w3_writable_error(W3TC_ADDIN_FILE_ADVANCED_CACHE);
}
if ((!defined('WP_CACHE') || !WP_CACHE) && !$this->enable_wp_cache()) {
$reactivate_url = wp_nonce_url('plugins.php?action=activate&plugin=' . W3TC_FILE, 'activate-plugin_' . W3TC_FILE);
$reactivate_button = sprintf('<input type="button" value="re-activate plugin" onclick="top.location.href = \'%s\'" />', addslashes($reactivate_url));
$error = sprintf('<strong>%swp-config.php</strong> could not be written, please edit config and add:<br /><strong style="color:#f00;">define(\'WP_CACHE\', true);</strong> before <strong style="color:#f00;">require_once(ABSPATH . \'wp-settings.php\');</strong><br />then %s.', ABSPATH, $reactivate_button);
w3_activate_error($error);
}
}
$this->schedule();
$this->schedule_prime();
}
示例3: activate
/**
* Activate plugin action
*/
function activate()
{
if (!$this->update_wp_config()) {
$error = sprintf('<strong>%swp-config.php</strong> could not be written, please edit config and add:<br /><strong style="color:#f00;">define(\'WP_CACHE\', true);</strong> before <strong style="color:#f00;">require_once(ABSPATH . \'wp-settings.php\');</strong><br />then re-activate plugin.', ABSPATH);
w3_activate_error($error);
}
if ($this->_config->get_boolean('pgcache.enabled') && $this->_config->get_string('pgcache.engine') == 'file_pgcache') {
/**
* Disable enchanged mode if permalink structure is disabled
*/
$permalink_structure = get_option('permalink_structure');
if ($permalink_structure == '') {
$this->_config->set('pgcache.engine', 'file');
$this->_config->save();
} else {
if (!w3_is_wpmu() && !$this->write_rules_core()) {
w3_writable_error(ABSPATH . '.htaccess');
}
if (!$this->write_rules_cache()) {
w3_writable_error(W3TC_CACHE_FILE_PGCACHE_DIR . '/.htaccess');
}
}
}
if (!$this->locked()) {
if (@copy(W3TC_INSTALL_DIR . '/advanced-cache.php', WP_CONTENT_DIR . '/advanced-cache.php')) {
@chmod(WP_CONTENT_DIR . '/advanced-cache.php', 0644);
} else {
w3_writable_error(WP_CONTENT_DIR . '/advanced-cache.php');
}
}
$this->schedule();
}
示例4: activate
/**
* Activate plugin action (called by W3_PluginProxy)
*/
function activate()
{
require_once W3TC_INC_DIR . '/functions/activation.php';
if (!$this->locked() && !@copy(W3TC_INSTALL_FILE_OBJECT_CACHE, W3TC_ADDIN_FILE_OBJECT_CACHE)) {
w3_writable_error(W3TC_ADDIN_FILE_OBJECT_CACHE);
}
$this->schedule();
}
示例5: activate
/**
* Activate plugin action
*/
function activate()
{
if (!$this->locked()) {
$file_db = WP_CONTENT_DIR . '/db.php';
if (@copy(W3TC_INSTALL_DIR . '/db.php', $file_db)) {
@chmod($file_db, 0644);
} else {
w3_writable_error($file_db);
}
}
$this->schedule();
}
示例6: activate
/**
* Activate plugin action
*/
function activate()
{
require_once W3TC_INC_DIR . '/functions/activation.php';
if (!@is_dir(W3TC_CONTENT_MINIFY_DIR) && !@mkdir(W3TC_CONTENT_MINIFY_DIR)) {
w3_writable_error(W3TC_CONTENT_MINIFY_DIR);
}
$file_index = W3TC_CONTENT_MINIFY_DIR . '/index.php';
if (!@copy(W3TC_INSTALL_MINIFY_DIR . '/index.php', $file_index)) {
w3_writable_error($file_index);
}
if ($this->_config->get_boolean('minify.enabled') && $this->_config->get_boolean('minify.rewrite')) {
if (w3_can_modify_rules(w3_get_minify_rules_core_path())) {
$this->write_rules_core();
}
if ($this->_config->get_string('minify.engine') == 'file' && w3_can_modify_rules(w3_get_minify_rules_cache_path())) {
$this->write_rules_cache();
}
}
$this->schedule();
}
示例7: activate
/**
* Activate plugin action
*/
function activate()
{
if (!is_dir(W3TC_CONTENT_MINIFY_DIR)) {
if (@mkdir(W3TC_CONTENT_MINIFY_DIR, 0755)) {
@chmod(W3TC_CONTENT_MINIFY_DIR, 0755);
} else {
w3_writable_error(W3TC_CONTENT_MINIFY_DIR);
}
}
$file_index = W3TC_CONTENT_MINIFY_DIR . '/index.php';
if (@copy(W3TC_INSTALL_MINIFY_DIR . '/index.php', $file_index)) {
@chmod($file_index, 0644);
} else {
w3_writable_error($file_index);
}
if ($this->_config->get_boolean('minify.rewrite') && !$this->write_rules()) {
w3_writable_error(W3TC_CONTENT_MINIFY_DIR . '/.htaccess');
}
$this->schedule();
}
示例8: activate
/**
* Activation action
*/
function activate()
{
global $wpdb;
$upload_info = w3_upload_info();
if (!$upload_info) {
$upload_path = get_option('upload_path');
$upload_path = trim($upload_path);
if (empty($upload_path)) {
echo 'Your store uploads folder is not available. Default WordPress directories will be created: <strong>wp-content/uploads/</strong>.<br />';
$upload_path = WP_CONTENT_DIR . '/uploads';
}
w3_writable_error($upload_path);
}
$sql = sprintf('DROP TABLE IF EXISTS `%s%s`', $wpdb->prefix, W3TC_CDN_TABLE_QUEUE);
$wpdb->query($sql);
$sql = sprintf("CREATE TABLE IF NOT EXISTS `%s%s` (\r\n `id` int(11) unsigned NOT NULL AUTO_INCREMENT,\r\n `local_path` varchar(150) NOT NULL DEFAULT '',\r\n `remote_path` varchar(150) NOT NULL DEFAULT '',\r\n `command` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '1 - Upload, 2 - Delete',\r\n `last_error` varchar(150) NOT NULL DEFAULT '',\r\n `date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',\r\n PRIMARY KEY (`id`),\r\n UNIQUE KEY `path` (`local_path`, `remote_path`),\r\n KEY `date` (`date`)\r\n ) /*!40100 CHARACTER SET latin1 */", $wpdb->prefix, W3TC_CDN_TABLE_QUEUE);
$wpdb->query($sql);
if (!$wpdb->result) {
$error = sprintf('Unable to create table <strong>%s%s</strong>: %s', $wpdb->prefix, W3TC_CDN_TABLE_QUEUE, $wpdb->last_error);
w3_activate_error($error);
}
$this->schedule();
}
示例9: activate
/**
* Activate plugin action
*
* @return void
*/
function activate()
{
require_once W3TC_INC_DIR . '/functions/activation.php';
/**
* Disable buggy sitewide activation in WPMU and WP 3.0
*/
if (w3_is_wpmu() && isset($_GET['sitewide']) || w3_is_multisite() && isset($_GET['networkwide'])) {
w3_network_activate_error();
}
/**
* Check installation files
*/
$files = array(W3TC_INSTALL_FILE_ADVANCED_CACHE, W3TC_INSTALL_FILE_DB, W3TC_INSTALL_FILE_OBJECT_CACHE);
$nonexistent_files = array();
foreach ($files as $file) {
if (!file_exists($file)) {
$nonexistent_files[] = $file;
}
}
if (count($nonexistent_files)) {
$error = sprintf('Unfortunately core file(s): (<strong>%s</strong>) are missing, so activation will fail. Please re-start the installation process from the beginning.', implode(', ', $nonexistent_files));
w3_activate_error($error);
}
if (!@is_dir(W3TC_CONTENT_DIR) && !@mkdir(W3TC_CONTENT_DIR)) {
w3_writable_error(W3TC_CONTENT_DIR);
}
if (!@is_dir(W3TC_CACHE_FILE_DBCACHE_DIR) && !@mkdir(W3TC_CACHE_FILE_DBCACHE_DIR)) {
w3_writable_error(W3TC_CACHE_FILE_DBCACHE_DIR);
}
if (!@is_dir(W3TC_CACHE_FILE_OBJECTCACHE_DIR) && !@mkdir(W3TC_CACHE_FILE_OBJECTCACHE_DIR)) {
w3_writable_error(W3TC_CACHE_FILE_OBJECTCACHE_DIR);
}
if (!@is_dir(W3TC_CACHE_FILE_PGCACHE_DIR) && !@mkdir(W3TC_CACHE_FILE_PGCACHE_DIR)) {
w3_writable_error(W3TC_CACHE_FILE_PGCACHE_DIR);
}
if (!@is_dir(W3TC_CACHE_FILE_MINIFY_DIR) && !@mkdir(W3TC_CACHE_FILE_MINIFY_DIR)) {
w3_writable_error(W3TC_CACHE_FILE_MINIFY_DIR);
}
if (!@is_dir(W3TC_LOG_DIR) && !@mkdir(W3TC_LOG_DIR)) {
w3_writable_error(W3TC_LOG_DIR);
}
if (!@is_dir(W3TC_TMP_DIR) && !@mkdir(W3TC_TMP_DIR)) {
w3_writable_error(W3TC_TMP_DIR);
}
if (w3_is_network() && file_exists(W3TC_CONFIG_MASTER_PATH)) {
/**
* For multisite load master config
*/
$this->_config->load_master();
if (!$this->_config->save(false)) {
w3_writable_error(W3TC_CONFIG_PATH);
}
} elseif (!file_exists(W3TC_CONFIG_PATH)) {
/**
* Set default settings
*/
$this->_config->set_defaults();
/**
* If config doesn't exist enable preview mode
*/
if (!$this->_config->save(true)) {
w3_writable_error(W3TC_CONFIG_PREVIEW_PATH);
}
}
/**
* Save blognames into file
*/
if (w3_is_network() && !w3_is_subdomain_install()) {
if (!w3_save_blognames()) {
w3_writable_error(W3TC_BLOGNAMES_PATH);
}
}
delete_option('w3tc_request_data');
add_option('w3tc_request_data', '', null, 'no');
}
示例10: activate
/**
* Activate plugin action
*/
function activate()
{
if (!is_dir(W3TC_CONTENT_DIR)) {
if (@mkdir(W3TC_CONTENT_DIR, 0755)) {
@chmod(W3TC_CONTENT_DIR, 0755);
} else {
w3_writable_error(W3TC_CONTENT_DIR);
}
}
if (!is_dir(W3TC_CACHE_FILE_DBCACHE_DIR)) {
if (@mkdir(W3TC_CACHE_FILE_DBCACHE_DIR, 0755)) {
@chmod(W3TC_CACHE_FILE_DBCACHE_DIR, 0755);
} else {
w3_writable_error(W3TC_CACHE_FILE_DBCACHE_DIR);
}
}
if (!is_dir(W3TC_CACHE_FILE_PGCACHE_DIR)) {
if (@mkdir(W3TC_CACHE_FILE_PGCACHE_DIR, 0755)) {
@chmod(W3TC_CACHE_FILE_PGCACHE_DIR, 0755);
} else {
w3_writable_error(W3TC_CACHE_FILE_PGCACHE_DIR);
}
}
if (!is_dir(W3TC_CACHE_FILE_MINIFY_DIR)) {
if (@mkdir(W3TC_CACHE_FILE_MINIFY_DIR, 0755)) {
@chmod(W3TC_CACHE_FILE_MINIFY_DIR, 0755);
} else {
w3_writable_error(W3TC_CACHE_FILE_MINIFY_DIR);
}
}
if (!is_dir(W3TC_LOG_DIR)) {
if (@mkdir(W3TC_LOG_DIR, 0755)) {
@chmod(W3TC_LOG_DIR, 0755);
} else {
w3_writable_error(W3TC_LOG_DIR);
}
}
if (!is_dir(W3TC_TMP_DIR)) {
if (@mkdir(W3TC_TMP_DIR, 0755)) {
@chmod(W3TC_TMP_DIR, 0755);
} else {
w3_writable_error(W3TC_TMP_DIR);
}
}
if (!$this->_config->get_integer('common.install')) {
$this->_config->set('common.install', time());
}
if (w3_is_wpmu()) {
$this->_config->load_master();
}
if (!$this->_config->save()) {
w3_writable_error(W3TC_CONFIG_PATH);
}
delete_option('w3tc_request_data');
add_option('w3tc_request_data', '', null, 'no');
$this->link_update();
}