Squashed commit message
Some checks failed
Telegram Mini App Shop Builder / Compute version metadata (push) Has been cancelled
Telegram Mini App Shop Builder / Run Frontend tests (push) Has been cancelled
Telegram Mini App Shop Builder / Run Backend tests (push) Has been cancelled
Telegram Mini App Shop Builder / Run PHP_CodeSniffer (push) Has been cancelled
Telegram Mini App Shop Builder / Build module. (push) Has been cancelled
Telegram Mini App Shop Builder / release (push) Has been cancelled
Some checks failed
Telegram Mini App Shop Builder / Compute version metadata (push) Has been cancelled
Telegram Mini App Shop Builder / Run Frontend tests (push) Has been cancelled
Telegram Mini App Shop Builder / Run Backend tests (push) Has been cancelled
Telegram Mini App Shop Builder / Run PHP_CodeSniffer (push) Has been cancelled
Telegram Mini App Shop Builder / Build module. (push) Has been cancelled
Telegram Mini App Shop Builder / release (push) Has been cancelled
This commit is contained in:
40
scripts/link.php
Normal file
40
scripts/link.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
$module = 'oc_telegram_shop';
|
||||
|
||||
$basePath = dirname(__DIR__) . '/';
|
||||
|
||||
if ($basePath === '//') {
|
||||
$basePath = '/';
|
||||
}
|
||||
|
||||
$modulesPath = $basePath . 'module/';
|
||||
$modulePath = $modulesPath . $module . '/upload/';
|
||||
|
||||
$files = [];
|
||||
|
||||
$iterator = new RecursiveDirectoryIterator($modulePath);
|
||||
$recursiveIterator = new RecursiveIteratorIterator($iterator);
|
||||
|
||||
/** @var SplFileInfo $file */
|
||||
foreach ($recursiveIterator as $file) {
|
||||
if ($file->isFile() && fnmatch($pattern = '*', $file->getFilename())) {
|
||||
$files[] = $file->getRealPath();
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($files as $file) {
|
||||
$link = $basePath . 'web/upload/' . str_replace($modulePath, '', $file);
|
||||
|
||||
if (! is_dir(dirname($link))) {
|
||||
if (!mkdir($concurrentDirectory = dirname($link), 0775, true) && !is_dir($concurrentDirectory)) {
|
||||
throw new \RuntimeException(sprintf('Directory "%s" was not created', $concurrentDirectory));
|
||||
}
|
||||
}
|
||||
|
||||
echo sprintf('%s => %s', $file, $link) . PHP_EOL;
|
||||
|
||||
@unlink($link);
|
||||
symlink($file, $link);
|
||||
chmod($link, 0777);
|
||||
}
|
||||
Reference in New Issue
Block a user