Files
web-doc-editor/install/firstRun.php
Peter Kokot f06fee3640 Sync final newlines
This patch adds some missing newlines and trims multiple final newlines
into a single newline.

According to POSIX, a line is a sequence of zero or more non-' <newline>'
characters plus a terminating '<newline>' character. [1] Files should
normally have at least one final newline character.

C89 [2] and later standards [3] mention a final newline:
"A source file that is not empty shall end in a new-line character,
which shall not be immediately preceded by a backslash character."

Although it is not mandatory for all files to have a final newline
fixed, a more consistent and homogeneous approach brings less of commit
differences issues and a better development experience in certain text
editors and IDEs.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206
[2] https://port70.net/~nsz/c/c89/c89-draft.html#2.1.1.2
[3] https://port70.net/~nsz/c/c99/n1256.html#5.1.1.2
2018-10-02 03:44:40 +02:00

97 lines
2.7 KiB
PHP

<?php
error_reporting(E_ALL);
set_time_limit(0);
require_once '../php/html.templates.php';
require_once '../php/ProjectManager.php';
require_once '../php/RepositoryManager.php';
require_once '../php/TranslationStatistic.php';
require_once '../php/TranslatorStatistic.php';
$isCLI = (PHP_SAPI == 'cli');
if ($isCLI) {
echo "PHP Documentation Online Editor - Installation\n\n";
} else {
echo headerTemplate('Installation', 1);
}
$rm = RepositoryManager::getInstance();
$pm = ProjectManager::getInstance();
$availableProject = $pm->getAvailableProject();
while( list($key, $project) = each($availableProject) ) {
// We must delete this var to be re-generated
unset($rm->existingLanguage);
// Define it as a project
$pm->setProject($project['code']);
if ($isCLI) {
echo "\n * Initial repository checkout for the " . $project['name'] . "...";
} else {
echo jsCallTemplate('document.getElementById("loading-msg").innerHTML = "Initial repository checkout for the ' . $project['name'] . '...";');
}
flush();
// checkout repository from VCS
$co_response = $rm->checkoutRepository();
if (0 != $co_response['err']) {
// error found in checkout, print the output and skip processing
echo "\n * Repository checkout failed.\n";
echo implode("\n", $co_response['output']);
continue;
}
if ($isCLI) {
echo "\n * Applying tools on repository...";
} else {
echo jsCallTemplate('document.getElementById("loading-msg").innerHTML = "Applying tools on repository...";');
}
flush();
//We apply all tools for all language
$rm->applyRevCheck();
// Search for NotInEN old Files
$rm->updateNotInEN();
if ($isCLI) {
echo "\n * Parsing translation data...";
} else {
echo jsCallTemplate('document.getElementById("loading-msg").innerHTML = "Parsing translation data...";');
}
flush();
// Parse translators
$rm->updateTranslatorInfo();
if ($isCLI) {
echo "\n * Compute all statistics...";
} else {
echo jsCallTemplate('document.getElementById("loading-msg").innerHTML = "Compute all statistics...";');
}
flush();
// Compute all summary
TranslationStatistic::getInstance()->computeSummary('all');
TranslatorStatistic::getInstance()->computeSummary('all');
// Store this info
$info = array();
$info['user'] = 'root';
$rm->setStaticValue('info', 'updateData', json_encode($info), true);
}
if ($isCLI) {
echo "\n\nInstallation completed!\n";
} else {
echo jsCallTemplate('document.getElementById("loading-msg").innerHTML = "Installation completed !";');
echo footerTemplate();
}