-
Notifications
You must be signed in to change notification settings - Fork 6
/
cli.php
49 lines (41 loc) · 1.22 KB
/
cli.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
41
42
43
44
45
46
47
48
49
<?php
// TODO: make sure to update timestamp field in table for image record
// TODO: port scan optimizations from core, and do the batch insert record stuff for more resiliant processing
if ( empty( $argv ) ) {
echo "See --help for command-line options.";
die;
}
if ( ! defined( 'EWWW_CLI' ) ) {
define( 'EWWW_CLI', true );
}
if ( ! defined( 'ABSPATH' ) ) {
define( 'ABSPATH', dirname( __file__ ) . '/' );
}
$ewwwio_settings = array();
if ( file_exists( ABSPATH . 'config.php' ) ) {
include_once ABSPATH . 'config.php';
}
require_once __DIR__ . '/vendor/rmccue/requests/src/Autoload.php';
WpOrg\Requests\Autoload::register();
require ABSPATH . 'functions.php';
require ABSPATH . 'classes/class-colors.php';
require ABSPATH . 'classes/class-base.php';
require ABSPATH . 'classes/class-silo.php';
/**
* The main function to return a single EWWW\SILO object to functions elsewhere.
*
* @return object object|EWWW\SILO The one true EWWW\SILO instance.
*/
function ewwwio() {
return EWWW\SILO::instance();
}
ewwwio();
if ( ewwwio()->help ) {
ewwwio()->commands->usage();
exit;
}
if ( ! empty( ewwwio()->file ) && is_file( ewwwio()->file ) ) {
ewwwio()->commands->single_optimize();
} else {
ewwwio()->commands->folder_optimize();
}