Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8fc200b

Browse files
authored
Merge pull request#23 from romaricp/cache_tool_version
Define the cache_tool version
2 parents452663a +2f1be45 commit8fc200b

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

‎src/Automate/Plugin/CacheToolPlugin.php‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
class CacheToolPluginimplements PluginInterface
1919
{
20-
2120
constPHAR_URL ='http://gordalina.github.io/cachetool/downloads/cachetool.phar';
2221

2322
/**
@@ -61,7 +60,11 @@ public function onTerminate(DeployEvent $event)
6160
$context =$event->getContext();
6261
$fastcgi =isset($this->configuration['fastcgi']) ?sprintf('--fcgi="%s"',$this->configuration['fastcgi']) :'--fcgi';
6362

64-
$context->run('curl -sO' .self::PHAR_URL);
63+
if (isset($this->configuration['version'])){
64+
$context->run('curl -sO' .str_replace('cachetool.phar','cachetool-'.$this->configuration['version'] .'.phar',self::PHAR_URL) );
65+
}else{
66+
$context->run('curl -sO' .self::PHAR_URL );
67+
}
6568

6669
if(isset($this->configuration['opcache']) &&$this->configuration['opcache']) {
6770
$context->run('php cachetool.phar opcache:reset' .$fastcgi,true);
@@ -87,6 +90,7 @@ public function getConfigurationSchema()
8790
return [
8891
'_type' =>'array',
8992
'_children' => [
93+
'version' => ['_type' =>'text'],
9094
'fastcgi' => ['_type' =>'text'],
9195
'opcache' => ['_type' =>'boolean'],
9296
'apcu' => ['_type' =>'boolean'],

‎tests/Automate/Plugin/CacheToolPluginTest.php‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,27 @@ public function testSimpleConfig()
4848
Phake::verify($session, Phake::times(1))->run('cd'.$path.'; rm cachetool.phar')
4949
);
5050
}
51+
52+
publicfunctiontestVersionConfig()
53+
{
54+
$cacheTool =newCacheToolPlugin();
55+
$session = Phake::mock(SessionInterface::class);
56+
$context =$this->createContext($session, Phake::mock(LoggerInterface::class));
57+
58+
$context->getProject()->setPlugins(['cache_tool' => [
59+
'version' =>'3.2.1',
60+
'opcache' =>'true',
61+
]]);
62+
63+
$cacheTool->register($context->getProject());
64+
$cacheTool->onTerminate(newDeployEvent($context));
65+
66+
$path =$context->getReleasePath(current($context->getProject()->getPlatform('development')->getServers()));
67+
68+
Phake::inOrder(
69+
Phake::verify($session, Phake::times(1))->run('cd'.$path.'; curl -sO' .str_replace('cachetool.phar','cachetool-3.2.1.phar', CacheToolPlugin::PHAR_URL) ),
70+
Phake::verify($session, Phake::times(1))->run('cd'.$path.'; php cachetool.phar opcache:reset --fcgi'),
71+
Phake::verify($session, Phake::times(1))->run('cd'.$path.'; rm cachetool.phar')
72+
);
73+
}
5174
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp