aboutsummaryrefslogtreecommitdiffstats
path: root/build/build_helper.php
diff options
context:
space:
mode:
Diffstat (limited to 'build/build_helper.php')
-rw-r--r--build/build_helper.php69
1 files changed, 66 insertions, 3 deletions
diff --git a/build/build_helper.php b/build/build_helper.php
index d6169b913b..35e8cd744b 100644
--- a/build/build_helper.php
+++ b/build/build_helper.php
@@ -1,9 +1,13 @@
<?php
/**
*
-* @package build
-* @copyright (c) 2010 phpBB Group
-* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
*
*/
@@ -312,4 +316,63 @@ class build_package
return $result;
}
+
+ /**
+ * Collect the list of the deleted files from a list of deleted files and folders.
+ *
+ * @param string $deleted_filename The full path to a file containing the list of deleted files and directories
+ * @param string $package_name The name of the package
+ * @return array
+ */
+ public function collect_deleted_files($deleted_filename, $package_name)
+ {
+ $result = array();
+ $file_contents = file($deleted_filename);
+
+ foreach ($file_contents as $filename)
+ {
+ $filename = trim($filename);
+
+ if (!$filename)
+ {
+ continue;
+ }
+
+ $filename = str_replace('Only in ' . $package_name, '', $filename);
+ $filename = ltrim($filename, '/');
+
+ if (substr($filename, 0, 1) == ':')
+ {
+ $replace = '';
+ }
+ else
+ {
+ $replace = '/';
+ }
+
+ $filename = str_replace(': ', $replace, $filename);
+
+ if (is_dir("{$this->locations['old_versions']}{$package_name}/{$filename}"))
+ {
+ $iterator = new \RecursiveIteratorIterator(
+ new \RecursiveDirectoryIterator(
+ "{$this->locations['old_versions']}{$package_name}/{$filename}",
+ \FilesystemIterator::UNIX_PATHS | \FilesystemIterator::SKIP_DOTS
+ ),
+ \RecursiveIteratorIterator::LEAVES_ONLY
+ );
+
+ foreach ($iterator as $file_info)
+ {
+ $result[] = "{$filename}/{$iterator->getSubPathname()}";
+ }
+ }
+ else
+ {
+ $result[] = $filename;
+ }
+ }
+
+ return $result;
+ }
}