- Theme: momentry (custom theme with REST API routes) - Plugins: code-snippets (contains all API proxies) - Languages: zh_TW translations - Excludes: cache, backups, uploads, logs
106 lines
3.7 KiB
PHP
106 lines
3.7 KiB
PHP
<?php
|
|
/**
|
|
* Copyright (C) 2014-2025 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 <http://www.gnu.org/licenses/>.
|
|
*
|
|
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
|
*
|
|
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
|
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
|
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
|
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
|
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
|
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
|
*/
|
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
die( 'Kangaroos cannot jump here' );
|
|
}
|
|
|
|
class Ai1wm_File_Webconfig {
|
|
|
|
/**
|
|
* Create backups web.config file
|
|
*
|
|
* @param string $path Path to file
|
|
* @return boolean
|
|
*/
|
|
public static function backups( $path ) {
|
|
return Ai1wm_File::create(
|
|
$path,
|
|
implode(
|
|
PHP_EOL,
|
|
array(
|
|
'<?xml version="1.0" encoding="utf-8"?>',
|
|
'<configuration>',
|
|
' <system.webServer>',
|
|
' <staticContent>',
|
|
' <mimeMap fileExtension=".wpress" mimeType="application/octet-stream" />',
|
|
' </staticContent>',
|
|
' <defaultDocument>',
|
|
' <files>',
|
|
' <add value="index.php" />',
|
|
' </files>',
|
|
' </defaultDocument>',
|
|
' <directoryBrowse enabled="false" />',
|
|
' </system.webServer>',
|
|
'</configuration>',
|
|
)
|
|
)
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Create storage web.config file
|
|
*
|
|
* @param string $path Path to file
|
|
* @return boolean
|
|
*/
|
|
public static function storage( $path ) {
|
|
return Ai1wm_File::create(
|
|
$path,
|
|
implode(
|
|
PHP_EOL,
|
|
array(
|
|
'<?xml version="1.0" encoding="utf-8"?>',
|
|
'<configuration>',
|
|
' <system.webServer>',
|
|
' <security>',
|
|
' <authorization>',
|
|
' <deny users="*" />',
|
|
' </authorization>',
|
|
' </security>',
|
|
' <requestFiltering>',
|
|
' <fileExtensions allowUnlisted="false">',
|
|
' <add fileExtension=".log" allowed="true" />',
|
|
' </fileExtensions>',
|
|
' </requestFiltering>',
|
|
' <staticContent>',
|
|
' <mimeMap fileExtension=".log" mimeType="text/plain" />',
|
|
' </staticContent>',
|
|
' <defaultDocument>',
|
|
' <files>',
|
|
' <add value="index.php" />',
|
|
' </files>',
|
|
' </defaultDocument>',
|
|
' <directoryBrowse enabled="false" />',
|
|
' </system.webServer>',
|
|
'</configuration>',
|
|
)
|
|
)
|
|
);
|
|
}
|
|
}
|