-
Notifications
You must be signed in to change notification settings - Fork 16
/
wpcom-legacy-redirector.php
40 lines (36 loc) · 1.55 KB
/
wpcom-legacy-redirector.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
/**
* Plugin Name: WPCOM Legacy Redirector
* Plugin URI: https://github.com/Automattic/WPCOM-Legacy-Redirector
* Description: Simple plugin for handling legacy redirects in a scalable manner.
* Version: 1.4.0-alpha
* Requires PHP: 7.4
* Author: Automattic / WordPress VIP
* Author URI: https://wpvip.com
*
* Redirects are stored as a custom post type and use the following fields:
*
* - post_name for the md5 hash of the "from" path or URL.
* - we use this column, since it's indexed and queries are super fast.
* - we also use an md5 just to simplify the storage.
* - post_title to store the non-md5 version of the "from" path.
* - one of either:
* - post_parent if we're redirect to a post; or
* - post_excerpt if we're redirecting to an alternate URL.
*
* @package Automattic\LegacyRedirector
*/
define( 'WPCOM_LEGACY_REDIRECTOR_VERSION', '1.4.0-alpha' );
define( 'WPCOM_LEGACY_REDIRECTOR_PLUGIN_NAME', 'WPCOM Legacy Redirector' );
if ( defined( 'WP_CLI' ) && WP_CLI ) {
require __DIR__ . '/includes/class-wpcom-legacy-redirector-cli.php';
WP_CLI::add_command( 'wpcom-legacy-redirector', 'WPCOM_Legacy_Redirector_CLI' );
}
require __DIR__ . '/includes/class-capability.php';
require __DIR__ . '/includes/class-post-type.php';
require __DIR__ . '/includes/class-list-redirects.php';
require __DIR__ . '/includes/class-lookup.php';
require __DIR__ . '/includes/class-utils.php';
require __DIR__ . '/includes/class-wpcom-legacy-redirector-ui.php';
require __DIR__ . '/includes/class-wpcom-legacy-redirector.php';
WPCOM_Legacy_Redirector::start();