# limitations under the License.
#
+unified_mode true
+
default_action :create
property :site, :kind_of => String, :name_property => true
end
end
- execute "#{mediawiki_directory}/maintenance/install.php" do
- action :nothing
- # Use metanamespace as Site Name to ensure correct set namespace
- command "php maintenance/install.php --server '#{name}' --dbtype 'mysql' --dbname '#{new_resource.database_name}' --dbuser '#{new_resource.database_user}' --dbpass '#{new_resource.database_password}' --dbserver 'localhost' --scriptpath /w --pass '#{new_resource.admin_password}' '#{new_resource.metanamespace}' '#{new_resource.admin_user}'"
- cwd mediawiki_directory
- user node[:mediawiki][:user]
- group node[:mediawiki][:group]
- not_if do
- ::File.exist?("#{mediawiki_directory}/LocalSettings-install.php")
- end
- notifies :run, "ruby_block[rename-installer-localsettings]", :immediately
- end
-
- execute "#{mediawiki_directory}/maintenance/update.php" do
- action :nothing
- command "php maintenance/update.php --quick"
- cwd mediawiki_directory
- user node[:mediawiki][:user]
- group node[:mediawiki][:group]
- end
-
declare_resource :directory, site_directory do
owner node[:mediawiki][:user]
group node[:mediawiki][:group]
mode "775"
end
- mediawiki_reference = "REL#{new_resource.version}".tr(".", "_")
-
git mediawiki_directory do
action :sync
repository "https://gerrit.wikimedia.org/r/mediawiki/core.git"
notifies :run, "execute[#{mediawiki_directory}/maintenance/update.php]"
end
+ template "#{mediawiki_directory}/composer.local.json" do
+ cookbook "mediawiki"
+ source "composer.local.json.erb"
+ owner node[:mediawiki][:user]
+ group node[:mediawiki][:group]
+ mode "664"
+ end
+
execute "#{mediawiki_directory}/composer.json" do
action :nothing
command "composer update --no-dev"
environment "COMPOSER_HOME" => site_directory
end
- template "#{mediawiki_directory}/composer.local.json" do
- cookbook "mediawiki"
- source "composer.local.json.erb"
- owner node[:mediawiki][:user]
+ execute "#{mediawiki_directory}/maintenance/install.php" do
+ action :nothing
+ # Use metanamespace as Site Name to ensure correct set namespace
+ command "php maintenance/install.php --server '#{name}' --dbtype 'mysql' --dbname '#{new_resource.database_name}' --dbuser '#{new_resource.database_user}' --dbpass '#{new_resource.database_password}' --dbserver 'localhost' --scriptpath /w --pass '#{new_resource.admin_password}' '#{new_resource.metanamespace}' '#{new_resource.admin_user}'"
+ cwd mediawiki_directory
+ user node[:mediawiki][:user]
+ group node[:mediawiki][:group]
+ not_if do
+ ::File.exist?("#{mediawiki_directory}/LocalSettings-install.php")
+ end
+ notifies :run, "ruby_block[rename-installer-localsettings]", :immediately
+ end
+
+ execute "#{mediawiki_directory}/maintenance/update.php" do
+ action :nothing
+ command "php maintenance/update.php --quick"
+ cwd mediawiki_directory
+ user node[:mediawiki][:user]
group node[:mediawiki][:group]
- mode "664"
end
# Safety catch if git doesn't update but install.php hasn't run
new_resource.directory || "/srv/#{new_resource.site}"
end
+ def mediawiki_reference
+ shell_out!("git", "ls-remote", "--refs", "--sort=-version:refname",
+ "https://gerrit.wikimedia.org/r/mediawiki/core.git",
+ "refs/tags/#{new_resource.version}.*")
+ .stdout
+ .split("\n")
+ .first
+ .split("/")
+ .last
+ end
+
def cron_name
new_resource.site.tr(".", "_")
end