2016-12-19 16:56:52 +01:00
|
|
|
#!/usr/bin/env php
|
|
|
|
<?php
|
|
|
|
/*
|
2017-01-25 23:16:22 +01:00
|
|
|
Copyright 2016-2017 Daniil Gentili
|
2016-12-19 16:56:52 +01:00
|
|
|
(https://daniil.it)
|
|
|
|
This file is part of MadelineProto.
|
|
|
|
MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
|
|
|
MadelineProto is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
See the GNU Affero General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License along with MadelineProto.
|
|
|
|
If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2017-01-02 19:50:37 +01:00
|
|
|
require 'vendor/autoload.php';
|
|
|
|
$param = 1;
|
|
|
|
\danog\MadelineProto\Logger::constructor($param);
|
2017-08-18 18:10:30 +02:00
|
|
|
set_error_handler(['\danog\MadelineProto\Exception', 'ExceptionErrorHandler']);
|
2016-12-19 16:56:52 +01:00
|
|
|
|
2017-01-27 22:05:24 +01:00
|
|
|
\danog\MadelineProto\Logger::log(['Copying readme...'], \danog\MadelineProto\Logger::NOTICE);
|
2016-12-19 16:56:52 +01:00
|
|
|
|
2016-12-20 13:15:22 +01:00
|
|
|
file_put_contents('docs/index.md', '---
|
|
|
|
title: MadelineProto documentation
|
2016-12-20 13:32:11 +01:00
|
|
|
description: PHP implementation of telegram\'s MTProto protocol
|
2016-12-20 13:15:22 +01:00
|
|
|
---
|
2017-08-20 16:02:02 +02:00
|
|
|
'.str_replace('<img', '<amp-img', file_get_contents('README.md')));
|
2016-12-19 16:56:52 +01:00
|
|
|
|
2017-01-02 19:50:37 +01:00
|
|
|
$docs = [
|
2017-03-11 19:54:51 +01:00
|
|
|
[
|
|
|
|
'tl_schema' => ['td' => __DIR__.'/src/danog/MadelineProto/TL_td.tl'],
|
|
|
|
'title' => 'MadelineProto API documentation (td-lib)',
|
|
|
|
'description' => 'MadelineProto API documentation (td-lib)',
|
|
|
|
'output_dir' => __DIR__.'/docs/TD_docs',
|
|
|
|
'readme' => false,
|
2017-08-25 14:43:50 +02:00
|
|
|
'td' => true,
|
2017-03-11 19:54:51 +01:00
|
|
|
],
|
2017-01-02 19:50:37 +01:00
|
|
|
[
|
2017-01-02 19:52:29 +01:00
|
|
|
'tl_schema' => ['mtproto' => __DIR__.'/src/danog/MadelineProto/TL_mtproto_v1.json'],
|
|
|
|
'title' => 'MadelineProto API documentation (mtproto)',
|
2017-01-02 19:50:37 +01:00
|
|
|
'description' => 'MadelineProto API documentation (mtproto)',
|
2017-01-02 19:52:29 +01:00
|
|
|
'output_dir' => __DIR__.'/docs/MTProto_docs',
|
2017-01-07 12:40:51 +01:00
|
|
|
'readme' => false,
|
2017-01-02 19:50:37 +01:00
|
|
|
],
|
|
|
|
[
|
2017-08-21 18:22:02 +02:00
|
|
|
'tl_schema' => ['telegram' => __DIR__.'/src/danog/MadelineProto/TL_telegram_v71.tl', 'calls' => __DIR__.'/src/danog/MadelineProto/TL_calls.tl', 'secret' => __DIR__.'/src/danog/MadelineProto/TL_secret.tl', 'td' => __DIR__.'/src/danog/MadelineProto/TL_td.tl'],
|
|
|
|
'title' => 'MadelineProto API documentation (layer 71)',
|
|
|
|
'description' => 'MadelineProto API documentation (layer 71)',
|
2017-01-02 19:52:29 +01:00
|
|
|
'output_dir' => __DIR__.'/docs/API_docs',
|
2017-01-07 12:40:51 +01:00
|
|
|
'readme' => false,
|
2017-01-02 19:50:37 +01:00
|
|
|
],
|
|
|
|
];
|
2017-01-03 00:28:51 +01:00
|
|
|
|
Added docs for layer 18, 23, 25, 27, 33, 38, 40, 41, 42, 44, 45, 46, 51, 53, 55
2017-01-02 21:04:36 +01:00
|
|
|
$layer_list = '';
|
|
|
|
foreach (array_slice(glob(__DIR__.'/src/danog/MadelineProto/TL_telegram_*'), 0, -1) as $file) {
|
|
|
|
$layer = preg_replace(['/.*telegram_/', '/\..+/'], '', $file);
|
2017-01-02 21:19:06 +01:00
|
|
|
$docs[] = [
|
Added docs for layer 18, 23, 25, 27, 33, 38, 40, 41, 42, 44, 45, 46, 51, 53, 55
2017-01-02 21:04:36 +01:00
|
|
|
'tl_schema' => ['telegram' => $file],
|
|
|
|
'title' => 'MadelineProto API documentation (layer '.$layer.')',
|
|
|
|
'description' => 'MadelineProto API documentation (layer '.$layer.')',
|
2017-01-03 00:28:51 +01:00
|
|
|
'output_dir' => __DIR__.'/old_docs/API_docs_'.$layer,
|
2017-01-07 12:40:51 +01:00
|
|
|
'readme' => true,
|
Added docs for layer 18, 23, 25, 27, 33, 38, 40, 41, 42, 44, 45, 46, 51, 53, 55
2017-01-02 21:04:36 +01:00
|
|
|
];
|
|
|
|
$layer_list = '[Layer '.$layer.'](API_docs_'.$layer.'/)
|
|
|
|
';
|
|
|
|
}
|
|
|
|
|
2017-01-03 00:28:51 +01:00
|
|
|
file_put_contents('old_docs/README.md', '---
|
Added docs for layer 18, 23, 25, 27, 33, 38, 40, 41, 42, 44, 45, 46, 51, 53, 55
2017-01-02 21:04:36 +01:00
|
|
|
title: Documentations of old mtproto layers
|
|
|
|
description: Documentation of old mtproto layers
|
|
|
|
---
|
|
|
|
# Documentation of old mtproto layers
|
2017-01-02 19:50:37 +01:00
|
|
|
|
Added docs for layer 18, 23, 25, 27, 33, 38, 40, 41, 42, 44, 45, 46, 51, 53, 55
2017-01-02 21:04:36 +01:00
|
|
|
'.$layer_list);
|
2017-01-03 00:28:51 +01:00
|
|
|
|
2017-03-11 19:54:51 +01:00
|
|
|
$doc = new \danog\MadelineProto\AnnotationsBuilder($docs[2]);
|
2017-01-22 17:40:56 +01:00
|
|
|
$doc->mk_annotations();
|
|
|
|
|
2017-01-02 19:50:37 +01:00
|
|
|
foreach ($docs as $settings) {
|
|
|
|
$doc = new \danog\MadelineProto\DocsBuilder($settings);
|
|
|
|
$doc->mk_docs();
|
2016-12-19 16:56:52 +01:00
|
|
|
}
|