/
cli.php
50 lines (41 loc) · 981 Bytes
/
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
50
#!/usr/bin/php
<?php
/**
* command line client
* usage:
* path/to/php.exe mpv.php my-mod.zip
*
* @package mpv
* @version $Id$
* @copyright (c) 2010 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
*
*/
if (php_sapi_name() != 'cli')
{
die('Please run this from the command line.');
}
if (!isset($argv[1]))
{
die("Usage: mpv my-mod.zip\n");
}
if (!file_exists($argv[1]))
{
die("Error: file {$argv[1]} not found\n");
}
$phpEx = substr(strrchr(__FILE__, '.'), 1);
$root_path = './';
// Will define all needed things.
require('./mpv_config.' . $phpEx);
if (version_compare(PHP_VERSION, '5.2.0', '<'))
{
die($lang['MIN_PHP']);
}
require('./includes/functions_mpv.' . $phpEx);
require('./includes/mpv.' . $phpEx);
error_reporting(E_ALL);
$mpv = new mpv(null, mpv::UNZIP_PREFERENCE, false);
$mpv->output_type = (mpv::OUTPUT_TEXT);
mpv::$exec_php = mpv::EXEC_PHP;
$mpv->validate($argv[1]);
print $lang['VALIDATION_RESULTS'] . "\n\n" . $mpv;