update du projet, xml collection enlevé et méthode fait maison ajouter
This commit is contained in:
18
vendor/symfony/intl/Resources/bin/autoload.php
vendored
Normal file
18
vendor/symfony/intl/Resources/bin/autoload.php
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
$autoload = __DIR__.'/../../vendor/autoload.php';
|
||||
|
||||
if (!file_exists($autoload)) {
|
||||
bailout('You should run "composer install" in the component before running this script.');
|
||||
}
|
||||
|
||||
require_once $autoload;
|
||||
100
vendor/symfony/intl/Resources/bin/common.php
vendored
Normal file
100
vendor/symfony/intl/Resources/bin/common.php
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
if ('cli' !== \PHP_SAPI) {
|
||||
throw new Exception('This script must be run from the command line.');
|
||||
}
|
||||
|
||||
define('LINE_WIDTH', 75);
|
||||
|
||||
define('LINE', str_repeat('-', LINE_WIDTH)."\n");
|
||||
|
||||
function bailout(string $message)
|
||||
{
|
||||
echo wordwrap($message, LINE_WIDTH)." Aborting.\n";
|
||||
|
||||
exit(1);
|
||||
}
|
||||
|
||||
function strip_minor_versions(string $version)
|
||||
{
|
||||
preg_match('/^(?P<version>[0-9]\.[0-9]|[0-9]{2,})/', $version, $matches);
|
||||
|
||||
return $matches['version'];
|
||||
}
|
||||
|
||||
function centered(string $text)
|
||||
{
|
||||
$padding = (int) ((LINE_WIDTH - strlen($text)) / 2);
|
||||
|
||||
return str_repeat(' ', $padding).$text;
|
||||
}
|
||||
|
||||
function cd(string $dir)
|
||||
{
|
||||
if (false === chdir($dir)) {
|
||||
bailout("Could not switch to directory $dir.");
|
||||
}
|
||||
}
|
||||
|
||||
function run(string $command)
|
||||
{
|
||||
exec($command, $output, $status);
|
||||
|
||||
if (0 !== $status) {
|
||||
$output = implode("\n", $output);
|
||||
echo "Error while running:\n ".getcwd().'$ '.$command."\nOutput:\n".LINE."$output\n".LINE;
|
||||
|
||||
bailout("\"$command\" failed.");
|
||||
}
|
||||
}
|
||||
|
||||
function get_icu_version_from_genrb(string $genrb)
|
||||
{
|
||||
exec($genrb.' --version - 2>&1', $output, $status);
|
||||
|
||||
if (0 !== $status) {
|
||||
bailout($genrb.' failed.');
|
||||
}
|
||||
|
||||
if (!preg_match('/ICU version ([\d\.]+)/', implode('', $output), $matches)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $matches[1];
|
||||
}
|
||||
|
||||
error_reporting(\E_ALL);
|
||||
|
||||
set_error_handler(function (int $type, string $msg, string $file, int $line) {
|
||||
throw new \ErrorException($msg, 0, $type, $file, $line);
|
||||
});
|
||||
|
||||
set_exception_handler(function (Throwable $exception) {
|
||||
echo "\n";
|
||||
|
||||
$cause = $exception;
|
||||
$root = true;
|
||||
|
||||
while (null !== $cause) {
|
||||
if (!$root) {
|
||||
echo "Caused by\n";
|
||||
}
|
||||
|
||||
echo $cause::class.': '.$cause->getMessage()."\n";
|
||||
echo "\n";
|
||||
echo $cause->getFile().':'.$cause->getLine()."\n";
|
||||
echo $cause->getTraceAsString()."\n";
|
||||
|
||||
$cause = $cause->getPrevious();
|
||||
$root = false;
|
||||
}
|
||||
});
|
||||
13
vendor/symfony/intl/Resources/bin/compile
vendored
Executable file
13
vendor/symfony/intl/Resources/bin/compile
vendored
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
[[ $1 == force ]] && docker pull jakzal/php-intl
|
||||
[[ ! -d /tmp/symfony/icu ]] && mkdir -p /tmp/symfony/icu
|
||||
|
||||
docker run \
|
||||
-it --rm --name symfony-intl \
|
||||
-u $(id -u):$(id -g) \
|
||||
-v /tmp/symfony/icu:/tmp \
|
||||
-v $(pwd):/symfony \
|
||||
-w /symfony \
|
||||
jakzal/php-intl:8.1-70.1 \
|
||||
php src/Symfony/Component/Intl/Resources/bin/update-data.php
|
||||
236
vendor/symfony/intl/Resources/bin/update-data.php
vendored
Normal file
236
vendor/symfony/intl/Resources/bin/update-data.php
vendored
Normal file
@@ -0,0 +1,236 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
use Symfony\Component\Intl\Data\Bundle\Compiler\GenrbCompiler;
|
||||
use Symfony\Component\Intl\Data\Bundle\Writer\PhpBundleWriter;
|
||||
use Symfony\Component\Intl\Data\Generator\CurrencyDataGenerator;
|
||||
use Symfony\Component\Intl\Data\Generator\GeneratorConfig;
|
||||
use Symfony\Component\Intl\Data\Generator\LanguageDataGenerator;
|
||||
use Symfony\Component\Intl\Data\Generator\LocaleDataGenerator;
|
||||
use Symfony\Component\Intl\Data\Generator\RegionDataGenerator;
|
||||
use Symfony\Component\Intl\Data\Generator\ScriptDataGenerator;
|
||||
use Symfony\Component\Intl\Data\Generator\TimezoneDataGenerator;
|
||||
use Symfony\Component\Intl\Intl;
|
||||
use Symfony\Component\Intl\Locale;
|
||||
use Symfony\Component\Intl\Util\GitRepository;
|
||||
|
||||
if ('cli' !== \PHP_SAPI) {
|
||||
throw new Exception('This script must be run from the command line.');
|
||||
}
|
||||
|
||||
require_once __DIR__.'/common.php';
|
||||
require_once __DIR__.'/autoload.php';
|
||||
|
||||
$argc = $_SERVER['argc'];
|
||||
$argv = $_SERVER['argv'];
|
||||
|
||||
if ($argc > 3 || 2 === $argc && '-h' === $argv[1]) {
|
||||
bailout(<<<'MESSAGE'
|
||||
Usage: php update-data.php <path/to/icu/source> <path/to/icu/build>
|
||||
|
||||
Updates the ICU data for Symfony to the latest version of ICU.
|
||||
|
||||
If you downloaded the git repository before, you can pass the path to the
|
||||
repository source in the first optional argument.
|
||||
|
||||
If you also built the repository before, you can pass the directory where that
|
||||
build is stored in the second parameter. The build directory needs to contain
|
||||
the subdirectories bin/ and lib/.
|
||||
|
||||
For running this script, the intl extension must be loaded and all vendors
|
||||
must have been installed through composer:
|
||||
|
||||
composer install
|
||||
|
||||
MESSAGE
|
||||
);
|
||||
}
|
||||
|
||||
echo LINE;
|
||||
echo centered('ICU Resource Bundle Compilation')."\n";
|
||||
echo LINE;
|
||||
|
||||
if (!Intl::isExtensionLoaded()) {
|
||||
bailout('The intl extension for PHP is not installed.');
|
||||
}
|
||||
|
||||
if ($argc >= 2) {
|
||||
$repoDir = $argv[1];
|
||||
$git = new GitRepository($repoDir);
|
||||
|
||||
echo "Using the existing git repository at {$repoDir}.\n";
|
||||
} else {
|
||||
echo "Starting git clone. This may take a while...\n";
|
||||
|
||||
$repoDir = sys_get_temp_dir().'/icu-data';
|
||||
$git = GitRepository::download('https://github.com/unicode-org/icu.git', $repoDir);
|
||||
|
||||
echo "Git clone to {$repoDir} complete.\n";
|
||||
}
|
||||
|
||||
$gitTag = $git->getLastTag(function ($tag) {
|
||||
return preg_match('#^release-[0-9]{1,}-[0-9]{1}$#', $tag);
|
||||
});
|
||||
$shortIcuVersion = strip_minor_versions(preg_replace('#release-([0-9]{1,})-([0-9]{1,})#', '$1.$2', $gitTag));
|
||||
|
||||
echo "Checking out `{$gitTag}` for version `{$shortIcuVersion}`...\n";
|
||||
$git->checkout('tags/'.$gitTag);
|
||||
|
||||
$filesystem = new Filesystem();
|
||||
$sourceDir = $repoDir.'/icu4c/source';
|
||||
|
||||
if ($argc >= 3) {
|
||||
$buildDir = $argv[2];
|
||||
} else {
|
||||
// Always build genrb so that we can determine the ICU version of the
|
||||
// download by running genrb --version
|
||||
echo "Building genrb.\n";
|
||||
|
||||
cd($sourceDir);
|
||||
|
||||
echo "Running configure...\n";
|
||||
|
||||
$buildDir = sys_get_temp_dir().'/icu-data/'.$shortIcuVersion.'/build';
|
||||
|
||||
$filesystem->remove($buildDir);
|
||||
$filesystem->mkdir($buildDir);
|
||||
|
||||
run('./configure --prefix='.$buildDir.' 2>&1');
|
||||
|
||||
echo "Running make...\n";
|
||||
|
||||
// If the directory "lib" does not exist in the download, create it or we
|
||||
// will run into problems when building libicuuc.so.
|
||||
$filesystem->mkdir($sourceDir.'/lib');
|
||||
|
||||
// If the directory "bin" does not exist in the download, create it or we
|
||||
// will run into problems when building genrb.
|
||||
$filesystem->mkdir($sourceDir.'/bin');
|
||||
|
||||
echo '[1/6] libicudata.so...';
|
||||
|
||||
cd($sourceDir.'/stubdata');
|
||||
run('make 2>&1 && make install 2>&1');
|
||||
|
||||
echo " ok.\n";
|
||||
|
||||
echo '[2/6] libicuuc.so...';
|
||||
|
||||
cd($sourceDir.'/common');
|
||||
run('make 2>&1 && make install 2>&1');
|
||||
|
||||
echo " ok.\n";
|
||||
|
||||
echo '[3/6] libicui18n.so...';
|
||||
|
||||
cd($sourceDir.'/i18n');
|
||||
run('make 2>&1 && make install 2>&1');
|
||||
|
||||
echo " ok.\n";
|
||||
|
||||
echo '[4/6] libicutu.so...';
|
||||
|
||||
cd($sourceDir.'/tools/toolutil');
|
||||
run('make 2>&1 && make install 2>&1');
|
||||
|
||||
echo " ok.\n";
|
||||
|
||||
echo '[5/6] libicuio.so...';
|
||||
|
||||
cd($sourceDir.'/io');
|
||||
run('make 2>&1 && make install 2>&1');
|
||||
|
||||
echo " ok.\n";
|
||||
|
||||
echo '[6/6] genrb...';
|
||||
|
||||
cd($sourceDir.'/tools/genrb');
|
||||
run('make 2>&1 && make install 2>&1');
|
||||
|
||||
echo " ok.\n";
|
||||
}
|
||||
|
||||
$genrb = $buildDir.'/bin/genrb';
|
||||
$genrbEnv = 'LD_LIBRARY_PATH='.$buildDir.'/lib ';
|
||||
|
||||
echo "Using $genrb.\n";
|
||||
|
||||
$icuVersionInDownload = get_icu_version_from_genrb($genrbEnv.' '.$genrb);
|
||||
|
||||
echo "Preparing resource bundle compilation (version $icuVersionInDownload)...\n";
|
||||
|
||||
$compiler = new GenrbCompiler($genrb, $genrbEnv);
|
||||
$config = new GeneratorConfig($sourceDir.'/data', $icuVersionInDownload);
|
||||
$dataDir = dirname(__DIR__).'/data';
|
||||
|
||||
$config->addBundleWriter($dataDir, new PhpBundleWriter());
|
||||
|
||||
echo "Starting resource bundle compilation. This may take a while...\n";
|
||||
|
||||
// We don't want to use fallback to English during generation
|
||||
Locale::setDefaultFallback('root');
|
||||
|
||||
echo "Generating language data...\n";
|
||||
|
||||
$generator = new LanguageDataGenerator($compiler, Intl::LANGUAGE_DIR);
|
||||
$generator->generateData($config);
|
||||
|
||||
echo "Generating script data...\n";
|
||||
|
||||
$generator = new ScriptDataGenerator($compiler, Intl::SCRIPT_DIR);
|
||||
$generator->generateData($config);
|
||||
|
||||
echo "Generating region data...\n";
|
||||
|
||||
$generator = new RegionDataGenerator($compiler, Intl::REGION_DIR);
|
||||
$generator->generateData($config);
|
||||
|
||||
echo "Generating currency data...\n";
|
||||
|
||||
$generator = new CurrencyDataGenerator($compiler, Intl::CURRENCY_DIR);
|
||||
$generator->generateData($config);
|
||||
|
||||
echo "Generating locale data...\n";
|
||||
|
||||
$generator = new LocaleDataGenerator($compiler, Intl::LOCALE_DIR);
|
||||
$generator->generateData($config);
|
||||
|
||||
echo "Generating timezone data...\n";
|
||||
|
||||
$generator = new TimezoneDataGenerator($compiler, Intl::TIMEZONE_DIR);
|
||||
$generator->generateData($config);
|
||||
|
||||
echo "Resource bundle compilation complete.\n";
|
||||
|
||||
$gitInfo = <<<GIT_INFO
|
||||
Git information
|
||||
===============
|
||||
|
||||
URL: {$git->getUrl()}
|
||||
Revision: {$git->getLastCommitHash()}
|
||||
Author: {$git->getLastAuthor()}
|
||||
Date: {$git->getLastAuthoredDate()->format('c')}
|
||||
|
||||
GIT_INFO;
|
||||
|
||||
$gitInfoFile = $dataDir.'/git-info.txt';
|
||||
|
||||
file_put_contents($gitInfoFile, $gitInfo);
|
||||
|
||||
echo "Wrote $gitInfoFile.\n";
|
||||
|
||||
$versionFile = $dataDir.'/version.txt';
|
||||
|
||||
file_put_contents($versionFile, "$icuVersionInDownload\n");
|
||||
|
||||
echo "Wrote $versionFile.\n";
|
||||
echo "Done.\n";
|
||||
Reference in New Issue
Block a user