From eac19fb5f63b012cd88a5970bcb392c598021a41 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 19 Dec 2013 15:23:09 +0100 Subject: [PATCH 1/4] [ticket/12030] Include config directory completly in update packages When one of the config files was updated, we need to include all config files because they are referenced relative from the files themselves. PHPBB3-12030 --- build/package.php | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/build/package.php b/build/package.php index d05448dfb4..d80a09cc59 100755 --- a/build/package.php +++ b/build/package.php @@ -174,6 +174,21 @@ if (sizeof($package->old_packages)) $package->run_command('cp ' . $source_filename . ' ' . $dest_filename); } + /** + * When we create the update packages, we try to make them as small as possible. + * However sometimes we need to include additional files, that are not included + * in the diff, in order to able to correctly include the relative referenced + * files from the same or subsequent directories. + */ + $copy_relative_directories = array( + 'config/' => array( + 'copied' => false, + 'copy' => array( + 'config/*.yml' => 'config', + ), + ), + ); + // Then fill the 'new' directory foreach ($file_contents['all'] as $file) { @@ -205,6 +220,38 @@ if (sizeof($package->old_packages)) } $package->run_command('cp ' . $source_filename . ' ' . $dest_filename); + + foreach ($copy_relative_directories as $reference => $data) + { + // Copy all relative referenced files if needed + if (strpos($file, $reference) === 0 && !$data['copied']) + { + foreach ($data['copy'] as $source_dir_files => $destination_dir) + { + // Create Directories along the way? + $directories = explode('/', $directory); + + chdir($dest_filename_dir . '/install/update/new'); + foreach ($destination_dir as $dir) + { + $dir = trim($dir); + if ($dir) + { + if (!file_exists('./' . $dir)) + { + $package->run_command('mkdir ' . $dir); + } + chdir('./' . $dir); + } + } + $source_dir_files = $package->locations['old_versions'] . $package->get('simple_name') . '/' . $source_dir_files; + $destination_dir = $dest_filename_dir . '/install/update/new/' . $destination_dir; + + $package->run_command('cp ' . $source_dir_files . ' ' . $destination_dir); + } + $copy_relative_directories[$reference]['copied'] = true; + } + } } // Build index.php file for holding the file structure From 4429022b98ed97dd91024edb45db8bfc7addf64e Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 19 Dec 2013 15:25:38 +0100 Subject: [PATCH 2/4] [ticket/12030] Include adm/images/ when the css file was updated The images are referenced relative from the admin.css file. So when it was updated and the images where not, the updater will be without images, unless we ensure that they are included in the update-package. PHPBB3-12021 PHPBB3-12030 --- build/package.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/build/package.php b/build/package.php index d80a09cc59..4d9e43f4a3 100755 --- a/build/package.php +++ b/build/package.php @@ -181,6 +181,12 @@ if (sizeof($package->old_packages)) * files from the same or subsequent directories. */ $copy_relative_directories = array( + 'adm/style/admin.css' => array( + 'copied' => false, + 'copy' => array( + 'adm/images/*' => 'adm/images', + ), + ), 'config/' => array( 'copied' => false, 'copy' => array( From df613892383298aa17d8c69d790d4be2a84283d3 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 19 Dec 2013 16:40:30 +0100 Subject: [PATCH 3/4] [ticket/12030] Fix wrong file and directory names PHPBB3-12030 --- build/package.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/build/package.php b/build/package.php index 4d9e43f4a3..d8ae1f94ff 100755 --- a/build/package.php +++ b/build/package.php @@ -206,6 +206,8 @@ if (sizeof($package->old_packages)) continue; } + $filename = $file; + // Create Directories along the way? $file = explode('/', $file); // Remove filename portion @@ -230,15 +232,15 @@ if (sizeof($package->old_packages)) foreach ($copy_relative_directories as $reference => $data) { // Copy all relative referenced files if needed - if (strpos($file, $reference) === 0 && !$data['copied']) + if (strpos($filename, $reference) === 0 && !$data['copied']) { foreach ($data['copy'] as $source_dir_files => $destination_dir) { // Create Directories along the way? - $directories = explode('/', $directory); + $directories = explode('/', $destination_dir); chdir($dest_filename_dir . '/install/update/new'); - foreach ($destination_dir as $dir) + foreach ($directories as $dir) { $dir = trim($dir); if ($dir) @@ -252,7 +254,6 @@ if (sizeof($package->old_packages)) } $source_dir_files = $package->locations['old_versions'] . $package->get('simple_name') . '/' . $source_dir_files; $destination_dir = $dest_filename_dir . '/install/update/new/' . $destination_dir; - $package->run_command('cp ' . $source_dir_files . ' ' . $destination_dir); } $copy_relative_directories[$reference]['copied'] = true; From 2081d973b0f09cefeabeba724ab49002e534bb7d Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 8 Jan 2014 23:45:54 +0100 Subject: [PATCH 4/4] [ticket/12030] Fix some spelling issues PHPBB3-12030 --- build/package.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/build/package.php b/build/package.php index d8ae1f94ff..97bfc4ea5c 100755 --- a/build/package.php +++ b/build/package.php @@ -175,10 +175,10 @@ if (sizeof($package->old_packages)) } /** - * When we create the update packages, we try to make them as small as possible. - * However sometimes we need to include additional files, that are not included - * in the diff, in order to able to correctly include the relative referenced - * files from the same or subsequent directories. + * We try to keep the update packages as small as possible while creating them. + * However, we sometimes need to include additional files that are not included + * in the diff in order to be able to correctly include the relatively + * referenced files from the same or subsequent directories. */ $copy_relative_directories = array( 'adm/style/admin.css' => array( @@ -236,7 +236,7 @@ if (sizeof($package->old_packages)) { foreach ($data['copy'] as $source_dir_files => $destination_dir) { - // Create Directories along the way? + // Create directories along the way? $directories = explode('/', $destination_dir); chdir($dest_filename_dir . '/install/update/new');