Skip to content

Commit

Permalink
fix(cli-server,Filters) port over from automated build
Browse files Browse the repository at this point in the history
  • Loading branch information
lucatume committed Dec 13, 2023
1 parent 387f431 commit 022b39b
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 499 deletions.
43 changes: 25 additions & 18 deletions includes/cli-server/router.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,35 @@
}

$root = $_SERVER['DOCUMENT_ROOT'];
$path = '/'. ltrim( parse_url( urldecode( $_SERVER['REQUEST_URI'] ),PHP_URL_PATH ), '/' );
$path = '/' . ltrim(parse_url(urldecode($_SERVER['REQUEST_URI']), PHP_URL_PATH), '/');

define('DB_ENGINE', getenv('DB_ENGINE') ?: 'mysql');

if ( file_exists( $root.$path ) ) {
// The self-call will slow down the response handling and will not benefit the test environment.
global $wp_filter;
$wp_filter['do_mu_upgrade'][10][] = [
'accepted_args' => 0,
'function' => static function () {
return false;
}
];

// Enforces trailing slash, keeping links tidy in the admin
if ( is_dir( $root.$path ) && substr_compare($path, '/', -strlen('/')) !== 0 ) {
header( "Location: $path/" );
exit;
}
if (file_exists($root . $path)) {
// Enforces trailing slash, keeping links tidy in the admin
if (is_dir($root . $path) && substr_compare($path, '/', -strlen('/')) !== 0) {
header("Location: $path/");
exit;
}

// Runs PHP file if it exists
if ( strpos($path, '.php') !== false ) {
chdir( dirname( $root.$path ) );
require_once $root.$path;
} else {
return false;
}
// Runs PHP file if it exists
if (strpos($path, '.php') !== false) {
chdir(dirname($root . $path));
require_once $root . $path;
} else {
return false;
}
} else {

// Otherwise, run `index.php`
chdir( $root );
require_once 'index.php';
// Otherwise, run `index.php`
chdir($root);
require_once 'index.php';
}
205 changes: 0 additions & 205 deletions src/Module/WPLoader/Filters.php

This file was deleted.

76 changes: 0 additions & 76 deletions src/Module/WPLoader/FiltersGroup.php

This file was deleted.

Loading

0 comments on commit 022b39b

Please sign in to comment.