Sha256: 414d9ec8bcefb2c58947eb43e4836cea01f720781f63e88122794e76c8f727c1

Contents?: true

Size: 1.25 KB

Versions: 52

Compression:

Stored size: 1.25 KB

Contents

# frozen_string_literal: true

require 'avm/instances/entry_keys'
require 'avm/eac_webapp_base0/instances/base'

module Avm
  module EacWordpressBase0
    module Instances
      class Base < ::Avm::EacWebappBase0::Instances::Base
        THEMES_UNIT_SUBPATH = 'wp-content/themes'
        UPLOADS_UNIT_SUBPATH = 'wp-content/uploads'

        # @return [Avm::Instances::Data::Package]
        def data_package_create
          %w[database themes uploads].inject(super) do |a, e|
            a.add_unit(e, send("#{e}_unit"))
          end
        end

        def database_unit
          web_url = read_entry(::Avm::Instances::EntryKeys::WEB_URL)
          super.after_load do
            info 'Fixing web addresses...'
            run_sql(<<~SQL)
              update wp_options
              set option_value = '#{web_url}'
              where option_name in ('siteurl', 'home')
            SQL
          end
        end

        # @return [Avm::Instances::Data::FilesUnit]
        def themes_unit
          ::Avm::Instances::Data::FilesUnit.new(self, THEMES_UNIT_SUBPATH)
        end

        # @return [Avm::Instances::Data::FilesUnit]
        def uploads_unit
          ::Avm::Instances::Data::FilesUnit.new(self, UPLOADS_UNIT_SUBPATH)
        end
      end
    end
  end
end

Version data entries

52 entries across 52 versions & 2 rubygems

Version Path
eac_tools-0.65.1 sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/instances/base.rb
eac_tools-0.65.0 sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/instances/base.rb
eac_tools-0.64.0 sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/instances/base.rb
eac_tools-0.63.0 sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/instances/base.rb
eac_tools-0.62.1 sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/instances/base.rb
eac_tools-0.62.0 sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/instances/base.rb
eac_tools-0.61.1 sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/instances/base.rb
eac_tools-0.61.0 sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/instances/base.rb
eac_tools-0.60.3 sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/instances/base.rb
eac_tools-0.60.2 sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/instances/base.rb
avm-eac_wordpress_base0-0.3.1 lib/avm/eac_wordpress_base0/instances/base.rb
eac_tools-0.60.1 sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/instances/base.rb