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.78.0 sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/instances/base.rb
eac_tools-0.77.1 sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/instances/base.rb
eac_tools-0.77.0 sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/instances/base.rb
eac_tools-0.76.1 sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/instances/base.rb
eac_tools-0.76.0 sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/instances/base.rb
eac_tools-0.75.2 sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/instances/base.rb
eac_tools-0.75.1 sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/instances/base.rb
eac_tools-0.75.0 sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/instances/base.rb
eac_tools-0.74.1 sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/instances/base.rb
eac_tools-0.74.0 sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/instances/base.rb
eac_tools-0.73.0 sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/instances/base.rb
eac_tools-0.72.0 sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/instances/base.rb
eac_tools-0.70.1 sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/instances/base.rb
eac_tools-0.70.0 sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/instances/base.rb
eac_tools-0.69.1 sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/instances/base.rb
eac_tools-0.69.0 sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/instances/base.rb
eac_tools-0.68.0 sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/instances/base.rb
eac_tools-0.67.1 sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/instances/base.rb
eac_tools-0.67.0 sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/instances/base.rb
eac_tools-0.66.0 sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/instances/base.rb