dkdeploy-php 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +19 -0
- data/.rubocop.yml +22 -0
- data/.travis.yml +12 -0
- data/Berksfile +3 -0
- data/Berksfile.lock +61 -0
- data/CHANGELOG.md +11 -0
- data/CONTRIBUTORS.md +16 -0
- data/Gemfile +3 -0
- data/LICENSE +7 -0
- data/README.md +84 -0
- data/Rakefile +5 -0
- data/Vagrantfile +63 -0
- data/config/vm/cookbooks/dkdeploy-php/attributes/default.rb +1 -0
- data/config/vm/cookbooks/dkdeploy-php/metadata.rb +12 -0
- data/config/vm/cookbooks/dkdeploy-php/recipes/default.rb +77 -0
- data/config/vm/cookbooks/dkdeploy-php/templates/default/web_app.conf.erb +28 -0
- data/dkdeploy-php.gemspec +27 -0
- data/features/composer.feature +20 -0
- data/features/db.feature +84 -0
- data/features/php.feature +44 -0
- data/features/support/env.rb +14 -0
- data/features/support/path.rb +30 -0
- data/features/support/step_definitions/steps.rb +15 -0
- data/features/support/templates/empty-doctrine-migration.erb +20 -0
- data/lib/capistrano/dkdeploy/php.rb +25 -0
- data/lib/dkdeploy/php/helpers/db.rb +43 -0
- data/lib/dkdeploy/php/helpers/http.rb +60 -0
- data/lib/dkdeploy/php/i18n.rb +74 -0
- data/lib/dkdeploy/php/tasks/composer.rake +50 -0
- data/lib/dkdeploy/php/tasks/db.rake +121 -0
- data/lib/dkdeploy/php/tasks/php.rake +90 -0
- data/lib/dkdeploy/php/version.rb +15 -0
- data/spec/fixtures/application/Capfile +8 -0
- data/spec/fixtures/application/Gemfile +6 -0
- data/spec/fixtures/application/config/deploy.rb +8 -0
- data/spec/fixtures/application/config/deploy/dev.rb +40 -0
- data/spec/fixtures/application/config/migrations/cli-config.php.erb +23 -0
- data/spec/fixtures/application/config/migrations/migrations.yml.erb +4 -0
- data/spec/fixtures/application/htdocs/.hidden/.gitkeep +0 -0
- data/spec/fixtures/application/htdocs/composer.json +22 -0
- data/spec/fixtures/application/vendor/composer.phar +0 -0
- data/spec/fixtures/application/vendor/doctrine-migrations.phar +0 -0
- data/spec/fixtures/capistrano/configuration/server_with_faulty_domain_configuration.rb +2 -0
- data/spec/fixtures/capistrano/configuration/server_with_valid_domain.rb +2 -0
- data/vendor/apc_clear.php +14 -0
- data/vendor/opcache_reset.php +10 -0
- metadata +185 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
require 'dkdeploy/helpers/common'
|
|
2
|
+
require 'capistrano/i18n'
|
|
3
|
+
require 'dkdeploy/php/i18n'
|
|
4
|
+
|
|
5
|
+
include Dkdeploy::Helpers::Common
|
|
6
|
+
|
|
7
|
+
namespace :composer do
|
|
8
|
+
namespace :local do
|
|
9
|
+
desc 'Check the status of the composer.json file'
|
|
10
|
+
task :check_status do
|
|
11
|
+
default_arguments = fetch(:composer_default_arguments)
|
|
12
|
+
install_arguments = fetch(:composer_install_arguments)
|
|
13
|
+
|
|
14
|
+
run_locally do
|
|
15
|
+
# Try dry install --dry-run
|
|
16
|
+
output = capture :composer, :install, '--dry-run', *install_arguments, *default_arguments, '2>&1', verbosity: SSHKit::Logger::INFO
|
|
17
|
+
unless output.include? 'Nothing to install or update'
|
|
18
|
+
command = SSHKit::Command.new :composer, :install, *install_arguments, *default_arguments
|
|
19
|
+
error I18n.t('tasks.composer.local.check_status.run_install', command: command.to_s, scope: :dkdeploy)
|
|
20
|
+
exit 1
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
begin
|
|
25
|
+
# run composer status
|
|
26
|
+
invoke 'composer:local:run', :status
|
|
27
|
+
rescue
|
|
28
|
+
run_locally do
|
|
29
|
+
command = SSHKit::Command.new :composer, :status, '-v', *default_arguments
|
|
30
|
+
error I18n.t('tasks.composer.local.check_status.failure', command: command.to_s, scope: :dkdeploy)
|
|
31
|
+
exit 1
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
desc 'Validate composer file'
|
|
37
|
+
task :validate do
|
|
38
|
+
invoke 'composer:local:run', :validate
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
desc 'Execute composer command'
|
|
42
|
+
task :run, :command do |_t, args|
|
|
43
|
+
args.with_defaults(command: :list, verbosity: :debug)
|
|
44
|
+
default_arguments = fetch(:composer_default_arguments)
|
|
45
|
+
run_locally do
|
|
46
|
+
execute :composer, args[:command], *args.extras, *default_arguments, '2>&1'
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
require 'erb'
|
|
2
|
+
require 'dkdeploy/php/helpers/db'
|
|
3
|
+
include Dkdeploy::Php::Helpers::DB
|
|
4
|
+
|
|
5
|
+
namespace :db do
|
|
6
|
+
desc 'Database migrations with Doctrine2. See http://www.doctrine-project.org/projects/migrations'
|
|
7
|
+
namespace :migrations do
|
|
8
|
+
desc 'Generate and download new migration'
|
|
9
|
+
task generate: [:copy_doctrine_to_server] do
|
|
10
|
+
on primary :backend do
|
|
11
|
+
info I18n.t('tasks.db.migrations.generate.info', scope: :dkdeploy)
|
|
12
|
+
execute :mkdir, '-p', remote_migrations_root_directory
|
|
13
|
+
within remote_migrations_root_directory do
|
|
14
|
+
execute :php, 'doctrine-migrations.phar', 'migrations:generate', fetch(:migrations_default_arguments)
|
|
15
|
+
end
|
|
16
|
+
download! remote_migrations_classes_directory, local_migrations_root_directory, via: :scp, recursive: true
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
desc 'Show migration status'
|
|
21
|
+
task status: [:copy_doctrine_to_server, :copy_migrations_to_server] do
|
|
22
|
+
run_locally do
|
|
23
|
+
info I18n.t('tasks.db.migrations.status.info', scope: :dkdeploy)
|
|
24
|
+
end
|
|
25
|
+
on primary :backend do
|
|
26
|
+
within remote_migrations_root_directory do
|
|
27
|
+
execute :php, 'doctrine-migrations.phar', 'migrations:status'
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
desc 'Migrate Database'
|
|
33
|
+
task migrate: [:copy_doctrine_to_server, :copy_migrations_to_server] do
|
|
34
|
+
run_locally do
|
|
35
|
+
info I18n.t('tasks.db.migrations.migrate.info', scope: :dkdeploy)
|
|
36
|
+
end
|
|
37
|
+
on primary :backend do
|
|
38
|
+
within remote_migrations_root_directory do
|
|
39
|
+
execute :php, 'doctrine-migrations.phar', 'migrations:migrate', fetch(:migrations_default_arguments)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
desc 'Downgrade database'
|
|
45
|
+
task :execute_down, :migration_version do |_, args|
|
|
46
|
+
migration_version = ask_variable(args, :migration_version, 'questions.db.migrations.migration_version')
|
|
47
|
+
invoke 'db:migrations:copy_doctrine_to_server'
|
|
48
|
+
invoke 'db:migrations:copy_migrations_to_server'
|
|
49
|
+
run_locally do
|
|
50
|
+
info I18n.t('tasks.db.migrations.execute_down.info', migration_version: migration_version, scope: :dkdeploy)
|
|
51
|
+
end
|
|
52
|
+
on primary :backend do
|
|
53
|
+
within remote_migrations_root_directory do
|
|
54
|
+
execute :php, 'doctrine-migrations.phar', 'migrations:execute', migration_version.to_s, '--down', fetch(:migrations_default_arguments)
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
desc 'Copy Doctrine to server'
|
|
60
|
+
task :copy_doctrine_to_server do
|
|
61
|
+
if File.exist? fetch(:doctrine_phar)
|
|
62
|
+
run_locally do
|
|
63
|
+
info I18n.t('tasks.db.migrations.copy_doctrine_to_server.info.doctrine_phar',
|
|
64
|
+
doctrine_phar: fetch(:doctrine_phar),
|
|
65
|
+
scope: :dkdeploy)
|
|
66
|
+
end
|
|
67
|
+
on primary :backend do
|
|
68
|
+
info I18n.t('tasks.db.migrations.copy_doctrine_to_server.info.remove', scope: :dkdeploy)
|
|
69
|
+
execute :rm, '-rf', remote_migrations_root_directory
|
|
70
|
+
info I18n.t('tasks.db.migrations.copy_doctrine_to_server.info.create_directories', scope: :dkdeploy)
|
|
71
|
+
execute :mkdir, '-p', remote_migrations_classes_directory
|
|
72
|
+
|
|
73
|
+
info I18n.t('tasks.db.migrations.copy_doctrine_to_server.info.upload_doctrine',
|
|
74
|
+
migrations_root_directory: remote_migrations_root_directory,
|
|
75
|
+
scope: :dkdeploy)
|
|
76
|
+
upload! fetch(:doctrine_phar), File.join(remote_migrations_root_directory, 'doctrine-migrations.phar')
|
|
77
|
+
|
|
78
|
+
info I18n.t('tasks.db.migrations.copy_doctrine_to_server.info.upload_doctrine_db_configuration',
|
|
79
|
+
migrations_root_directory: remote_migrations_root_directory,
|
|
80
|
+
scope: :dkdeploy)
|
|
81
|
+
cli_config_template = ERB.new File.read(File.join(local_migrations_root_directory, 'cli-config.php.erb'))
|
|
82
|
+
upload! StringIO.new(cli_config_template.result(binding)), File.join(remote_migrations_root_directory, 'cli-config.php')
|
|
83
|
+
|
|
84
|
+
I18n.t('tasks.db.migrations.copy_doctrine_to_server.info.upload_doctrine_configuration',
|
|
85
|
+
migrations_root_directory: remote_migrations_root_directory,
|
|
86
|
+
scope: :dkdeploy)
|
|
87
|
+
cli_config_template = ERB.new File.read(File.join(local_migrations_root_directory, 'migrations.yml.erb'))
|
|
88
|
+
upload! StringIO.new(cli_config_template.result(binding)), File.join(remote_migrations_root_directory, 'migrations.yml')
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
desc 'Copies your Doctrine migrations to server'
|
|
94
|
+
task :copy_migrations_to_server do
|
|
95
|
+
on primary :backend do
|
|
96
|
+
info I18n.t('tasks.db.migrations.copy_migrations_to_server.info.upload_migrations',
|
|
97
|
+
migrations_classes_directory: remote_migrations_classes_directory,
|
|
98
|
+
scope: :dkdeploy)
|
|
99
|
+
execute :rm, '-rf', remote_migrations_classes_directory
|
|
100
|
+
|
|
101
|
+
# Copy common migrations to server
|
|
102
|
+
if Dir.exist? local_migrations_classes_directory
|
|
103
|
+
upload! local_migrations_classes_directory, remote_migrations_root_directory, via: :scp, recursive: true
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
# Copy stage specific migrations
|
|
107
|
+
if Dir.exist? File.join(local_migrations_stage_directory, fetch(:stage).to_s)
|
|
108
|
+
info I18n.t('tasks.db.migrations.copy_migrations_to_server.info.upload_stage_migrations',
|
|
109
|
+
stage: fetch(:stage).to_s,
|
|
110
|
+
migrations_classes_directory: remote_migrations_classes_directory,
|
|
111
|
+
scope: :dkdeploy)
|
|
112
|
+
execute :mkdir, '-p', remote_migrations_classes_directory
|
|
113
|
+
local_stage_directory = File.join(local_migrations_stage_directory, fetch(:stage).to_s)
|
|
114
|
+
Dir[File.join(local_stage_directory, '*')].each do |file|
|
|
115
|
+
upload! file, remote_migrations_classes_directory, via: :scp, recursive: true
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
end
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
require 'socket'
|
|
2
|
+
require 'net/http'
|
|
3
|
+
require 'uri'
|
|
4
|
+
require 'json'
|
|
5
|
+
require 'dkdeploy/php/helpers/http'
|
|
6
|
+
include Dkdeploy::Php::Helpers::Http
|
|
7
|
+
|
|
8
|
+
namespace :php do
|
|
9
|
+
desc 'Show PHP Version'
|
|
10
|
+
task :version do
|
|
11
|
+
on roles :app, :web do
|
|
12
|
+
php_version = capture :php, '-v'
|
|
13
|
+
info php_version
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
desc 'Clear APC cache on stage'
|
|
18
|
+
task :clear_apc_cache, :local_apc_file do |_, args|
|
|
19
|
+
local_apc_file = ask_variable(args, :local_apc_file, 'tasks.php.clear_apc_cache.local_apc_file') { |question| question.default = 'vendor/apc_clear.php' }
|
|
20
|
+
|
|
21
|
+
web_root = File.join current_path, fetch(:remote_web_root_path)
|
|
22
|
+
remote_apc_file_name = fetch(:remote_apc_file_name)
|
|
23
|
+
remote_apc_file = File.join web_root, remote_apc_file_name
|
|
24
|
+
|
|
25
|
+
on roles :app do |server|
|
|
26
|
+
delete_apc_file = false
|
|
27
|
+
unless test("[ -f #{remote_apc_file} ]")
|
|
28
|
+
# upload file, if not exists
|
|
29
|
+
upload! local_apc_file, remote_apc_file, via: :scp
|
|
30
|
+
delete_apc_file = true
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
begin
|
|
34
|
+
# call url
|
|
35
|
+
response = call_file_on_server remote_apc_file_name, server
|
|
36
|
+
info I18n.t('tasks.php.clear_apc_cache.result_msg', code: response.code, message: response.message, scope: :dkdeploy)
|
|
37
|
+
if response.is_a? Net::HTTPSuccess
|
|
38
|
+
result = JSON.parse response.body
|
|
39
|
+
unless result['success']
|
|
40
|
+
warn I18n.t('tasks.php.clear_apc_cache.cache_not_cleared', scope: :dkdeploy)
|
|
41
|
+
end
|
|
42
|
+
else
|
|
43
|
+
error I18n.t('tasks.php.clear_apc_cache.response_not_success', code: response.code, message: response.message, scope: :dkdeploy)
|
|
44
|
+
raise
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
ensure
|
|
48
|
+
# Delete file, if uploaded before
|
|
49
|
+
execute(:rm, '-f', remote_apc_file) if delete_apc_file
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
desc 'Clear OPcache on stage'
|
|
55
|
+
task :clear_opcache, :local_opcache_file do |_, args|
|
|
56
|
+
local_opcache_file = ask_variable(args, :local_opcache_file, 'tasks.php.clear_opcache.local_opcache_file') { |question| question.default = 'vendor/opcache_reset.php' }
|
|
57
|
+
|
|
58
|
+
web_root = File.join current_path, fetch(:remote_web_root_path)
|
|
59
|
+
remote_opcache_file_name = fetch(:remote_opcache_file_name)
|
|
60
|
+
remote_opcache_file = File.join web_root, remote_opcache_file_name
|
|
61
|
+
|
|
62
|
+
on roles :app do |server|
|
|
63
|
+
delete_opcache_file = false
|
|
64
|
+
unless test("[ -f #{remote_opcache_file} ]")
|
|
65
|
+
# upload file, if not exists
|
|
66
|
+
upload! local_opcache_file, remote_opcache_file, via: :scp
|
|
67
|
+
delete_opcache_file = true
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
begin
|
|
71
|
+
# call url
|
|
72
|
+
response = call_file_on_server remote_opcache_file_name, server
|
|
73
|
+
info I18n.t('tasks.php.clear_opcache.result_msg', code: response.code, message: response.message, scope: :dkdeploy)
|
|
74
|
+
if response.is_a? Net::HTTPSuccess
|
|
75
|
+
result = JSON.parse response.body
|
|
76
|
+
unless result['success']
|
|
77
|
+
warn I18n.t('tasks.php.clear_opcache.cache_not_cleared', scope: :dkdeploy)
|
|
78
|
+
end
|
|
79
|
+
else
|
|
80
|
+
error I18n.t('tasks.php.clear_opcache.response_not_success', code: response.code, message: response.message, scope: :dkdeploy)
|
|
81
|
+
raise
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
ensure
|
|
85
|
+
# Delete file, if uploaded before
|
|
86
|
+
execute(:rm, '-f', remote_opcache_file) if delete_opcache_file
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
set :application, 'test_app'
|
|
2
|
+
set :composer_default_arguments, fetch(:composer_default_arguments) + ['-d=htdocs/']
|
|
3
|
+
SSHKit.config.command_map.prefix[:compass].push 'bundle exec'
|
|
4
|
+
SSHKit.config.command_map.prefix[:chown].push 'sudo'
|
|
5
|
+
SSHKit.config.command_map.prefix[:chgrp].push 'sudo'
|
|
6
|
+
SSHKit.config.command_map.prefix[:chmod].push 'sudo'
|
|
7
|
+
SSHKit.config.command_map[:composer] = 'php ./vendor/composer.phar'
|
|
8
|
+
SSHKit.config.command_map[:php] = '/usr/bin/php'
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
set :deploy_to, '/var/www/dkdeploy'
|
|
2
|
+
server 'dkdeploy-php.dev', roles: %w(web app backend), primary: true
|
|
3
|
+
|
|
4
|
+
# no ssh compression on the dev stage
|
|
5
|
+
set :ssh_options, {
|
|
6
|
+
compression: 'none'
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
ssh_key_files = Dir.glob(File.join(Dir.getwd, '..', '..', '.vagrant', 'machines', '**', 'virtualbox', 'private_key'))
|
|
10
|
+
unless ssh_key_files.empty?
|
|
11
|
+
# Define generated ssh key files
|
|
12
|
+
set :ssh_options, fetch(:ssh_options).merge(
|
|
13
|
+
{
|
|
14
|
+
user: 'vagrant',
|
|
15
|
+
keys: ssh_key_files
|
|
16
|
+
}
|
|
17
|
+
)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
set :copy_source, 'htdocs'
|
|
21
|
+
set :copy_exclude, %w(
|
|
22
|
+
Gemfile*
|
|
23
|
+
.hidden
|
|
24
|
+
**/.hidden
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
# Set http open timeout to 1 second
|
|
28
|
+
set :http_open_timeout, 60
|
|
29
|
+
|
|
30
|
+
# custom file access properties
|
|
31
|
+
set :custom_file_access, {
|
|
32
|
+
app: {
|
|
33
|
+
catalog: {
|
|
34
|
+
owner: 'test-user',
|
|
35
|
+
group: 'test-group',
|
|
36
|
+
mode: 'a+rwx,o-wx',
|
|
37
|
+
recursive: true
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
<% db_settings = read_db_settings_for_context(self) %>
|
|
3
|
+
$connection = \Doctrine\DBAL\DriverManager::getConnection(
|
|
4
|
+
array(
|
|
5
|
+
'dbname' => '<%= db_settings.fetch('name') %>',
|
|
6
|
+
'user' => '<%= db_settings.fetch('username') %>',
|
|
7
|
+
'password' => '<%= db_settings.fetch('password') %>',
|
|
8
|
+
'host' => '<%= db_settings.fetch('host') %>',
|
|
9
|
+
'port' => '<%= db_settings.fetch('port') %>',
|
|
10
|
+
'charset' => '<%= db_settings.fetch('charset') %>',
|
|
11
|
+
'driver' => 'pdo_mysql'
|
|
12
|
+
)
|
|
13
|
+
);
|
|
14
|
+
$connection->getDatabasePlatform()->registerDoctrineTypeMapping('mediumblob', 'string');
|
|
15
|
+
$connection->getDatabasePlatform()->registerDoctrineTypeMapping('tinyblob', 'string');
|
|
16
|
+
$connection->getDatabasePlatform()->registerDoctrineTypeMapping('longblob', 'string');
|
|
17
|
+
$connection->getDatabasePlatform()->registerDoctrineTypeMapping('blob', 'string');
|
|
18
|
+
|
|
19
|
+
$helperSet = new \Symfony\Component\Console\Helper\HelperSet(
|
|
20
|
+
array(
|
|
21
|
+
'db' => new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($connection)
|
|
22
|
+
)
|
|
23
|
+
);
|
|
File without changes
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "dkdeploy/example",
|
|
3
|
+
"description": "Just a sample composer.json",
|
|
4
|
+
"type": "library",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"phpunit",
|
|
7
|
+
"xunit",
|
|
8
|
+
"testing"
|
|
9
|
+
],
|
|
10
|
+
"homepage": "https://dkd.de/",
|
|
11
|
+
"license": "GPL-3.0",
|
|
12
|
+
"authors": [
|
|
13
|
+
{
|
|
14
|
+
"name": "Random Coder",
|
|
15
|
+
"email": "mail@example.com",
|
|
16
|
+
"role": "lead"
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"require": {
|
|
20
|
+
"symfony/yaml": "~2.0"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
$result = false;
|
|
3
|
+
/**
|
|
4
|
+
* Clear apc cache
|
|
5
|
+
*
|
|
6
|
+
* @see http://stackoverflow.com/questions/911158/how-to-clear-apc-cache-entries/3580939#3580939
|
|
7
|
+
*/
|
|
8
|
+
if (isset($_SERVER['REMOTE_ADDR']) && function_exists('apc_clear_cache')) {
|
|
9
|
+
apc_clear_cache();
|
|
10
|
+
apc_clear_cache('user');
|
|
11
|
+
apc_clear_cache('opcode');
|
|
12
|
+
$result = true;
|
|
13
|
+
}
|
|
14
|
+
echo json_encode(array('success' => $result));
|