/**
* Copyright (C) 2014-2023 ServMask Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
*/
if ( ! defined( 'ABSPATH' ) ) {
die( 'Kangaroos cannot jump here' );
}
class Ai1wmve_Reset_Media {
public static function execute( $params ) {
// Skip reset step
if ( ! isset( $params['ai1wm_reset_media'] ) ) {
return $params;
}
// Flag to hold if file data has been processed
$completed = true;
// Start time
$start = microtime( true );
// Iterate over content directory
$iterator = new Ai1wm_Recursive_Directory_Iterator( ai1wm_get_uploads_dir() );
// Recursively iterate over directory
$iterator = new Ai1wm_Recursive_Iterator_Iterator( $iterator, RecursiveIteratorIterator::CHILD_FIRST, RecursiveIteratorIterator::CATCH_GET_CHILD );
// Get media files
foreach ( $iterator as $item ) {
if ( $item->isDir() ) {
@rmdir( $item->getPathname() );
} else {
@unlink( $item->getPathname() );
}
// More than 10 seconds have passed, break and do another request
if ( ( $timeout = apply_filters( 'ai1wm_completed_timeout', 10 ) ) ) {
if ( ( microtime( true ) - $start ) > $timeout ) {
$completed = false;
break;
}
}
}
if ( is_multisite() ) {
foreach ( ai1wmme_get_sites() as $site ) {
static::delete_media_from_db( $site['BlogID'] );
}
} else {
static::delete_media_from_db();
}
if ( $completed ) {
// Set progress
if ( ! isset( $params['ai1wm_reset_plugins'], $params['ai1wm_reset_themes'], $params['ai1wm_reset_media'], $params['ai1wm_reset_database'] ) ) {
$message = __( 'The reset of your media files has been successfully completed. Your site\'s media library is now empty, and you can start afresh with new uploads.', AI1WM_PLUGIN_NAME );
if ( defined( 'WP_CLI' ) && WP_CLI ) {
WP_CLI::success( $message );
} else {
Ai1wm_Status::done( __( 'Reset Successful' ), $message );
}
exit;
}
// Unset completed flag
unset( $params['completed'] );
} else {
// Set completed flag
$params['completed'] = $completed;
}
return $params;
}
protected static function delete_media_from_db( $blog_id = null ) {
global $wpdb;
$wpdb->query( sprintf( "DELETE FROM `%s` WHERE `post_type` = 'attachment'", ai1wm_table_prefix( $blog_id ) . 'posts' ) );
$wpdb->query( sprintf( "DELETE FROM `%s` WHERE `meta_key` = '_wp_attached_file' OR `meta_key` = '_wp_attachment_metadata'", ai1wm_table_prefix( $blog_id ) . 'postmeta' ) );
}
}
1.0A1 Cashbackhttps://a1cashback.phmedia.dev/en/adminhttps://a1cashback.phmedia.dev/en/author/pixeldev/Privacy policy - A1 Cashbackrich600338<blockquote class="wp-embedded-content" data-secret="Dv35LoKB93"><a href="https://a1cashback.phmedia.dev/en/privacy-policy/">Privacy policy</a></blockquote><iframe sandbox="allow-scripts" security="restricted" src="https://a1cashback.phmedia.dev/en/privacy-policy/embed/#?secret=Dv35LoKB93" width="600" height="338" title="“Privacy policy” — A1 Cashback" data-secret="Dv35LoKB93" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" class="wp-embedded-content"></iframe><script>
/*! This file is auto-generated */
!function(d,l){"use strict";l.querySelector&&d.addEventListener&&"undefined"!=typeof URL&&(d.wp=d.wp||{},d.wp.receiveEmbedMessage||(d.wp.receiveEmbedMessage=function(e){var t=e.data;if((t||t.secret||t.message||t.value)&&!/[^a-zA-Z0-9]/.test(t.secret)){for(var s,r,n,a=l.querySelectorAll('iframe[data-secret="'+t.secret+'"]'),o=l.querySelectorAll('blockquote[data-secret="'+t.secret+'"]'),c=new RegExp("^https?:$","i"),i=0;i<o.length;i++)o[i].style.display="none";for(i=0;i<a.length;i++)s=a[i],e.source===s.contentWindow&&(s.removeAttribute("style"),"height"===t.message?(1e3<(r=parseInt(t.value,10))?r=1e3:~~r<200&&(r=200),s.height=r):"link"===t.message&&(r=new URL(s.getAttribute("src")),n=new URL(t.value),c.test(n.protocol))&&n.host===r.host&&l.activeElement===s&&(d.top.location.href=t.value))}},d.addEventListener("message",d.wp.receiveEmbedMessage,!1),l.addEventListener("DOMContentLoaded",function(){for(var e,t,s=l.querySelectorAll("iframe.wp-embedded-content"),r=0;r<s.length;r++)(t=(e=s[r]).getAttribute("data-secret"))||(t=Math.random().toString(36).substring(2,12),e.src+="#?secret="+t,e.setAttribute("data-secret",t)),e.contentWindow.postMessage({message:"ready",secret:t},"*")},!1)))}(window,document);
//# sourceURL=https://a1cashback.phmedia.dev/wp-includes/js/wp-embed.min.js
</script>
Privacy policy Thank you for choosing A1 Cash Back (“we,” “our,” “us”). The privacy of your personal information is important to us. This Privacy Policy explains how we collect, use, disclose, and protect your personal information when you use our online services, including our website and online lending platform (collectively, the “Services”). By using our […]