-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Симлинки создаются с относительными путями, в windows os вместо симли…
…нка копируется файл
- Loading branch information
Showing
10 changed files
with
268 additions
and
282 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Commands; | ||
|
||
use Phinx\Console\Command\AbstractCommand; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
use Symfony\Component\Filesystem\Filesystem; | ||
|
||
class AppPermission extends AbstractCommand | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function configure(): void | ||
{ | ||
parent::configure(); | ||
|
||
$this->setName('app:permission') | ||
->setDescription('Set file permissions'); | ||
} | ||
|
||
/** | ||
* Set permissions | ||
* | ||
* @param InputInterface $input | ||
* @param OutputInterface $output | ||
* | ||
* @return void | ||
*/ | ||
protected function execute(InputInterface $input, OutputInterface $output): void | ||
{ | ||
$storage = glob(STORAGE . '/*', GLOB_ONLYDIR); | ||
$uploads = glob(UPLOADS . '/*', GLOB_ONLYDIR); | ||
$modules = [HOME . '/assets/modules']; | ||
|
||
$dirs = array_merge($storage, $uploads, $modules); | ||
|
||
$filesystem = new Filesystem(); | ||
$filesystem->chmod($dirs, 0777); | ||
|
||
$output->writeln('<info>Permissions set successfully.</info>'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Commands; | ||
|
||
use Phinx\Console\Command\AbstractCommand; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
use Symfony\Component\Filesystem\Filesystem; | ||
|
||
class AppSymlink extends AbstractCommand | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function configure(): void | ||
{ | ||
parent::configure(); | ||
|
||
$this->setName('app:symlink') | ||
->setDescription('Create file symlinks'); | ||
} | ||
|
||
/** | ||
* Create symlinks | ||
* | ||
* @param InputInterface $input | ||
* @param OutputInterface $output | ||
* | ||
* @return void | ||
*/ | ||
protected function execute(InputInterface $input, OutputInterface $output): void | ||
{ | ||
$filesystem = new Filesystem(); | ||
$languages = array_map('basename', glob(RESOURCES . '/lang/*', GLOB_ONLYDIR)); | ||
|
||
foreach ($languages as $language) { | ||
$languagePath = RESOURCES . '/lang/' . $language; | ||
$assetsPath = HOME . '/assets/modules/'; | ||
|
||
$relativePath = $filesystem->makePathRelative($languagePath, $assetsPath); | ||
|
||
$filesystem->symlink( | ||
$relativePath . 'main.js', | ||
$assetsPath . $language . '.js', | ||
true | ||
); | ||
} | ||
|
||
$output->writeln('<info>Symlinks successfully created.</info>'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.