aboutsummaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
Diffstat (limited to 'build')
-rw-r--r--build/build.xml40
-rwxr-xr-xbuild/build_announcement.php40
-rw-r--r--build/code_sniffer/phpbb/Sniffs/Commenting/FileCommentSniff.php210
-rw-r--r--build/code_sniffer/phpbb/Tests/Commenting/FileCommentUnitTest.inc19
-rw-r--r--build/code_sniffer/phpbb/Tests/Commenting/FileCommentUnitTest.php51
-rw-r--r--build/code_sniffer/phpbb/build.xml23
-rw-r--r--build/code_sniffer/phpbb/phpbbCodingStandard.php43
-rw-r--r--build/code_sniffer/ruleset-minimum.xml15
-rw-r--r--build/code_sniffer/ruleset-php-legacy.xml47
-rw-r--r--build/code_sniffer/ruleset-php-strict.xml51
-rwxr-xr-xbuild/package.php56
11 files changed, 563 insertions, 32 deletions
diff --git a/build/build.xml b/build/build.xml
index 83ddcd29c4..1022565ff0 100644
--- a/build/build.xml
+++ b/build/build.xml
@@ -2,9 +2,9 @@
<project name="phpBB" description="The phpBB forum software" default="all" basedir="../">
<!-- a few settings for the build -->
- <property name="newversion" value="3.0.13-dev" />
- <property name="prevversion" value="3.0.12" />
- <property name="olderversions" value="3.0.2, 3.0.3, 3.0.4, 3.0.5, 3.0.6, 3.0.7, 3.0.7-PL1, 3.0.8, 3.0.9, 3.0.10, 3.0.11" />
+ <property name="newversion" value="3.1.0-a4-dev" />
+ <property name="prevversion" value="3.1.0-a2" />
+ <property name="olderversions" value="3.0.12, 3.1.0-a1" />
<!-- no configuration should be needed beyond this point -->
<property name="oldversions" value="${olderversions}, ${prevversion}" />
@@ -74,6 +74,40 @@
passthru="true" />
</target>
+ <target name="sniff">
+ <exec command="phpBB/vendor/bin/phpcs
+ -s
+ --extensions=php
+ --standard=build/code_sniffer/ruleset-php-strict.xml
+ --ignore=phpBB/phpbb/db/migration/data/v30x/*
+ phpBB/phpbb"
+ dir="." returnProperty="retval-php-strict" passthru="true" />
+ <exec command="phpBB/vendor/bin/phpcs
+ -s
+ --extensions=php
+ --standard=build/code_sniffer/ruleset-php-legacy.xml
+ --ignore=phpBB/cache/*
+ --ignore=phpBB/develop/*
+ --ignore=phpBB/includes/diff/*.php
+ --ignore=phpBB/includes/sphinxapi.php
+ --ignore=phpBB/includes/utf/data/*
+ --ignore=phpBB/install/data/*
+ --ignore=phpBB/install/database_update.php
+ --ignore=phpBB/phpbb/*
+ --ignore=phpBB/vendor/*
+ phpBB"
+ dir="." returnProperty="retval-php-legacy" passthru="true" />
+ <if>
+ <or>
+ <not><equals arg1="${retval-php-strict}" arg2="0" /></not>
+ <not><equals arg1="${retval-php-legacy}" arg2="0" /></not>
+ </or>
+ <then>
+ <fail message="PHP Code Sniffer failed." />
+ </then>
+ </if>
+ </target>
+
<target name="docs">
<!-- only works if you setup phpdoctor:
git clone https://github.com/peej/phpdoctor.git
diff --git a/build/build_announcement.php b/build/build_announcement.php
index 3ee96fc67d..a1a496fd68 100755
--- a/build/build_announcement.php
+++ b/build/build_announcement.php
@@ -22,16 +22,20 @@ $checksum_algorithm = $_SERVER['argv'][4];
$series_version = substr($version, 0, 3);
$base_url = "https://download.phpbb.com/pub/release/$series_version";
-if (strpos($version, 'RC') === false)
+if (version_compare($version, "$series_version.0", '<'))
{
- // Final release
- $install_url = "$base_url/$version";
- $update_url = "$base_url/update/to_$version";
+ // Everything before 3.x.0, i.e. unstable (e.g. alpha, beta, rc)
+ $url = "$base_url/unstable/$version";
+}
+else if (strpos($version, 'RC') !== false)
+{
+ // Release candidate of stable release
+ $url = "$base_url/qa/$version";
}
else
{
- $install_url = "$base_url/release_candidates/$version";
- $update_url = "$base_url/release_candidates/update/other_to_$version";
+ // Stable release (e.g. 3.x.0, 3.x.1, 3.x.2, 3.x.3-PL1)
+ $url = "$base_url/$version";
}
if ($mode === 'bbcode')
@@ -58,41 +62,19 @@ function phpbb_string_ends_with($haystack, $needle)
return substr($haystack, -strlen($needle)) === $needle;
}
-function phpbb_is_update_file($filename)
-{
- return strpos($filename, '_to_') !== false;
-}
-
function phpbb_get_checksum($checksum_file)
{
return array_shift(explode(' ', file_get_contents($checksum_file)));
}
-$install_files = $update_files = array();
foreach (phpbb_rnatsort(array_diff(scandir($root), array('.', '..'))) as $filename)
{
if (phpbb_string_ends_with($filename, $checksum_algorithm))
{
continue;
}
- else if (phpbb_is_update_file($filename))
- {
- $update_files[] = $filename;
- }
else
{
- $install_files[] = $filename;
+ printf($template, $url, $filename, phpbb_get_checksum("$root/$filename.$checksum_algorithm"));
}
}
-
-foreach ($install_files as $filename)
-{
- printf($template, $install_url, $filename, phpbb_get_checksum("$root/$filename.$checksum_algorithm"));
-}
-
-echo "\n";
-
-foreach ($update_files as $filename)
-{
- printf($template, $update_url, $filename, phpbb_get_checksum("$root/$filename.$checksum_algorithm"));
-}
diff --git a/build/code_sniffer/phpbb/Sniffs/Commenting/FileCommentSniff.php b/build/code_sniffer/phpbb/Sniffs/Commenting/FileCommentSniff.php
new file mode 100644
index 0000000000..68e9e6bb86
--- /dev/null
+++ b/build/code_sniffer/phpbb/Sniffs/Commenting/FileCommentSniff.php
@@ -0,0 +1,210 @@
+<?php
+/**
+*
+* @package code_sniffer
+* @version $Id: $
+* @copyright (c) 2007 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+/**
+* Checks that each source file contains the standard header.
+*
+* Based on Coding Guidelines 1.ii File Header.
+*
+* @package code_sniffer
+* @author Manuel Pichler <mapi@phpundercontrol.org>
+*/
+class phpbb_Sniffs_Commenting_FileCommentSniff implements PHP_CodeSniffer_Sniff
+{
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return array(T_OPEN_TAG);
+ }
+
+ /**
+ * Processes this test, when one of its tokens is encountered.
+ *
+ * @param PHP_CodeSniffer_File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token
+ * in the stack passed in $tokens.
+ *
+ * @return null
+ */
+ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
+ {
+ // We are only interested in the first file comment.
+ if ($stackPtr !== 0)
+ {
+ if ($phpcsFile->findPrevious(T_OPEN_TAG, $stackPtr - 1) !== false)
+ {
+ return;
+ }
+ }
+
+ // Fetch next non whitespace token
+ $tokens = $phpcsFile->getTokens();
+ $start = $phpcsFile->findNext(T_WHITESPACE, $stackPtr + 1, null, true);
+
+ // Skip empty files
+ if ($tokens[$start]['code'] === T_CLOSE_TAG)
+ {
+ return;
+ }
+ // Mark as error if this is not a doc comment
+ else if ($start === false || $tokens[$start]['code'] !== T_DOC_COMMENT)
+ {
+ $phpcsFile->addError('Missing required file doc comment.', $stackPtr);
+ return;
+ }
+
+ // Find comment end token
+ $end = $phpcsFile->findNext(T_DOC_COMMENT, $start + 1, null, true) - 1;
+
+ // If there is no end, skip processing here
+ if ($end === false)
+ {
+ return;
+ }
+
+ // List of found comment tags
+ $tags = array();
+
+ // check comment lines without the first(/**) an last(*/) line
+ for ($i = $start + 1, $c = ($end - $start); $i <= $c; ++$i)
+ {
+ $line = $tokens[$i]['content'];
+
+ // Check that each line starts with a '*'
+ if (substr($line, 0, 1) !== '*')
+ {
+ $message = 'The file doc comment should not be idented.';
+ $phpcsFile->addWarning($message, $i);
+ }
+ else if (preg_match('/^\*\s+@([\w]+)\s+(.*)$/', $line, $match) !== 0)
+ {
+ $tags[$match[1]] = array($match[2], $i);
+ }
+ }
+
+ // Check that the first and last line is empty
+ if (trim($tokens[$start + 1]['content']) !== '*')
+ {
+ $message = 'The first file comment line should be empty.';
+ $phpcsFile->addWarning($message, ($start + 1));
+ }
+ if (trim($tokens[$end - $start]['content']) !== '*')
+ {
+ $message = 'The last file comment line should be empty.';
+ $phpcsFile->addWarning($message, ($end - $start));
+ }
+
+ $this->processPackage($phpcsFile, $start, $tags);
+ $this->processVersion($phpcsFile, $start, $tags);
+ $this->processCopyright($phpcsFile, $start, $tags);
+ $this->processLicense($phpcsFile, $start, $tags);
+
+ //print_r($tags);
+ }
+
+ /**
+ * Checks that the tags array contains a valid package tag
+ *
+ * @param PHP_CodeSniffer_File $phpcsFile The context source file instance.
+ * @param integer The stack pointer for the first comment token.
+ * @param array(string=>array) $tags The found file doc comment tags.
+ *
+ * @return null
+ */
+ protected function processPackage(PHP_CodeSniffer_File $phpcsFile, $ptr, $tags)
+ {
+ if (!isset($tags['package']))
+ {
+ $message = 'Missing require @package tag in file doc comment.';
+ $phpcsFile->addError($message, $ptr);
+ }
+ else if (preg_match('/^([\w]+)$/', $tags['package'][0]) === 0)
+ {
+ $message = 'Invalid content found for @package tag.';
+ $phpcsFile->addWarning($message, $tags['package'][1]);
+ }
+ }
+
+ /**
+ * Checks that the tags array contains a valid version tag
+ *
+ * @param PHP_CodeSniffer_File $phpcsFile The context source file instance.
+ * @param integer The stack pointer for the first comment token.
+ * @param array(string=>array) $tags The found file doc comment tags.
+ *
+ * @return null
+ */
+ protected function processVersion(PHP_CodeSniffer_File $phpcsFile, $ptr, $tags)
+ {
+ if (!isset($tags['version']))
+ {
+ $message = 'Missing require @version tag in file doc comment.';
+ $phpcsFile->addError($message, $ptr);
+ }
+ else if (preg_match('/^\$Id:[^\$]+\$$/', $tags['version'][0]) === 0)
+ {
+ $message = 'Invalid content found for @version tag, use "$Id: $".';
+ $phpcsFile->addError($message, $tags['version'][1]);
+ }
+ }
+
+ /**
+ * Checks that the tags array contains a valid copyright tag
+ *
+ * @param PHP_CodeSniffer_File $phpcsFile The context source file instance.
+ * @param integer The stack pointer for the first comment token.
+ * @param array(string=>array) $tags The found file doc comment tags.
+ *
+ * @return null
+ */
+ protected function processCopyright(PHP_CodeSniffer_File $phpcsFile, $ptr, $tags)
+ {
+ if (!isset($tags['copyright']))
+ {
+ $message = 'Missing require @copyright tag in file doc comment.';
+ $phpcsFile->addError($message, $ptr);
+ }
+ else if (preg_match('/^\(c\) 2[0-9]{3} phpBB Group\s*$/', $tags['copyright'][0]) === 0)
+ {
+ $message = 'Invalid content found for @copyright tag, use "(c) <year> phpBB Group".';
+ $phpcsFile->addError($message, $tags['copyright'][1]);
+ }
+ }
+
+ /**
+ * Checks that the tags array contains a valid license tag
+ *
+ * @param PHP_CodeSniffer_File $phpcsFile The context source file instance.
+ * @param integer The stack pointer for the first comment token.
+ * @param array(string=>array) $tags The found file doc comment tags.
+ *
+ * @return null
+ */
+ protected function processLicense(PHP_CodeSniffer_File $phpcsFile, $ptr, $tags)
+ {
+ $license = 'http://opensource.org/licenses/gpl-license.php GNU Public License';
+
+ if (!isset($tags['license']))
+ {
+ $message = 'Missing require @license tag in file doc comment.';
+ $phpcsFile->addError($message, $ptr);
+ }
+ else if (trim($tags['license'][0]) !== $license)
+ {
+ $message = 'Invalid content found for @license tag, use '
+ . '"' . $license . '".';
+ $phpcsFile->addError($message, $tags['license'][1]);
+ }
+ }
+}
diff --git a/build/code_sniffer/phpbb/Tests/Commenting/FileCommentUnitTest.inc b/build/code_sniffer/phpbb/Tests/Commenting/FileCommentUnitTest.inc
new file mode 100644
index 0000000000..0ace1c1bda
--- /dev/null
+++ b/build/code_sniffer/phpbb/Tests/Commenting/FileCommentUnitTest.inc
@@ -0,0 +1,19 @@
+<?php
+/**
+*
+* @package code_sniffer³
+* @version $Id: $
+* @copyright (c) 2008 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php BSD License
+ *
+*/
+?>
+<?php
+/**
+* Broken but not first file doc comment.
+*
+* @version @package_version@
+* @license http://www.opensource.org/licenses/bsd-license.php BSD License
+* @copyright (c) 2007 phpBB Group
+*
+*/
diff --git a/build/code_sniffer/phpbb/Tests/Commenting/FileCommentUnitTest.php b/build/code_sniffer/phpbb/Tests/Commenting/FileCommentUnitTest.php
new file mode 100644
index 0000000000..affa27b56c
--- /dev/null
+++ b/build/code_sniffer/phpbb/Tests/Commenting/FileCommentUnitTest.php
@@ -0,0 +1,51 @@
+<?php
+/**
+*
+* @package code_sniffer
+* @version $Id: $
+* @copyright (c) 2007 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+/**
+* Unit test class for the EmptyStatement sniff.
+*
+* @package code_sniffer
+* @author Manuel Pichler <mapi@phpundercontrol.org>
+*/
+class phpbb_Tests_Commenting_FileCommentUnitTest extends AbstractSniffUnitTest
+{
+
+ /**
+ * Returns the lines where errors should occur.
+ *
+ * The key of the array should represent the line number and the value
+ * should represent the number of errors that should occur on that line.
+ *
+ * @return array(int => int)
+ */
+ public function getErrorList()
+ {
+ return array(
+ 7 => 1 // BSD License error :)
+ );
+ }//end getErrorList()
+
+
+ /**
+ * Returns the lines where warnings should occur.
+ *
+ * The key of the array should represent the line number and the value
+ * should represent the number of warnings that should occur on that line.
+ *
+ * @return array(int => int)
+ */
+ public function getWarningList()
+ {
+ return array(
+ 4 => 1,
+ 8 => 1
+ );
+ }//end getWarningList()
+}
diff --git a/build/code_sniffer/phpbb/build.xml b/build/code_sniffer/phpbb/build.xml
new file mode 100644
index 0000000000..b6d3bf6451
--- /dev/null
+++ b/build/code_sniffer/phpbb/build.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="code_sniffer" basedir="." default="install">
+
+ <property name="working.dir" value="${basedir}" />
+ <property name="target.dir" value="/usr/share/php/PHP/CodeSniffer/Standards" />
+
+ <!--
+ Install phpbb sniff
+ -->
+ <target name="install">
+ <delete dir="${target.dir}/phpbb" />
+ <mkdir dir="${target.dir}/phpbb"/>
+
+ <copy todir="${target.dir}/phpbb">
+ <fileset file="${working.dir}/phpbbCodingStandard.php" />
+ </copy>
+ <copy todir="${target.dir}/phpbb/Sniffs">
+ <fileset dir="${working.dir}/Sniffs" />
+ </copy>
+
+ </target>
+
+</project>
diff --git a/build/code_sniffer/phpbb/phpbbCodingStandard.php b/build/code_sniffer/phpbb/phpbbCodingStandard.php
new file mode 100644
index 0000000000..adbba9d915
--- /dev/null
+++ b/build/code_sniffer/phpbb/phpbbCodingStandard.php
@@ -0,0 +1,43 @@
+<?php
+/**
+*
+* @package code_sniffer
+* @version $Id: $
+* @copyright (c) 2007 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+/**
+ * @ignore
+ */
+if (class_exists('PHP_CodeSniffer_Standards_CodingStandard', true) === false) {
+ throw new PHP_CodeSniffer_Exception(
+ 'Class PHP_CodeSniffer_Standards_CodingStandard not found'
+ );
+}
+
+/**
+ * Primary class for the phpbb coding standard.
+ *
+ * @package code_sniffer
+ */
+class PHP_CodeSniffer_Standards_phpbb_phpbbCodingStandard extends PHP_CodeSniffer_Standards_CodingStandard
+{
+ /**
+ * Return a list of external sniffs to include with this standard.
+ *
+ * External locations can be single sniffs, a whole directory of sniffs, or
+ * an entire coding standard. Locations start with the standard name. For
+ * example:
+ * PEAR => include all sniffs in this standard
+ * PEAR/Sniffs/Files => include all sniffs in this dir
+ * PEAR/Sniffs/Files/LineLengthSniff => include this single sniff
+ *
+ * @return array
+ */
+ public function getIncludedSniffs()
+ {
+ return array();
+ }
+}
diff --git a/build/code_sniffer/ruleset-minimum.xml b/build/code_sniffer/ruleset-minimum.xml
new file mode 100644
index 0000000000..33d0177390
--- /dev/null
+++ b/build/code_sniffer/ruleset-minimum.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<ruleset name="phpBB Minimum Standard">
+
+ <description>phpBB minimum coding standard</description>
+
+ <!-- All code files MUST use only UTF-8 without BOM. -->
+ <rule ref="Generic.Files.ByteOrderMark" />
+
+ <!-- All code files MUST use the Unix LF (linefeed) line ending. -->
+ <rule ref="Generic.Files.LineEndings" />
+
+ <!-- Tabs MUST be used for indentation -->
+ <rule ref="Generic.WhiteSpace.DisallowSpaceIndent" />
+
+</ruleset>
diff --git a/build/code_sniffer/ruleset-php-legacy.xml b/build/code_sniffer/ruleset-php-legacy.xml
new file mode 100644
index 0000000000..550c919b5d
--- /dev/null
+++ b/build/code_sniffer/ruleset-php-legacy.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+<ruleset name="phpBB PHP Legacy Standard">
+
+ <description>phpBB legacy coding standard for PHP files</description>
+
+ <rule ref="./ruleset-minimum.xml" />
+
+ <!-- "for (; bar; )" should be "while (bar)" instead -->
+ <rule ref="Generic.CodeAnalysis.ForLoopShouldBeWhileLoop" />
+
+ <!-- A method MUST not only call its parent -->
+ <rule ref="Generic.CodeAnalysis.UselessOverridingMethod" />
+
+ <!-- The body of each structure MUST be enclosed by braces. -->
+ <rule ref="Generic.ControlStructures.InlineControlStructure" />
+
+ <!-- There MUST not be more than one statement per line. -->
+ <rule ref="Generic.Formatting.DisallowMultipleStatements" />
+
+ <!-- Call-time pass-by-reference MUST not be used. -->
+ <rule ref="Generic.Functions.CallTimePassByReference.NotAllowed" />
+
+ <!-- Class constants MUST be declared in all upper case with underscore separators. -->
+ <rule ref="Generic.NamingConventions.UpperCaseConstantName" />
+
+ <!-- Only <?php, no short tags. -->
+ <rule ref="Generic.PHP.DisallowShortOpenTag.EchoFound" />
+
+ <!-- Method arguments with default values MUST go at the end of the argument list. -->
+ <rule ref="PEAR.Functions.ValidDefaultValue" />
+
+ <!-- Each file MUST end with exactly one newline character -->
+ <rule ref="PSR2.Files.EndFileNewline" />
+
+ <!-- In the argument list, there MUST NOT be a space before each comma,
+ and there MUST be one space after each comma. -->
+ <rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing">
+ <properties>
+ <property name="equalsSpacing" value="1"/>
+ </properties>
+ </rule>
+ <rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterHint" />
+
+ <!-- The ?> closing tag MUST be omitted from files containing only PHP. -->
+ <rule ref="Zend.Files.ClosingTag" />
+
+</ruleset>
diff --git a/build/code_sniffer/ruleset-php-strict.xml b/build/code_sniffer/ruleset-php-strict.xml
new file mode 100644
index 0000000000..5e3c26a616
--- /dev/null
+++ b/build/code_sniffer/ruleset-php-strict.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0"?>
+<ruleset name="phpBB PHP Strict Standard">
+
+ <description>phpBB coding standard for PHP files</description>
+
+ <rule ref="./ruleset-php-legacy.xml" />
+
+ <!-- There SHOULD NOT be more than 80 characters per line
+ There MUST NOT be more than 120 characters per line -->
+ <!--
+ <rule ref="Generic.Files.LineLength">
+ <properties>
+ <property name="lineLimit" value="80"/>
+ <property name="absoluteLineLimit" value="120"/>
+ </properties>
+ </rule>
+ -->
+
+ <!-- The PHP constants true, false, and null MUST be in lower case. -->
+ <rule ref="Generic.PHP.LowerCaseConstant" />
+
+ <!-- PHP keywords MUST be in lower case. -->
+ <rule ref="Generic.PHP.LowerCaseKeyword" />
+
+ <!-- There MUST NOT be trailing whitespace at the end of lines. -->
+ <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace" />
+
+ <!-- There MUST NOT be whitespace before the first content of a file -->
+ <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.StartFile" />
+
+ <!-- There MUST NOT be whitespace after the last content of a file -->
+ <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EndFile" />
+
+ <!-- Functions MUST NOT contain multiple empty lines in a row -->
+ <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines" />
+
+ <!-- Classes etc. MUST be namespaced -->
+ <rule ref="PSR1.Classes.ClassDeclaration.MissingNamespace" />
+
+ <!-- A file MUST not contain more than one class/interface -->
+ <rule ref="PSR1.Classes.ClassDeclaration.MultipleClasses" />
+
+ <!-- Files containing classes MUST not have any side-effects -->
+ <rule ref="PSR1.Files.SideEffects.FoundWithSymbols" />
+
+ <!-- When present, all use declarations MUST go after the namespace declaration.
+ There MUST be one use keyword per declaration.
+ There MUST be one blank line after the use block. -->
+ <rule ref="PSR2.Namespaces.UseDeclaration" />
+
+</ruleset>
diff --git a/build/package.php b/build/package.php
index 22ea4e52af..97bfc4ea5c 100755
--- a/build/package.php
+++ b/build/package.php
@@ -121,6 +121,7 @@ if (sizeof($package->old_packages))
$package->run_command('cp -Rp ' . $package->get('dest_dir') . '/docs ' . $dest_filename_dir);
$package->run_command('cp -Rp ' . $package->get('dest_dir') . '/install ' . $dest_filename_dir);
+ $package->run_command('cp -Rp ' . $package->get('dest_dir') . '/vendor ' . $dest_filename_dir);
$package->run_command('mkdir ' . $dest_filename_dir . '/install/update');
$package->run_command('mkdir ' . $dest_filename_dir . '/install/update/old');
@@ -173,6 +174,27 @@ if (sizeof($package->old_packages))
$package->run_command('cp ' . $source_filename . ' ' . $dest_filename);
}
+ /**
+ * 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(
+ 'copied' => false,
+ 'copy' => array(
+ 'adm/images/*' => 'adm/images',
+ ),
+ ),
+ 'config/' => array(
+ 'copied' => false,
+ 'copy' => array(
+ 'config/*.yml' => 'config',
+ ),
+ ),
+ );
+
// Then fill the 'new' directory
foreach ($file_contents['all'] as $file)
{
@@ -184,6 +206,8 @@ if (sizeof($package->old_packages))
continue;
}
+ $filename = $file;
+
// Create Directories along the way?
$file = explode('/', $file);
// Remove filename portion
@@ -204,6 +228,37 @@ 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($filename, $reference) === 0 && !$data['copied'])
+ {
+ foreach ($data['copy'] as $source_dir_files => $destination_dir)
+ {
+ // Create directories along the way?
+ $directories = explode('/', $destination_dir);
+
+ chdir($dest_filename_dir . '/install/update/new');
+ foreach ($directories 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
@@ -256,6 +311,7 @@ $update_info = array(
// Copy the install files to their respective locations
$package->run_command('cp -Rp ' . $package->get('dest_dir') . '/docs ' . $package->get('patch_directory'));
$package->run_command('cp -Rp ' . $package->get('dest_dir') . '/install ' . $package->get('patch_directory'));
+ $package->run_command('cp -Rp ' . $package->get('dest_dir') . '/vendor ' . $package->get('patch_directory'));
// Remove some files
chdir($package->get('patch_directory') . '/install');