HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux aritmodecarnaval.es 5.15.0-79-generic #86-Ubuntu SMP Mon Jul 10 16:07:21 UTC 2023 x86_64
User: www-data (33)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /home/www/aritmodecarnaval/wp-content/plugins/photo-gallery/admin/models/Uninstall.php
<?php

/**
 * Class UninstallModel_bwg
 */
class UninstallModel_bwg {
  /**
   * Delete images folder.
   */
  public function delete_folder() {
    if ( isset($_POST['bwg_delete_files']) ) {
      function delfiles($del_file) {
        if (is_dir($del_file)) {
          $del_folder = scandir($del_file);
          foreach ($del_folder as $file) {
            if ($file != '.' and $file != '..') {
              delfiles($del_file . '/' . $file);
            }
          }
          rmdir($del_file);
        }
        else {
          unlink($del_file);
        }
      }

      if (BWG()->upload_dir) {
        if (is_dir(BWG()->upload_dir)) {
          delfiles(BWG()->upload_dir);
        }
      }
    }
  }

  /**
   * Delete DB tables and other data.
   */
  public function delete_db_tables($params) {
    global $wpdb;
    // Delete terms.
    $terms = get_terms('bwg_tag', array( 'orderby' => 'count', 'hide_empty' => 0 ));
    foreach ( $terms as $term ) {
      wp_delete_term($term->term_id, 'bwg_tag');
    }
    // Delete custom pages for galleries.
    $posts = get_posts(array( 'posts_per_page' => -1, 'post_type' => 'bwg_gallery' ));
    foreach ( $posts as $post ) {
      wp_delete_post($post->ID, TRUE);
    }
    // Delete custom pages for albums.
    $posts = get_posts(array( 'posts_per_page' => -1, 'post_type' => 'bwg_album' ));
    foreach ( $posts as $post ) {
      wp_delete_post($post->ID, TRUE);
    }
    // Delete custom pages for tags.
    $posts = get_posts(array( 'posts_per_page' => -1, 'post_type' => 'bwg_tag' ));
    foreach ( $posts as $post ) {
      wp_delete_post($post->ID, TRUE);
    }
    // Delete custom pages for share.
    $posts = get_posts(array( 'posts_per_page' => -1, 'post_type' => 'bwg_share' ));
    foreach ( $posts as $post ) {
      wp_delete_post($post->ID, TRUE);
    }
    foreach ( $params['tables'] as $table ) {
      $wpdb->query("DROP TABLE IF EXISTS `" . $table . "`");
    }
    delete_option("wd_bwg_version");
    delete_option("bwg_subscribe_done");
    delete_option("wd_bwg_options");
    delete_user_meta(get_current_user_id(), 'bwg_photo_gallery');
    if ( isset($_COOKIE['bwg_image_asc_or_desc']) ) {
      $_COOKIE['bwg_image_asc_or_desc'] = '';
    }
    if ( isset($_COOKIE['bwg_image_order_by']) ) {
      $_COOKIE['bwg_image_order_by'] = '';
    }
  }
}