Patchstack File Permission Error
' . implode( '
', $files ), 'patchstack' ); ?>
Debug info: ' . $file . ' chmod permissions:
' . substr( decoct( fileperms( $file ) ), -3 ) . ', owned by
' . posix_getpwuid( fileowner( $file ) )['name'] . '', $this->allowed_html );
}
?>
How to fix?
CHMOD the file/folder to 755 through a FTP client, CPanel, WHM or ask your hosting provider. Make sure file or folder ownership is set to ' . posix_getpwuid( fileowner( ABSPATH . 'index.php' ) )['name'] . ' user .', 'patchstack_file_error_notice' ); ?>
CHMOD properly set but still not working?
Make sure the group/owner (chown) settings of the /wp-content/plugins/patchstack/ folder is properly setup, you may have to ask your host to fix this.', 'patchstack_file_error_notice' ); ?>
plugin->rules->post_firewall_rules();
$this->plugin->rules->dynamic_firewall_rules();
// Update firewall status after settings saved
$token = $this->plugin->api->get_access_token();
// Update the firewall status.
if ( ! empty( $token ) ) {
$this->plugin->api->update_firewall_status( [ 'status' => $this->get_option( 'patchstack_basic_firewall' ) == 1 ] );
}
}
}
/**
* When the user updates the site URL, update it on the API side as well.
* This needs to be done so we can communicate with the site properly.
*
* @param mixed $old_value
* @param mixed $new_value
* @return void
*/
public function update_option_url( $old_value, $new_value ) {
if ( $old_value != $new_value ) {
$this->plugin->api->update_url( [ 'plugin_url' => $new_value ] );
}
}
/**
* Executed when the user modifies the blocked or whitelisted IP addresses on the
* login protection settings page.
*
* @return void
*/
public function alter_ips() {
if ( ! isset( $_GET['action'], $_GET['PatchstackNonce'] ) || ! wp_verify_nonce( $_GET['PatchstackNonce'], 'patchstack-nonce-alter-ips' ) || ! current_user_can( 'administrator' ) || ! in_array( $_GET['action'], [ 'patchstack_unblock', 'patchstack_unblock_whitelist', 'patchstack_whitelist' ] ) ) {
return;
}
global $wpdb;
// Unblock the IP; delete the logs of the IP.
if ( $_GET['action'] == 'patchstack_unblock' && isset( $_GET['id'] ) && ctype_digit( $_GET['id'] ) ) {
// First get the IP address to unblock.
$result = $wpdb->get_results(
$wpdb->prepare( 'SELECT ip FROM ' . $wpdb->prefix . 'patchstack_event_log WHERE id = %d', [ (int) $_GET['id'] ] )
);
// Unblock the IP address.
if ( isset( $result[0], $result[0]->ip ) ) {
$wpdb->query(
$wpdb->prepare( 'DELETE FROM ' . $wpdb->prefix . 'patchstack_event_log WHERE ip = %s', [ $result[0]->ip ] )
);
}
}
// Unblock and whitelist the IP.
if ( $_GET['action'] == 'patchstack_unblock_whitelist' && isset( $_GET['id'] ) && ctype_digit( $_GET['id'] ) ) {
// First get the IP address to whitelist.
$result = $wpdb->get_results(
$wpdb->prepare( 'SELECT ip FROM ' . $wpdb->prefix . 'patchstack_event_log WHERE id = %d', [ (int) $_GET['id'] ] )
);
// Whitelist and unblock the IP address.
if ( isset( $result[0], $result[0]->ip ) && filter_var( $result[0]->ip, FILTER_VALIDATE_IP ) ) {
update_option( 'patchstack_login_whitelist', $this->get_option( 'patchstack_login_whitelist', '' ) . "\n" . $result[0]->ip );
$wpdb->query(
$wpdb->prepare( 'DELETE FROM ' . $wpdb->prefix . 'patchstack_event_log WHERE ip = %s', [ $result[0]->ip ] )
);
}
}
// Whitelist an IP address.
if ( $_GET['action'] == 'patchstack_whitelist' && isset( $_GET['ip'] ) && filter_var( $_GET['ip'], FILTER_VALIDATE_IP ) ) {
update_option( 'patchstack_login_whitelist', $this->get_option( 'patchstack_login_whitelist', '' ) . "\n" . $_GET['ip'] );
}
// Redirect the user back to the login tab.
wp_safe_redirect( admin_url( 'admin.php?page=' . $this->plugin->name . '&tab=login' ) );
exit;
}
/**
* Turn on the Patchstack settings feature on WordPress.
*
* @return void
*/
public function enable_settings() {
if ( ! isset( $_GET['action'], $_GET['patchstack_settings_nonce'] ) || ! wp_verify_nonce( $_GET['patchstack_settings_nonce'], 'patchstack_settings_nonce' ) || ! current_user_can( 'administrator' ) || $_GET['action'] != 'enable_settings' ) {
return;
}
// Turn it on.
update_option( 'patchstack_show_settings', 1 );
// Redirect the user back to the license page.
wp_safe_redirect( admin_url( 'admin.php?page=' . $this->plugin->name ) );
exit;
}
}