Файловый менеджер - Редактировать - /var/www/xthruster/html/wp-content/uploads/flags/class-wpml-media-file.php.tar
Назад
var/www/xthruster/html/wp-content/plugins/wpml-media-translation/classes/class-wpml-media-file.php 0000644 00000003367 14721643212 0027600 0 ustar 00 <?php class WPML_Media_File { /** * @var int */ private $attachment_id; /** * @var WP_Filesystem_Base */ private $wp_filesystem; /** * @var wpdb */ private $wpdb; public function __construct( $attachment_id, WP_Filesystem_Base $wp_filesystem, wpdb $wpdb ) { $this->wp_filesystem = $wp_filesystem; $this->attachment_id = $attachment_id; $this->wpdb = $wpdb; } public function delete() { $relative_file_path = get_post_meta( $this->attachment_id, '_wp_attached_file', true ); if ( $relative_file_path && ! $this->file_is_shared( $relative_file_path, $this->attachment_id ) ) { $file_path = $this->get_full_file_upload_path( $relative_file_path ); $this->wp_filesystem->delete( $file_path, false, 'f' ); $attachment_meta_data = wp_get_attachment_metadata( $this->attachment_id ); if ( $attachment_meta_data && isset( $attachment_meta_data['file'] ) ) { $subdir = dirname( $attachment_meta_data['file'] ); foreach ( $attachment_meta_data['sizes'] as $key => $size ) { $file_path = $this->get_full_file_upload_path( $subdir . '/' . $size['file'] ); $this->wp_filesystem->delete( $file_path, false, 'f' ); } } } } private function get_full_file_upload_path( $relative_file_path ) { $upload_dir = wp_upload_dir(); $relative_file_path = trim( $relative_file_path, ' /' ); $file_path = $upload_dir['basedir'] . '/' . $relative_file_path; return $file_path; } private function file_is_shared( $relative_file_path, $attachment_id ) { $sql = "SELECT post_id FROM {$this->wpdb->postmeta} WHERE post_id <> %d AND meta_key='_wp_attached_file' AND meta_value=%s"; return $this->wpdb->get_var( $this->wpdb->prepare( $sql, $attachment_id, $relative_file_path ) ); } }
| ver. 1.4 |
Github
|
.
| PHP 7.4.3-4ubuntu2.24 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка