Configure ApiGen

This commit is contained in:
Anders Jenbo 2024-03-04 18:28:47 +01:00
parent 857e1c15cc
commit 6edd399d37
2 changed files with 22 additions and 31 deletions

20
apigen.neon Normal file
View File

@ -0,0 +1,20 @@
parameters:
paths: [
'upload/admin',
'upload/catalog',
'upload/extension',
'upload/system/engine',
'upload/system/library',
'upload/system/helper',
]
include: ['*.php']
exclude: ['upload/system/storage/vendor']
excludeProtected: false
excludePrivate: true
excludeTagged: ['internal']
outputDir: 'docs/api'
themeDir: null
title: 'OpenCart API'
baseUrl: ''
workerCount: 8
memoryLimit: '512M'

View File

@ -1,34 +1,5 @@
<?php <?php
// This script is used to generate the OpenCart API documentation
include(__DIR__ . '/ApiGen/vendor/autoload.php');
if ((isset($_SERVER['HTTPS']) && (($_SERVER['HTTPS'] == 'on') || ($_SERVER['HTTPS'] == '1'))) || $_SERVER['SERVER_PORT'] == 443) { $directory = chdir(__DIR__ . '/..');
$protocol = 'https://';
} else {
$protocol = 'http://';
}
$directory = realpath(__DIR__ . '/../') . '/'; passthru('php tools/ApiGen/bin/apigen --working-dir "upload/system/storage"');
$url = $protocol . $_SERVER['HTTP_HOST'] . substr($directory, strlen($_SERVER['DOCUMENT_ROOT']));
$command = 'php ' . $directory . 'tools/ApiGen/bin/apigen';
$command .= ' --title "OpenCart API"';
$command .= ' --include *.php';
$command .= ' --exclude ' . $directory . 'upload/system/storage/vendor/*';
$command .= ' --working-dir ' . $directory . 'tools/ApiGen';
$command .= ' --output ' . $directory. 'docs/api/';
$command .= ' --base-url ' . $url . 'docs/api/';
$command .= ' ' . $directory . 'upload/admin/';
$command .= ' ' . $directory . 'upload/catalog/';
$command .= ' ' . $directory . 'upload/extension/';
$command .= ' ' . $directory . 'upload/system/engine/';
$command .= ' ' . $directory . 'upload/system/library/';
$command .= ' ' . $directory . 'upload/system/helper/';
$output = [];
exec($command, $output);
echo $command . "\n";
print_r($output);