🗂️ File Manager Pro
🖥️ Tipo de Hospedagem:
Vps
📁 Diretório Raiz:
/home
🌐 Servidor:
www.apm-abl.com
👤 Usuário:
apmablcosr
🔐 Sessão:
🔑 Credenciais:
adm_a4f93500 / 6fce****
📍 Localização Atual:
home
Caminho completo: /home
📤 Enviar Arquivo
📁 Nova Pasta
⬆️ Voltar
🏠 Raiz
🗑️ DELETAR
📦 ZIPAR/DEZIPAR
Status
Nome
Tamanho
Modificado
Permissões
Ações
📁 a
-
03/02/2026 22:15
0755
✏️
📁 apmablcosr
-
26/01/2026 16:35
0705
✏️
🗑️
Editando: Tests.tar
TestInterface.php 0000604 00000000423 15136251131 0010006 0 ustar 00 <?php namespace Duplicator\Installer\Utils\Tests; interface TestInterface { /** * @return bool true on success */ public static function preTestPrepare(); /** * @return bool true on success */ public static function afterTestClean(); } WP/tests_template.php 0000604 00000010566 15136251131 0010642 0 ustar 00 <?php namespace Duplicator\Installer\Utils\Tests\WP; use Duplicator\Installer\Utils\Autoloader; use Duplicator\Libs\Snap\SnapUtil; use Duplicator\Installer\Utils\Tests\MessageCustomizer; use DUPX_NOTICE_ITEM; use DUPX_NOTICE_MANAGER; use Exception; // phpcs:disable die(); // [REMOVE LINE BY SCRIPT] don't remove/change this ********************************* if (!defined('DUPXABSPATH')) { define('DUPXABSPATH', dirname(__FILE__)); } if (!defined('DUPX_INIT')) { define('DUPX_INIT', '$_$_DUPX_INIT_$_$'); } // phpcs:enable require_once(DUPX_INIT . '/src/Utils/Autoloader.php'); Autoloader::register(); require_once(DUPX_INIT . '/classes/utilities/class.u.notices.manager.php'); $GLOBALS["NOTICES_FILE_PATH"] = '$_$_NOTICES_FILE_PATH_$_$'; $GLOBALS["TEST_SCRIPT"] = SnapUtil::filterInputDefaultSanitizeString(INPUT_GET, 'dpro_test_script_name'); ob_start(); TestsErrorHandler::register(); TestsErrorHandler::setShutdownCallabck(function ($errors) { $nManager = DUPX_NOTICE_MANAGER::getInstance(); $scriptName = basename($GLOBALS["TEST_SCRIPT"]); $scriptNameId = str_replace(array('.', '-', '#'), '_', $scriptName); $firstFatal = true; $firstNotice = true; switch ($scriptName) { case 'index.php': $shortMessageFatal = 'Fatal error on WordPress front-end tests!'; $shortMessageNotice = 'Warnings or notices on WordPress front-end tests!'; $fatalErrorLevel = DUPX_NOTICE_ITEM::CRITICAL; break; case 'wp-login.php': $shortMessageFatal = 'Fatal error on WordPress login tests!'; $shortMessageNotice = 'Warnings or notices on WordPress backend tests!'; $fatalErrorLevel = DUPX_NOTICE_ITEM::FATAL; break; default: $shortMessageFatal = 'Fatal error on php script ' . $scriptName; $shortMessageNotice = 'Warnings or notices on php script ' . $scriptName; $fatalErrorLevel = DUPX_NOTICE_ITEM::CRITICAL; break; } foreach ($errors as $error) { $addBeforeNotice = false; switch ($error['error_cat']) { case TestsErrorHandler::ERR_TYPE_ERROR: $noticeId = 'wptest_fatal_error_' . $scriptNameId; $errorLevel = $fatalErrorLevel; $shortMessage = $shortMessageFatal; if ($firstFatal) { $addBeforeNotice = true; $firstFatal = false; } break; case TestsErrorHandler::ERR_TYPE_NOTICE: case TestsErrorHandler::ERR_TYPE_DEPRECATED: case TestsErrorHandler::ERR_TYPE_WARNING: default: $noticeId = 'wptest_notice_' . $scriptNameId; $errorLevel = DUPX_NOTICE_ITEM::NOTICE; $shortMessage = $shortMessageNotice; if ($firstNotice) { $addBeforeNotice = true; $firstNotice = false; } break; } if ($addBeforeNotice) { $longMessage = 'SCRIPT FILE TEST: ' . $GLOBALS["TEST_SCRIPT"] . "\n\n"; } else { $longMessage = ''; } $longMessage .= TestsErrorHandler::errorToString($error) . "\n-----\n\n"; $longMessage .= "For solutions to these issues see the online FAQs \nhttps://duplicator.com/knowledge-base/ \n\n"; MessageCustomizer::applyAllNoticeCustomizations($shortMessage, $longMessage, $noticeId); $data = array( 'shortMsg' => $shortMessage, 'level' => $errorLevel, 'longMsgMode' => DUPX_NOTICE_ITEM::MSG_MODE_PRE, 'longMsg' => $longMessage, 'sections' => 'general' ); if ($errorLevel == DUPX_NOTICE_ITEM::FATAL) { $nManager->addBothNextAndFinalReportNotice($data, DUPX_NOTICE_MANAGER::ADD_UNIQUE_APPEND, $noticeId); } else { $nManager->addFinalReportNotice($data, DUPX_NOTICE_MANAGER::ADD_UNIQUE_APPEND, $noticeId); } } if ($nManager->saveNotices()) { echo json_encode(true); } else { echo json_encode(false); } }); $_SERVER['REQUEST_URI'] = '/'; if (file_exists($GLOBALS["TEST_SCRIPT"])) { require_once($GLOBALS["TEST_SCRIPT"]); } else { throw new Exception('test script file ' . $GLOBALS["TEST_SCRIPT"] . ' doesn\'t exist'); } WP/TestsErrorHandler.php 0000604 00000020167 15136251131 0011215 0 ustar 00 <?php /** * Error handler for test scripts * ******************* * IMPORTANT * Don\'t use snap lib functions o other duplicator functions * ******************* * * Standard: PSR-2 * * @link http://www.php-fig.org/psr/psr-2 Full Documentation * * @package SC\DUPX\U */ namespace Duplicator\Installer\Utils\Tests\WP; class TestsErrorHandler { const ERR_TYPE_ERROR = 'error'; const ERR_TYPE_WARNING = 'warning'; const ERR_TYPE_NOTICE = 'notice'; const ERR_TYPE_DEPRECATED = 'deprecated'; const ERRNO_EXCEPTION = 1073741824; // 31 pos of bit mask protected static $errors = array(); /** * If it is null a json is displayed otherwise the callback function is executed in the shutd * * @var null| callable */ protected static $shutdownCallback = null; /** * register error handlers * * @return void */ public static function register() { @register_shutdown_function(array(__CLASS__, 'shutdown')); @set_error_handler(array(__CLASS__, 'error')); @set_exception_handler(array(__CLASS__, 'exception')); } /** * @param callable $callback shutdown callback * * @return void */ public static function setShutdownCallabck($callback) { if (is_callable($callback)) { self::$shutdownCallback = $callback; } else { self::$shutdownCallback = null; } } /** * add error on list * * @param int $errno error number * @param string $errstr error string * @param string $errfile error file * @param int $errline error line * @param array $trace error trace * * @return void */ protected static function addError($errno, $errstr, $errfile, $errline, $trace) { $newError = array( 'error_cat' => self::getErrorCategoryFromErrno($errno), 'errno' => $errno, 'errno_str' => self::errnoToString($errno), 'errstr' => $errstr, 'errfile' => $errfile, 'errline' => $errline, 'trace' => array_map(array(__CLASS__, 'normalizeTraceElement'), $trace) ); self::$errors[] = $newError; if (function_exists('error_clear_last')) { error_clear_last(); } } /** * @param array $error the error array * * @return string human-readable error message with trace */ public static function errorToString($error) { $result = $error['errno_str'] . ' ' . $error['errstr'] . "\n"; $result .= "\t" . 'FILE: ' . $error['errfile'] . '[' . $error['errline'] . ']' . "\n"; $result .= "\t--- TRACE ---\n"; foreach ($error['trace'] as $trace) { $result .= "\t"; if (!empty($trace['class'])) { $result .= str_pad('CLASS___: ' . $trace['class'] . $trace['type'] . $trace['function'], 40, ' '); } else { $result .= str_pad('FUNCTION: ' . $trace['function'], 40, ' '); } $result .= 'FILE: ' . $trace['file'] . '[' . $trace['line'] . ']' . "\n"; } return $result; } /** * Error handler * * @param integer $errno Error level * @param string $errstr Error message * @param string $errfile Error file * @param integer $errline Error line * * @return void */ public static function error($errno, $errstr, $errfile, $errline) { $trace = debug_backtrace(); array_shift($trace); self::adderror($errno, $errstr, $errfile, $errline, $trace); } /** * Exception handler * * @param Exception|Error $e // Throwable in php 7 * * @return void */ public static function exception($e) { self::adderror(self::ERRNO_EXCEPTION, $e->getMessage(), $e->getFile(), $e->getLine(), $e->getTrace()); } /** * Shutdown handler * * @return void */ public static function shutdown() { self::obCleanAll(); if (($error = error_get_last())) { self::error($error['type'], $error['message'], $error['file'], $error['line']); } ob_end_clean(); if (is_callable(self::$shutdownCallback)) { call_user_func(self::$shutdownCallback, self::$errors); } else { echo json_encode(self::$errors); } // prevent other shutdown functions exit(); } /** * Close all buffers and return content * * @param bool $getContent If true it returns buffer content, otherwise it is discarded * * @return string */ protected static function obCleanAll($getContent = true) { $result = ''; for ($i = 0; $i < ob_get_level(); $i++) { if ($getContent) { $result .= ob_get_contents(); } ob_clean(); } return $result; } /** * @param array $elem normalize error element * * @return array */ public static function normalizeTraceElement($elem) { if (!is_array($elem)) { $elem = array(); } unset($elem['args']); unset($elem['object']); return array_merge(array( 'file' => '', 'line' => -1, 'function' => '', 'class' => '', 'type' => ''), $elem); } /** * * @param int $errno error number * * @return string */ public static function getErrorCategoryFromErrno($errno) { switch ($errno) { case E_PARSE: case E_ERROR: case E_CORE_ERROR: case E_COMPILE_ERROR: case E_USER_ERROR: case self::ERRNO_EXCEPTION: return self::ERR_TYPE_ERROR; case E_WARNING: case E_USER_WARNING: case E_COMPILE_WARNING: return self::ERR_TYPE_WARNING; case E_NOTICE: case E_USER_NOTICE: return self::ERR_TYPE_NOTICE; default: break; } if (defined('E_STRICT') && $errno === E_STRICT) { return self::ERR_TYPE_WARNING; } if (defined('E_RECOVERABLE_ERROR') && $errno === E_RECOVERABLE_ERROR) { return self::ERR_TYPE_WARNING; } if (defined('E_DEPRECATED') && $errno === E_DEPRECATED) { return self::ERR_TYPE_DEPRECATED; } if (defined('E_USER_DEPRECATED') && $errno === E_USER_DEPRECATED) { return self::ERR_TYPE_DEPRECATED; } return self::ERR_TYPE_WARNING; } /** * * @param int $errno error number * * @return string */ public static function errnoToString($errno) { switch ($errno) { case E_PARSE: return 'E_PARSE'; case E_ERROR: return 'E_ERROR'; case E_CORE_ERROR: return 'E_CORE_ERROR'; case E_COMPILE_ERROR: return 'E_COMPILE_ERROR'; case E_USER_ERROR: return 'E_USER_ERROR'; case E_WARNING: return 'E_WARNING'; case E_USER_WARNING: return 'E_USER_WARNING'; case E_COMPILE_WARNING: return 'E_COMPILE_WARNING'; case E_NOTICE: return 'E_NOTICE'; case E_USER_NOTICE: return 'E_USER_NOTICE'; case self::ERRNO_EXCEPTION: return 'EXCEPTION'; default: break; } if (defined('E_STRICT') && $errno === E_STRICT) { return 'E_STRICT'; } if (defined('E_RECOVERABLE_ERROR') && $errno === E_RECOVERABLE_ERROR) { return 'E_RECOVERABLE_ERROR'; } if (defined('E_DEPRECATED') && $errno === E_DEPRECATED) { return 'E_DEPRECATED'; } if (defined('E_USER_DEPRECATED') && $errno === E_USER_DEPRECATED) { return 'E_USER_DEPRECATED'; } return 'E_UNKNOWN CODE: ' . $errno; } } WP/TestsExecuter.php 0000604 00000010741 15136251131 0010407 0 ustar 00 <?php /** * plugin custom actions * * Standard: PSR-2 * * @link http://www.php-fig.org/psr/psr-2 Full Documentation * * @package SC\DUPX\U */ namespace Duplicator\Installer\Utils\Tests\WP; use Duplicator\Installer\Utils\Log\Log; use Duplicator\Installer\Core\Params\PrmMng; use Duplicator\Installer\Utils\Tests\TestInterface; use DUPX_NOTICE_ITEM; use DUPX_NOTICE_MANAGER; use DUPX_Security; class TestsExecuter implements TestInterface { const SCRIPT_NAME_HTTP_PARAM = 'dpro_test_script_name'; /** * @return bool true on success * @throws \Exception */ public static function preTestPrepare() { $nManager = DUPX_NOTICE_MANAGER::getInstance(); $scriptFilePath = self::getScriptTestPath(); Log::info('PREPARE FILE BEFORE TEST: ' . $scriptFilePath, Log::LV_DETAILED); if (file_put_contents($scriptFilePath, self::getExecFileContent()) === false) { $nManager->addFinalReportNotice(array( 'shortMsg' => 'Can\'t create final text script file', 'longMsg' => 'Can\'t create file ' . $scriptFilePath, 'longMsgMode' => DUPX_NOTICE_ITEM::MSG_MODE_DEFAULT, 'level' => DUPX_NOTICE_ITEM::HARD_WARNING, 'sections' => array('general'), )); return false; } return true; } /** * @return bool true on success * @throws \Exception */ public static function afterTestClean() { $nManager = DUPX_NOTICE_MANAGER::getInstance(); $scriptFilePath = self::getScriptTestPath(); Log::info('DELETE FILE AFTER TEST: ' . $scriptFilePath, Log::LV_DETAILED); if (file_exists($scriptFilePath)) { if (unlink($scriptFilePath) == false) { $nManager->addFinalReportNotice(array( 'shortMsg' => 'Can\'t deleta final text script file', 'longMsg' => 'Can\'t delete file ' . $scriptFilePath . '. Remove it manually', 'longMsgMode' => DUPX_NOTICE_ITEM::MSG_MODE_DEFAULT, 'level' => DUPX_NOTICE_ITEM::HARD_WARNING, 'sections' => array('general'), )); } } return true; } /** * @return string url of WP front-end * @throws \Exception */ public static function getFrontendUrl() { $indexPath = PrmMng::getInstance()->getValue(PrmMng::PARAM_PATH_NEW) . '/index.php'; $data = array( self::SCRIPT_NAME_HTTP_PARAM => $indexPath ); return self::getScriptTestUrl() . '?' . http_build_query($data); } /** * @return string url of WP back-end * @throws \Exception */ public static function getBackendUrl() { $indexPath = PrmMng::getInstance()->getValue(PrmMng::PARAM_PATH_WP_CORE_NEW) . '/wp-login.php'; $data = array( self::SCRIPT_NAME_HTTP_PARAM => $indexPath ); return self::getScriptTestUrl() . '?' . http_build_query($data); } /** * @return string test script name */ protected static function getScriptTestName() { return 'wp_test_script_' . DUPX_Security::getInstance()->getSecondaryPackageHash() . '.php'; } /** * @return string test script path * @throws \Exception */ public static function getScriptTestPath() { // use wp-content path and not root path return PrmMng::getInstance()->getValue(PrmMng::PARAM_PATH_CONTENT_NEW) . '/' . self::getScriptTestName(); } /** * @return string test script url * @throws \Exception */ public static function getScriptTestUrl() { // use wp-content path and not root path return PrmMng::getInstance()->getValue(PrmMng::PARAM_URL_CONTENT_NEW) . '/' . self::getScriptTestName(); } /** * @return string contents to be added to the test script file */ public static function getExecFileContent() { $result = file_get_contents(dirname(__FILE__) . '/tests_template.php'); $result = preg_replace('/^.*\[REMOVE LINE BY SCRIPT].*\n/m', '', $result); // remove first line with die return str_replace( array( '$_$_NOTICES_FILE_PATH_$_$', '$_$_DUPX_INIT_$_$' ), array( $GLOBALS["NOTICES_FILE_PATH"], DUPX_INIT ), $result ); } } MessageCustomizer.php 0000604 00000016774 15136251131 0010737 0 ustar 00 <?php /** * Customizes final report error messages * * Standard: PSR-2 * * @link http://www.php-fig.org/psr/psr-2 Full Documentation * * @package SC\DUPX\U */ namespace Duplicator\Installer\Utils\Tests; class MessageCustomizer { const CONTEXT_SHORT_MESSAGE = 'short'; const CONTEXT_LONG_MESSAGE = 'long'; const CONTEXT_NOTICE_ID = 'notice-id'; /** * Tries to apply each customization until one of them works * * @param string $shortMessage short message of notice to be customized * @param string $longMessage long message of notice to be customized * @param string $noticeId notice IDfinal-tests.php * * @return bool true if any of the customizations were applied, false otherwise */ public static function applyAllNoticeCustomizations(&$shortMessage, &$longMessage, &$noticeId) { foreach (self::getCustomizationItems() as $item) { if ($item->conditionSatisfied($longMessage)) { $shortMessage = $item->apply($shortMessage, self::CONTEXT_SHORT_MESSAGE); $longMessage = $item->apply($longMessage, self::CONTEXT_LONG_MESSAGE); $noticeId = $item->apply($noticeId, self::CONTEXT_NOTICE_ID); return true; } } return false; } /** * Get customization to apply at error messages * * @return MessageCustomizerItem[] customizations list * @throws \Exception */ protected static function getCustomizationItems() { $items = array(); $items[] = new MessageCustomizerItem( function ($string) { if (self::getArchiveConfigData() == false) { return false; } return preg_match("/undefined.*create_function/", $string) && version_compare(phpversion(), "8") >= 0 && version_compare(self::getArchiveConfigData()->version_php, "8") < 0; }, function ($string, $context) { if (self::getArchiveConfigData() == false) { return $string; } $phpVersionNew = self::getTwoLevelVersion(phpversion()); $phpVersionOld = self::getTwoLevelVersion(self::getArchiveConfigData()->version_php); $longMsgPrefix = "There is code in this site that is not compatible with PHP " . $phpVersionNew . ". " . "To make the install work you will either have to\ninstall on PHP " . $phpVersionOld . " or "; switch ($context) { case self::CONTEXT_SHORT_MESSAGE: return "Source site or plugins are incompatible with PHP " . $phpVersionNew; case self::CONTEXT_LONG_MESSAGE: if (($plugin = self::getProblematicPluginFromError($string)) !== false) { return $longMsgPrefix . "disable the plugin '{$plugin->name}' (slug: $plugin->slug) using a " . "file manager of your choice.\nSee full error message below: \n\n" . $string; } elseif (($theme = self::getProblematicThemeFromError($string)) !== false) { return $longMsgPrefix . "disable the theme '{$theme->themeName}' (slug: $theme->slug) using a " . "file manager of your choice.\nSee full error message below: \n\n" . $string; } else { return $longMsgPrefix . "manually modify the affected files mentioned in the error trace below: \n\n" . $string; } case self::CONTEXT_NOTICE_ID: return $string . '_php8'; } } ); return $items; } /** * Return the plugin that is causing the error message if present * * @param string $longMessage the long error message containing the error trace * * @return false|object object containing plugin info or false on failure */ protected static function getProblematicPluginFromError($longMessage) { if (($archiveConfig = self::getArchiveConfigData()) === false) { return false; } $oldMain = $archiveConfig->wpInfo->targetRoot; $oldMuPlugins = $archiveConfig->wpInfo->configs->realValues->originalPaths->muplugins; $oldPlugins = $archiveConfig->wpInfo->configs->realValues->originalPaths->plugins; $relativeMuPlugins = str_replace($oldMain, "", $oldMuPlugins); $relativePlugins = str_replace($oldMain, "", $oldPlugins); $regex = "/(?:" . preg_quote($relativePlugins, "/") . "\/|" . preg_quote($relativeMuPlugins, "/") . "\/)(.*?)(\/|\.php).*$/m"; if (!preg_match($regex, $longMessage, $matches)) { return false; } //matches the first part of the slug related to the plugin directory $slug = $matches[1]; foreach ($archiveConfig->wpInfo->plugins as $plugin) { if (strpos($plugin->slug, $slug) === 0) { return $plugin; } } return false; } /** * Returns the theme that is causing the error message if present * * @param string $longMessage the long error message containing the error trace * * @return false|object object containing theme info or false */ protected static function getProblematicThemeFromError($longMessage) { $archiveConfig = self::getArchiveConfigData(); $oldMain = $archiveConfig->wpInfo->targetRoot; $oldThemes = $archiveConfig->wpInfo->configs->realValues->originalPaths->themes; $relativeThemes = str_replace($oldMain, "", $oldThemes); file_put_contents( DUPX_INIT . "/my_log.txt", "OLD THEMES: {$oldThemes} \n" . "Relative themes: {$relativeThemes} \n" . "regex: " . "/(" . preg_quote($relativeThemes, "/") . "\/)(.*?)(\/|\.php).*$/m" ); if (!preg_match("/(?:" . preg_quote($relativeThemes, "/") . "\/)(.*?)(?:\/|\.php).*$/m", $longMessage, $matches)) { return false; } $slug = $matches[1]; foreach ($archiveConfig->wpInfo->themes as $theme) { if ($theme->slug == $slug) { return $theme; } } return false; } /** * Get package config data * * @return false|object package config data or false on failure */ protected static function getArchiveConfigData() { static $archiveConfig = null; if (is_null($archiveConfig)) { if ( ($path = glob(DUPX_INIT . "/dup-archive__*.txt")) === false || count($path) !== 1 ) { return $archiveConfig = false; } if (($json = file_get_contents($path[0])) === false) { return $archiveConfig = false; } $archiveConfig = json_decode($json); if (!is_object($archiveConfig)) { $archiveConfig = false; } } return $archiveConfig; } /** * @param string $version a version number * * @return string returns only the first 2 levels of the version numbers */ private static function getTwoLevelVersion($version) { $arr = explode(".", $version); return $arr[0] . "." . $arr[1]; } } MessageCustomizerItem.php 0000604 00000002531 15136251131 0011540 0 ustar 00 <?php namespace Duplicator\Installer\Utils\Tests; class MessageCustomizerItem { private $checkCallback; private $applyCallback; /** * @param callable|bool $checkCallback callback or bool whether to apply customization * @param callable $applyCallback the customizations to be applied */ public function __construct($checkCallback, $applyCallback) { if (!is_bool($checkCallback) && !is_callable($checkCallback)) { throw new \Exception("check callback must be either bool or callable"); } $this->checkCallback = $checkCallback; if (!is_callable($applyCallback)) { throw new \Exception("customization callback must be callable"); } $this->applyCallback = $applyCallback; } /** * @param mixed $input necessary input to check condition * * @return bool */ public function conditionSatisfied($input) { return (is_bool($this->checkCallback) && $this->checkCallback) || call_user_func($this->checkCallback, $input); } /** * @param string $string string to be customized * @param mixed $context context about what to apply * * @return false|mixed */ public function apply($string, $context) { return call_user_func($this->applyCallback, $string, $context); } }
💾 Salvar
❌ Cancelar
Enviar Arquivo
Selecionar arquivo:
Enviar
Cancelar
Criar Nova Pasta
Nome da pasta:
Criar
Cancelar
Alterar Permissões
Nova permissão:
0644 (rw-r--r--)
0755 (rwxr-xr-x)
0777 (rwxrwxrwx)
0600 (rw-------)
0700 (rwx------)
0444 (r--r--r--)
💾 Salvar
Cancelar