-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 191875c
Showing
7 changed files
with
163 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.idea/ | ||
composer.lock |
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,12 @@ | ||
sudo: false | ||
|
||
language: php | ||
|
||
php: | ||
- 5.4 | ||
- 5.5 | ||
- 5.6 | ||
|
||
script: | ||
- composer self-update | ||
- composer install --prefer-source --no-interaction |
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,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright © 2016 Notamedia Ltd. (http://nota.media) | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
Empty file.
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,18 @@ | ||
{ | ||
"name": "notamedia/console-jedi", | ||
"description": "Console application for CMS Bitrix", | ||
"keywords": ["bitrix", "console", "application"], | ||
"type": "library", | ||
"license": "MIT", | ||
"support": { | ||
"issues": "https://github.com/notamedia/console-jedi/issues", | ||
"source": "https://github.com/notamedia/console-jedi/" | ||
}, | ||
"require": { | ||
"php": ">=5.4", | ||
"symfony/console": "~v2.8" | ||
}, | ||
"autoload": { | ||
"psr-4": {"Notamedia\\ConsoleJedi\\": "src/"} | ||
} | ||
} |
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,38 @@ | ||
<?php | ||
/** | ||
* @link https://github.com/notamedia/console-jedi | ||
* @copyright Copyright © 2016 Notamedia Ltd. | ||
* @license MIT | ||
*/ | ||
|
||
namespace Notamedia\ConsoleJedi\Command\Agents; | ||
|
||
use Symfony\Component\Console\Command\Command; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
/** | ||
* Installation configurations for run Agents on cron. | ||
*/ | ||
class OnCronCommand extends Command | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function configure() | ||
{ | ||
parent::configure(); | ||
|
||
$this->setName('agents:on-cron') | ||
->setDescription('Installation configurations for run Agents on cron'); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function execute(InputInterface $input, OutputInterface $output) | ||
{ | ||
\COption::SetOptionString('main', 'agents_use_crontab', 'N'); | ||
\COption::SetOptionString('main', 'check_agents', 'N'); | ||
} | ||
} |
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,72 @@ | ||
<?php | ||
/** | ||
* @link https://github.com/notamedia/console-jedi | ||
* @copyright Copyright © 2016 Notamedia Ltd. | ||
* @license MIT | ||
*/ | ||
|
||
namespace Notamedia\ConsoleJedi\Command\Cache; | ||
|
||
use Bitrix\Main\Application; | ||
use Bitrix\Main\Data\Cache; | ||
use Bitrix\Main\Data\StaticHtmlCache; | ||
use Symfony\Component\Console\Command\Command; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Input\InputOption; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
/** | ||
* Command for clear Bitrix cache. | ||
*/ | ||
class ClearCommand extends Command | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function configure() | ||
{ | ||
$this->setName('cache:clear') | ||
->setDescription('Clear all cache') | ||
->addOption('dir', 'd', InputOption::VALUE_REQUIRED, 'Clear cache only for directory (relative from /' . BX_ROOT . '/cache/)') | ||
->addOption('tag', 't', InputOption::VALUE_REQUIRED, 'Clear cache by tag'); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function execute(InputInterface $input, OutputInterface $output) | ||
{ | ||
$dir = $input->getOption('dir'); | ||
$tag = $input->getOption('tag'); | ||
$cache = Cache::createInstance(); | ||
|
||
if (empty($dir) && empty($tag)) | ||
{ | ||
Application::getInstance()->getManagedCache()->cleanAll(); | ||
$cache->CleanDir(); | ||
$cache->CleanDir(false, 'stack_cache'); | ||
StaticHtmlCache::getInstance()->deleteAll(); | ||
|
||
if (Cache::clearCache(true)) | ||
{ | ||
$output->writeln('<info>All Bitrix cache was deleted</info>'); | ||
} | ||
else | ||
{ | ||
$output->writeln('<error>Error deleting Bitrix cache</error>'); | ||
} | ||
} | ||
|
||
if ($dir) | ||
{ | ||
$cache->CleanDir($dir); | ||
$output->writeln('<info>Bitrix cache by "/' . BX_ROOT . '/cache/' . $dir . '" dir was deleted</info>'); | ||
} | ||
|
||
if ($tag) | ||
{ | ||
Application::getInstance()->getTaggedCache()->ClearByTag($tag); | ||
$output->writeln('<info>Bitrix cache by tag "' . $tag . '" was deleted</info>'); | ||
} | ||
} | ||
} |